public ActionResult ForgotPassword(ForgotPasswordViewModel model) { if (IsModelValidAndPersistErrors()) { User user = _userServices.GetUser(model.UsernameOrEmail); if (user != null) { string token = _userServices.RequestPasswordReset(user.UserID); string resetUrl = Url.Action("ResetPassword", "Auth", new { token = token }); _emailServices.PasswordResetRequest(user, resetUrl); SetSuccess("A password reset request link has been sent to the associated email address. Please check your email to reset your password"); return(RedirectToAction("Login")); } else { SetError("Email/Username was not found"); } } return(RedirectToSelf()); }