public ActionResult ResetPassword(string token, string email, ResetPasswordViewModel model) { var customer = _customerService.GetCustomerByEmail(email); if (customer == null) return RedirectToRoute("HomePage"); //validate token if (!customer.IsPasswordRecoveryTokenValid(token)) { model.DisablePasswordChanging = true; model.Result = "Wrong Token."; } if (ModelState.IsValid) { customer.Password = model.ConfirmPassword; customer.PasswordRecoveryToken = ""; _customerService.UpdateCustomer(customer); model.DisablePasswordChanging = true; model.Result = "Password Has Been Changed."; return RedirectToAction("ResetPasswordConfirmation", "Account"); //return View(model); } //If we got this far, something failed, redisplay form return View(model); }
public ActionResult ResetPassword(string token, string email) { var customer = _customerService.GetCustomerByEmail(email); if (customer == null) return RedirectToRoute("HomePage"); var model = new ResetPasswordViewModel(); //validate token if (!customer.IsPasswordRecoveryTokenValid(token)) { model.Result = "Wrong Token."; } return View(model); }