Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [HttpPost]
- public ActionResult MyAction(MyViewModel model, string password)
- var user = await UserManager.FindByIdAsync(User.Identity.GetUserId());
- var verifyPassword = UserManager.PasswordHasher.VerifyHashedPassword(user.PasswordHash, password);
- if (verifyPassword == PasswordVerificationResult.Failed)
- {
- ModelState.AddModelError("", "Password incorrect.");
- // If password is incorrect, ModelState will be invalid now
- }
- if (ModelState.IsValid)
- {
- // save posted data
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement