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

C#
0

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
}
Posted by: Guest on January-24-2021

Code answers related to "forces the user to enter his password before submitting the form asp.net core"

C# Answers by Framework

Browse Popular Code Answers by Language