public async Task <IActionResult> ResetPassword(ResetPasswordViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var user = await _userManager.FindByEmailAsync(model.Email); if (user == null) { // Don't reveal that the user does not exist return(RedirectToAction(nameof(ResetPasswordConfirmation))); } var result = await _userManager.ResetPasswordAsync(user, model.Code, model.Password); if (result.Succeeded) { return(RedirectToAction(nameof(ResetPasswordConfirmation))); } AddErrors(result); return(View()); }