Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Verify newly entered password of logged in user

User is logged in and wants to do something major and I want them to re-enter their password so I can make sure that they are the user that is logged in.

How can I confirm that this password is for the account holder?

Would be happy to know how to do it via ASP.NET Identity or how to set up a stored proc to go against the AspNetUsers table or how to do it via Entity Framework.

like image 966
Reid Avatar asked Dec 14 '13 03:12

Reid


1 Answers

How can I confirm that this password is for the account holder?

how to do it via ASP.NET Identity

To reverify the password of currently logged in user, provide the user VerifyView to enter password and use the following method to check if the user exists.

var user = await UserManager.FindAsync(User.Identity.Name,VerifyViewModel.Password)

If the user is found, the current request is the same from the account holder.


Membership.ValidateUser is from earlier version of Membership framework, not from ASP.NET Identity.

like image 161
jd4u Avatar answered Nov 02 '22 21:11

jd4u