How can I get the password of a user in the new ASP.NET Identity system? Or how can I reset without knowing the current one (user forgot password)?
This was the original answer. It does work, but has a problem. What if AddPassword
fails? The user is left without a password.
The original answer: we can use three lines of code:
UserManager userManager =
new UserManager(new UserStore());
userManager.RemovePassword(userId);
userManager.AddPassword(userId, newPassword);
See also: http://msdn.microsoft.com/en-us/library/dn457095(v=vs.111).aspx
It's probably better to use the answer that EdwardBrey proposed and then DanielWright later elaborated with a code sample.