I searched several places for how to change a user's password elegantly.
The one I came closest to using was the one in this post: ASP.NET Identity reset password
My algorithm:
ApplicationUser user = await _userManager.FindByIdAsync(model.Id);
user.UserName = model.Name;
user.Email = model.Email;
if(model.ChangePassword != null)
{
var newPasswordHash = _userManager.PasswordHasher.HashPassword(user, model.ChangePassword);
user.PasswordHash = newPasswordHash;
}
identityResult = await _userManager.UpdateAsync(user);
But this way the administrator, when filling this field, will not have the validity of IdentityOptions
.