I was given the requirement to provide users with the ability to create users through an interface without a password. I am trying to accomplish this using ASP.NET Identity.
I can successfully create a user without a password using the UserManager Create method:
if (vm.ShouldHavePassword)
{
userManager.Create(userToInsert, vm.Password);
}
else
{
userManager.Create(userToInsert);
}
After calling the Create method, the test user is successfully saved in our AspNetUsers table. And when I do not provide a password, the PasswordHash column in our AspNetUsers table is set to NULL.
My problem: I cannot log in as a test user who does not have a password. The following is a call to the method that we use to verify user credentials:
result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: false);
, NULL PasswordHash . . NULL PasswordSignInAsync. SignInStatus.Failure.
ASP.NET, , NULL, NULL PasswordHash? ?