public ActionResult ResetPassword(Guid id) { var model = new ResetPassword(); if (!Service.CheckPasswordResetRequest(id)) { ModelState.AddModelError("", "Request ID is invalid. It might have been used already."); } else { model.RequestId = id; } return View(model); }
public ActionResult ResetPassword(ResetPassword model) { if (!Service.CheckPasswordResetRequest(model.RequestId)) { ModelState.AddModelError("", "Request ID is invalid. It might have been used already."); } if (!ModelState.IsValid) { return View(new ResetPassword()); } var user = Service.ResetPassword(model.RequestId, model.NewPass); FormsAuthentication.SetAuthCookie(user.Name, false); TempData.SetStatusMessage("Password reset successfully!"); return RedirectToAction("Index", "Home"); }
public ActionResult ResetPassword(Guid? id) { var idVal = id ?? Guid.Empty; var model = new ResetPassword(); if (!Data.CheckPasswordResetRequest(idVal)) { ModelState.AddModelError("", "Request ID is invalid. It might have been used already."); } else { model.RequestId = idVal; } return View(model); }