public void Execute_IntegrationTest_SQLite() { string filePath = Path.Combine(AppContext.BaseDirectory, Path.GetRandomFileName() + ".dbtest"); using (SQLiteDbContext dbContext = new SQLiteDbContext(filePath)) { dbContext.Initialise(); dbContext.BeginTransaction(); // create the user UserModel user = DataHelper.CreateUserModel(); IUserRepository userRepo = new UserRepository(dbContext); IUserValidator userValidator = new UserValidator(userRepo); IPasswordProvider passwordProvider = new PasswordProvider(); ICreateUserCommand createUserCommand = new CreateUserCommand(dbContext, userValidator, passwordProvider); UserModel savedUser = createUserCommand.Execute(user.UserName, user.Password, user.Role); // reset the password string newPassword = Guid.NewGuid().ToString(); IUpdateUserPasswordCommand updateCommand = new UpdateUserPasswordCommand(dbContext, userRepo, passwordProvider); updateCommand.Execute(savedUser.UserName, newPassword); // now fetch it again and check the password is good savedUser = userRepo.GetByUserName(user.UserName); Assert.IsTrue(passwordProvider.CheckPassword(newPassword, savedUser.Password)); } }
static void Main(string[] args) { var config = new ConfigurationBuilder() .AddJsonFile("client-secrets.json") .Build(); var token = new PasswordProvider(config["ClientId"], config["ClientSecret"], retry => new NetworkCredential(config["User"], config["Password"]), config["AuthURL"]); ApiConfiguration apiconfig = new ApiConfiguration() { BaseUrl = "https://api.animeraiku.com" }; api = new ApiClient(token, apiconfig); var dtt = GetDTT().Result; var dt = GetDT().Result; foreach (var item in dtt) { if ((new string[] { "validDomains", "invalidNames" }).Contains(item.Attributes.Slug)) { continue; } CreateClass(item, dt.Where(k => k.Attributes.Type.Id == item.Id)); } }
public void Execute_IntegrationTest_SQLite() { string filePath = Path.Combine(AppContext.BaseDirectory, Path.GetRandomFileName() + ".dbtest"); using (SQLiteDbContext dbContext = new SQLiteDbContext(filePath)) { dbContext.Initialise(); dbContext.BeginTransaction(); // create the user UserModel user = DataHelper.CreateUserModel(); IUserRepository userRepo = new UserRepository(dbContext); IUserValidator userValidator = new UserValidator(userRepo); IPasswordProvider passwordProvider = new PasswordProvider(); ICreateUserCommand createUserCommand = new CreateUserCommand(dbContext, userValidator, passwordProvider); createUserCommand.Execute(user.UserName, user.Password, user.Role); UserModel savedUser = userRepo.GetByUserName(user.UserName); Assert.IsNotNull(savedUser); Assert.AreEqual(user.Role, savedUser.Role); Assert.IsTrue(passwordProvider.CheckPassword(user.Password, savedUser.Password)); } }
public IActionResult Get([FromForm] vm.Authenticate model) { if (model == null) { return(this.BadRequest()); } var user = this.Users.Query.FirstOrDefault(x => x.UserName == model.UserName); if (user == null) { return(this.BadRequest("User not found")); } if (!PasswordProvider.Verify(model.Password, user.Password)) { return(this.BadRequest("Incorrect user name or password")); } var claims = this.GetClaims(user); var token = this.Token.Generate(claims); return(this.Ok(new { access_token = token })); }
public Map() { // To VM this.CreateMap <data.User, User>() .ForMember(destination => destination.Pharmacy, x => x.MapFrom(src => src.Pharmacy)) .ForMember(destination => destination.NewPassword, x => x.Ignore()) .ForMember(destination => destination.FirstName, x => x.MapFrom(src => src.FirstName)) .ForMember(destination => destination.LastName, x => x.MapFrom(src => src.LastName)) .ForMember(destination => destination.UserName, x => x.MapFrom(src => src.UserName)) .ForMember(destination => destination.IsSuper, x => x.MapFrom(src => src.IsSuperUser)) .ForMember(destination => destination.Id, x => x.MapFrom(src => src.Id)); // To Data Moodel this.CreateMap <User, data.User>() .ForMember(destination => destination.PharmacyId, x => x.MapFrom(src => src.Pharmacy.Id == "-1" ? null : src.Pharmacy.Id)) .ForMember(destination => destination.Pharmacy, x => x.Ignore()) .ForMember(destination => destination.FirstName, x => x.MapFrom(src => src.FirstName)) .ForMember(destination => destination.LastName, x => x.MapFrom(src => src.LastName)) .ForMember(destination => destination.UserName, x => x.MapFrom(src => src.UserName)) .ForMember(destination => destination.IsSuperUser, x => x.MapFrom(src => src.IsSuper)) .ForMember(destination => destination.Password, x => x.Ignore()) .ForMember(destination => destination.Id, x => x.MapFrom(src => src.Id)) .AfterMap((src, destination) => { if (!string.IsNullOrEmpty(src.NewPassword)) { destination.Password = PasswordProvider.Encrypt(src.NewPassword); } }); }
public void CreateEncryptedFile(string login, string password) { passwordManager = new PasswordProvider( new Passwords(login, password, Encoding.UTF8.GetString(CryptographyService.GenerateKey()), Encoding.UTF8.GetString(CryptographyService.GenerateKey()))); passwordManager.Encrypt(); passwordManager.Save(PswFileName); }
/// <summary> /// Initializes a new instance of the <see cref="OAuthService"/> class. /// </summary> public OAuthService() { var clientProvider = new ClientProvider(); var tokenProvider = new TokenProvider(); var passwordProvider = new PasswordProvider(); var scopes = new List<string>(); this.oAuthProvider = OAuthFactory.BuildOAuthProvider(clientProvider, tokenProvider, scopes, passwordProvider: passwordProvider); }
public void CreateUser(string username, string password) { var passwordProvider = new PasswordProvider(); string salt = passwordProvider.CreateSalt(); string hashedPassword = passwordProvider.CreateHashedPassword(username, salt); using (db = new RssReaderDbContext()) { db.RssReaderUsers.Add(new RssReaderUser(username, hashedPassword, salt)); db.SaveChanges(); } }
public void HashShouldSucceed() { // Arrange IPasswordProvider passwordProvider = new PasswordProvider(); var password = "******"; // Act var result = passwordProvider.Hash(password); // Assert result.Should().NotBeNull(); }
public CoreViewModel() { PswFileName = "Passwords"; OpenViews = new ObservableCollection <ViewBase>(); OpenNewWindow = new OpenWindowCommand(SetView); CreateAccount = new CreateAccountCommand(AccountWizard); Login = new LoginCommand(LoginToAccount); passwordManager = new PasswordProvider(); mediator = new ConcreteMediator(OpenNewWindow); mediator.Register(this); }
public void VerifyShouldReturnTrue() { // Arrange IPasswordProvider passwordProvider = new PasswordProvider(); var password = "******"; var passwordHashed = passwordProvider.Hash(password); // Act var result = passwordProvider.Verify(password, passwordHashed); // Assert result.Should().BeTrue(); }
public void CreatePasswordHash_WhenCalledWithoutSalt_ProperComputedPasswordExpected() { // ARRANGE var sut = new PasswordProvider(); var plainPassword = "******"; // ACT var computedPassword = sut.CreatePasswordHash(plainPassword); // ASSERT computedPassword.Should().NotBeNull(); computedPassword.Hash.Any().Should().BeTrue(); computedPassword.Salt.Any().Should().BeTrue(); }
public async Task Login() { var clientId = ConfigurationManager.AppSettings["ClientId"]; var clientSecret = ConfigurationManager.AppSettings["ClientSecret"]; var user = ConfigurationManager.AppSettings["User"]; var password = ConfigurationManager.AppSettings["Password"]; var authURL = ConfigurationManager.AppSettings["AuthURL"]; var pp = new PasswordProvider(clientId, clientSecret, retry => !retry ? new NetworkCredential(user, password) : null, authURL); var token = await pp.GetAccessTokenAsync(); Assert.IsNotNull(token); }
public void CreatePasswordHash_WhenCalledWithSalt_ProperComputedPasswordExpected() { // ARRANGE var sut = new PasswordProvider(); var salt = Encoding.UTF8.GetBytes("the salt"); var plainPassword = "******"; var hmac = new System.Security.Cryptography.HMACSHA512(salt); var expected = ComputedPassword.Create(hmac.ComputeHash(Encoding.UTF8.GetBytes(plainPassword)), hmac.Key); // ACT var actual = sut.CreatePasswordHash(plainPassword, salt); // ASSERT actual.Should().BeEquivalentTo(expected); }
public async Task <IActionResult> Login([FromForm] vm.Authenticate model) { if (model == null) { return(this.BadRequest()); } var user = this.Users .Query .WithPharmacy() .FirstOrDefault(x => x.UserName == model.UserName); if (user == null) { return(this.BadRequest("User not found")); } if (!PasswordProvider.Verify(model.Password, user.Password)) { return(this.BadRequest("Incorrect user name or password")); } var claims = this.GetClaims(user); var entity = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme); await this.HttpContext .SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(entity)); var referer = new Uri(this.Request.Headers["Referer"].ToString()); var request = HttpUtility.ParseQueryString(referer.Query) .Get("ReturnUrl"); if (user.PharmacyId.HasValue) { this.Data.Pharmacy.TryAdd(user.UserName, user.Pharmacy.Id); } return (!string.IsNullOrWhiteSpace(request) ? this.Redirect(request) : this.Redirect("/")); }
public void HandleAccountCreate(ICommandContext context, [Parameter("Email address for the new account", converter: typeof(StringLowerParameterConverter))] string email, [Parameter("Password for the new account")] string password) { if (DatabaseManager.Instance.AuthDatabase.AccountExists(email)) { context.SendMessage("Account with that username already exists. Please try another."); return; } (string salt, string verifier) = PasswordProvider.GenerateSaltAndVerifier(email, password); DatabaseManager.Instance.AuthDatabase.CreateAccount(email, salt, verifier); context.SendMessage($"Account {email} created successfully"); }
/// <summary> /// Authenticates the specified request. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> /// <param name="parameters">The parameters.</param> /// <param name="secure">if set to <c>true</c> [secure].</param> /// <param name="requiresTransportLayerSecurity">if set to <c>true</c> [requires transport layer security].</param> /// <param name="scope">The scope.</param> /// <returns></returns> public IIdentity Authenticate(IncomingWebRequestContext request, OutgoingWebResponseContext response, object[] parameters, bool secure, bool requiresTransportLayerSecurity, string scope, bool allowAnonymous) { var clientProvider = new ClientProvider(); var passwordProvider = new PasswordProvider(); var tokenProvider = new TokenProvider(); var scopes = new List<string>(); var oAuthProvider = OAuthFactory.BuildOAuthProvider(clientProvider, tokenProvider, scopes, passwordProvider: passwordProvider); var token = request.Headers["Authorization"]; if (string.IsNullOrWhiteSpace(token)) { token = HttpContext.Current.Request.QueryString["access_token"]; } else { if (!string.IsNullOrWhiteSpace(token) && token.StartsWith("OAuth") && token.Contains(" ")) { var splitToken = token.Split(' '); if (splitToken.Length > 1) { token = splitToken[1]; } } } var authentication = oAuthProvider.VerifyToken(token, scope); if (authentication.ErrorCode != ErrorCode.None) { if (allowAnonymous) { return null; } var errorCode = authentication.StatusCode(); var oauthError = authentication.Error(); if (errorCode == HttpStatusCode.Unauthorized) { response.Headers.Add(HttpResponseHeader.WwwAuthenticate, string.Format("OAuth realm='PollMe Service', error='{0}'", oauthError)); } throw new WebFaultException<string>(oauthError, authentication.StatusCode()); } return new GenericIdentity("Authorized User", "OAuth2"); }
public void SeedUsers() { var userData = System.IO.File.ReadAllText("SeedData/20181119_UserSeedData.json"); var users = Newtonsoft.Json.JsonConvert.DeserializeObject <List <User> >(userData); var passwordProvider = new PasswordProvider(); users.ForEach(user => { var computedPassword = passwordProvider.CreatePasswordHash("password"); user.PasswordHash = computedPassword.Hash; user.PasswordSalt = computedPassword.Salt; user.Username = user.Username.ToLower(); context.Users.Add(user); }); context.SaveChanges(); }
public void GetPasswordTest() { var provider = new PasswordProvider(); var parameters = new PasswordParameters { LowerEnglishAlphabetAmount = Amount.ExactAmount, UpperEnglishAlphabetAmount = Amount.ExactAmount, SpecialCharactersAmount = Amount.ExactAmount, NumbersAmount = Amount.ExactAmount, ExactNumbersCount = 3, ExactLowerAlphabetCount = 4, ExactUpperAlphabetCount = 2, ExactSpecialCharactersCount = 1, PasswordLength = 11 }; var passwords = new List <string>(); for (int i = 0; i < 50; i++) { passwords.Add(provider.GetPassword(parameters)); } }
public bool CheckCredentials(string username, string password) { Printer.WriteLine($"Validando credenciales\r\n Usuario: {username}\r\n Contraseña: {password}\r\n"); if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password)) { Printer.WriteLine($"Resultado: NO VALIDO - El nombre de usuario o la contraseña es NULL"); return(false); } var ide = Repository.Find(username); if (ide == null) { Printer.WriteLine($"Resultado: NO VALIDO - No se ha encontrado una identidad con ese nombre de usuario"); return(false); } var res = PasswordProvider.Verify(password, ide.PasswordHash, ide.PasswordSalt); if (res) { Printer.WriteLine($"Resultado: VALIDO"); } return(res); }
public SettingsViewModel(Passwords accountData) { ChangeMainPassword = new ChangeMainPasswordCommand(ChangePassword); passwordManager = new PasswordProvider(accountData); }
public AjaxResponse Purchase(QuoteHeader qHeader, PurchaseData pData) { //ITR#7841 Horison Audits - Web 2.0 Time-out AjaxResponse response = new AjaxResponse(); if (Convert.ToDateTime(DataBinder.QHeader.PolicyEffectiveDate) <= DateTime.Today) { response.quoteHeader = qHeader; response.quoteHeader.SystemDate = DateTime.Today.ToString(); response.quoteHeader.ExpiredQuote = true; response.quoteHeader.IsRetrieve = false; if (qHeader.FormCode == 3) { response.NextPanel = AjaxPanel.Your_Address; response.quoteHeader.LandingStep = "Your_Address"; response.RedirectURL = "BeginQuote.aspx"; } else if (qHeader.FormCode == 6) { response.NextPanel = AjaxPanel.Condo_Information; response.RedirectURL = "iQuote.aspx"; } else if (qHeader.FormCode == 4) { response.NextPanel = AjaxPanel.About_You; response.RedirectURL = "iQuote.aspx"; } } else { // ITR#7455 Adding Logging for DwellingUseCd and EstimatedReplCost. string logDwellingMessage; if (this.DataBinder.Structure.DwellingUseCd == null) { logDwellingMessage = "DwellingUseCd was Null prior to the refresh, "; } else { logDwellingMessage = "DwellingUseCd was " + this.DataBinder.Structure.DwellingUseCd.ToString() + " prior to the refresh, "; } string logReplacementCostMessage; if (this.DataBinder.Coverage.EstimatedReplCostAmt == null) { logReplacementCostMessage = "EstimatedReplCostAmt was Null prior to the refresh, "; } else { logReplacementCostMessage = "EstimatedReplCostAmt was " + this.DataBinder.Coverage.EstimatedReplCostAmt.ToString() + " prior to the refresh, "; } // Refresh the DataBinder so that if we are coming from a different server we have the latest from the database. this.DataBinder.RefreshDataObjects(); this.Log("Processing Purchase - Start... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); //this.quote = null; //Added For inspection this.BusinessLogic().Quote = null; this.Log("Processing Purchase - After refreshing the quote object... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); this.ErrorMessage = string.Empty; //AjaxResponse response = new AjaxResponse(); #region Legacy Business Logic Ported code this.PData = pData; this.PurchaseProcessor.SaveConsentToRate(out this.ErrorMessage); this.PurchaseProcessor.SavexWind(out this.ErrorMessage); // ITR#7684 this.PurchaseProcessor.SaveConsentToRateAndxWind(out this.ErrorMessage); // ITR#7684 if (string.IsNullOrEmpty(this.ErrorMessage)) { this.PurchaseProcessor.SavePhoneNumber(); this.PurchaseProcessor.SaveMailingAddress(); this.PurchaseProcessor.SaveMortgageInfo(); if (pData.routingNumber != null && !PurchaseProcessor.ValidateEFT(pData.routingNumber)) { this.ErrorMessage = "<strong>There is a problem with your answers below. We may have some missing or inaccurate information. Please check the following field(s):</strong><a href='#RoutingNumber'>Routing Number</a>"; this.Log("Processing Purchase - Payment = AutoCheck... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); } if (string.IsNullOrEmpty(ErrorMessage)) { this.PurchaseProcessor.SavePaymentDetails(); // ITR#7455 Added logging for the Early Cash issue if (this.DataBinder.Structure.DwellingUseCd == null) { logDwellingMessage += "and DwellingUseCd was Null after to the refresh."; } else { logDwellingMessage += "and DwellingUseCd was " + this.DataBinder.Structure.DwellingUseCd.ToString() + " after to the refresh."; } if (this.DataBinder.Coverage.EstimatedReplCostAmt == null) { logReplacementCostMessage += "and EstimatedReplCostAmt was Null after to the refresh,"; } else { logReplacementCostMessage += "and EstimatedReplCostAmt was " + this.DataBinder.Coverage.EstimatedReplCostAmt.ToString() + " after to the refresh"; } // Log the above results this.Log(logDwellingMessage); this.Log(logReplacementCostMessage); this.DataBinder.SaveDataObjects(); this.Log("Processing Purchase - Data Objects Saved... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); if (this.BusinessLogic().Quote.APLUSStatus == null) { this.BusinessLogic().Quote.APLUSStatus = 2; this.BusinessLogic().Quote.Save(); this.Log("Processing Purchase - Quote Saved... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); } } #endregion #region Legacy Progressive Business Logic Ported Code } if (string.IsNullOrEmpty(this.ErrorMessage)) { this.DataBinder.RefreshDataObjects(); if (!this.ServiceInterface.CallSaveQuoteService()) { response.errorOccured = true; response.errorMessage = "Error processing payment details. (save quote)"; response.NextPanel = AjaxPanel.Purchase; this.Log("Processing Purchase - CallSaveQuoteService() = False... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); return response; } if (quote.APLUSStatus != 1) { //bool convertEnabled = this.PurchaseProcessor.ConvertEnabled(); //if (convertEnabled) this.ServiceInterface.CallConvertService(); this.Log("PartnerId: " + this.BusinessLogic().QHeader.PartnerId + " CompanyPolicyNumber: " + quote.CompanysPolicyNumber + " OLSStatus: " + this.BusinessLogic().QHeader.OLSStatus); if (this.BusinessLogic().QHeader.PartnerId == 2319 && !string.IsNullOrEmpty(quote.CompanysPolicyNumber) && this.BusinessLogic().QHeader.OLSStatus == OlsStatusPasswordVerified) { EnrollmentServiceClient enrollmentService = null; try { this.Log("Enrollment Service Being called"); string email = DirectWebDAC.GetOLSEnrollmentValues(qHeader.QuoteNumber).Rows[0]["EmailAddress"]. ToString(); enrollmentService = new EnrollmentServiceClient(); EnrollForSelfServiceRequest request = new EnrollForSelfServiceRequest(); request.PolicyNumber = quote.CompanysPolicyNumber; request.Channel = EnrollmentChannel.ConsumerWeb; PasswordProvider provider = new PasswordProvider(); provider.LoginId = email; provider.Password = this.BusinessLogic().PData.password; request.Authentication = provider; request.RequestId = DirectWebDAC.GetOLSEnrollmentValues(qHeader.QuoteNumber).Rows[0]["Token"].ToString(); request.RequestType = OLSService.ValidationRequestType.Token; request.TransactionID = Guid.NewGuid(); var result = enrollmentService.EnrollForSelfService(request); if (result.Result) { this.Log("Enrollment into OLS was sucessful. Policy Number: " + this.BusinessLogic().Quote.CompanysPolicyNumber); this.BusinessLogic().QHeader.OLSStatus = OlsStatusReadyToEnroll; } else { this.Log("Enrollment into OLS was unsucessful. Error Message: " + result.ErrorMessage); } } catch (Exception e) { this.Log("Error with enrollmentservice: " + e.Message); } finally { if (enrollmentService != null) enrollmentService.Close(); this.Log("Enrollment Service ended OLSStatus: " + this.BusinessLogic().QHeader.OLSStatus); } } this.Log("Processing Purchase - After CallConvertService... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); } else { throw new Exception("Fix Me."); } } #endregion this.DataBinder.RefreshDataObjects(); this.Log("Processing Purchase - After RefreshDataObjects... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); // interpret results... if (this.ErrorMessage.Length == 0 && this.ServiceInterface.ErrorMessage.Length == 0 && this.PurchaseProcessor.ErrorMessage.Length == 0) { response.NextPanel = AjaxPanel.Thank_You; this.Log("Processing Purchase - Thank You... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); } else { response.NextPanel = AjaxPanel.Purchase; if (this.ErrorMessage.Length != 0) response.errorMessage = this.ErrorMessage; else if (this.ServiceInterface.ErrorMessage.Length != 0) response.errorMessage = this.ServiceInterface.ErrorMessage; else if (this.PurchaseProcessor.ErrorMessage.Length != 0) response.errorMessage = this.PurchaseProcessor.ErrorMessage; response.errorOccured = true; this.Log("Processing Purchase - Error... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); if (response.errorMessage.Trim().Length > 0) this.Log("Processing Purchase - Error Description : " + response.errorMessage.Trim()); } // check for policy servicing redirect after successful purchase if (response.NextPanel == AjaxPanel.Thank_You) { IQuoteConfiguration configuration = IQuoteConfiguration.GetConfigurationInstance(); // If user OLS Status == 5 then user is enrolled in OLS // this is for Walmart Associate if (qHeader.OLSStatus == OlsStatusReadyToEnroll && !(DirectWebDAC.IsBatchRunning())) { this.Log("Processing Purchase - OnlineServicingEnabled... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); if (this.PurchaseProcessor.WritePolicyServicingTransferData()) { this.Log( "Processing Purchase - WritePolicyServicingTransferData() = True... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); //Redirect to OLSEnrolled page instead of OnlineServicing thank you page StringBuilder redirUrl = this.PurchaseProcessor.BuildOLSEnrolledRedirectUrl(); response.RedirectURL = redirUrl.ToString(); } } else if (configuration.FunctionalityEnabled("OnlineServicingEnabled") && !(DirectWebDAC.IsBatchRunning())) { this.Log("Processing Purchase - OnlineServicingEnabled... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); if (this.PurchaseProcessor.WritePolicyServicingTransferData()) { this.Log( "Processing Purchase - WritePolicyServicingTransferData() = True... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); StringBuilder redirUrl = this.PurchaseProcessor.BuildOnlineServicingRedirectUrl(); response.RedirectURL = redirUrl.ToString(); } } } this.Log("Processing Purchase - End of Purchase... Inspection Result value = " + this.BusinessLogic().Quote.InspectionResult.ToString()); } return response; }
public void Init() { _provider = new PasswordProvider(); }
public GenerateCommand() { provider = new PasswordProvider(); }
public ActionResult Register(RegisterViewModel model) { if (!ModelState.IsValid) { return View(model); } var password = new PasswordProvider().CreatePassword(model.UserPassword); var user = new User() { UserName = model.UserName, PrimaryEmail = model.UserName, Name = model.Name, PasswordHash = password.PasswordHash, PasswordSalt = password.Salt }; var task = StoreProvider.CreateAsync(user); task.RunSynchronously(); task.Wait(); return RedirectToAction("Login"); }