public async Task<ActionResult> ConfirmPasswordReset(ConfirmPasswordResetViewModel viewModel) { if (!ModelState.IsValid) { return View(viewModel); } IdentityResult result = await _userMenagerService.ResetUserPassword(viewModel.Id, viewModel.Token, viewModel.NewPassword); if (!result.Succeeded) { result.Errors.ToList().ForEach(x => ModelState.AddModelError("", x.ToString())); return View("ConfirmPasswordReset"); } TempData["message"] = "Password has been changed"; return RedirectToAction("GetRoles"); }
public async Task<ActionResult> ConfirmPasswordReset(string userId) { if (userId == null) { return new HttpStatusCodeResult(HttpStatusCode.BadRequest); } var token = await _userMenagerService.GeneratePasswordResetToken(userId); ConfirmPasswordResetViewModel viewModel = new ConfirmPasswordResetViewModel() { Id = userId, Token = token }; return View(viewModel); }