public ActionResult ResetPassword(ResetPasswordViewModel model) { try { User user = service.GetUserByID(Guid.Parse(model.UserID)); user.Password = PasswordHelpers.EncryptPassword(model.NewPassword); user.ForgotPasswordHash = null; service.Save(user); //this.StoreSuccess("Your password has been updated, you can now login!"); return RedirectToAction("login"); } catch (Exception ex) { //this.StoreError("There was a problem updating your password"); return View(); } }
public ActionResult ResetPassword() { Guid passwordResetHash = Guid.Parse(Request.QueryString["hash"].ToString()); User user = service.GetUserByResetHash(passwordResetHash); if (user == null) { //this.StoreWarning("Something isn't right, the user didn't request this action?"); return View(); } ResetPasswordViewModel model = new ResetPasswordViewModel(); model.UserID = user.ID.ToString(); return View(model); }