Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

forces the user to enter his password before submitting the form asp.net core

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
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #forces #user #enter #password #submitting #form #core
ADD COMMENT
Topic
Name
3+3 =