Reputation: 4998
I have 2 projects. One of them is using ASP.Net authentication, the other uses Windows authentication, which is the administration side. I want the Admin project to be able to manage the users of the other. I can modify everything except the password.
If I use UserManager.PasswordHasher to create a new hash and update the AspNetUser, I cannot login with the new password (I can see the update has occurred). I tried to incorporate Asp.Net users in the admin project but it's messing with the Windows authentication.
Is this a salting issue? Is there a way to do a simple model update that will update the password hash correctly without re-implementing the entire Identity model?
Upvotes: 4
Views: 5556
Reputation: 28200
Something like should work:
user.PasswordHash = UserManager.PasswordHasher.HashPassword(newPassword);
UserManager.Update(User);
Upvotes: 6