I am a little confused trying to implement IPasswordStore in the new asp.net mvc 5. I want to use my own ORM.
Take this familiar piece of code from the secure AccountController, which runs when the register screen is used in the sample project.
public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new ApplicationUser() { UserName = model.UserName }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInAsync(user, isPersistent: false); return RedirectToAction("Index", "Home"); } else { AddErrors(result); } }
var result = await UserManager.CreateAysnc(user, model.Password)
the string first calls the IPasswordStore function
public Task SetPasswordHashAsync(TUser user, string passwordHash)
without first call from IUserStore
public Task CreateAsync(TUser user)
How to set password hash if user is not already created in db? In addition, we donβt even know if we can create the proposed βuserβ because we did not check if the username was executed using
public Task<TUser> FindByNameAsync(string userNameIn)
which is called right after.
Any ideas?
asp.net-mvc-5
Isaac bolinger
source share