public virtual ActionResult ForgotPassword(ForgotPasswordViewModel model)
{
if (ModelState.IsValid)
{
var user = userService.GeneratePasswordResetToken(model.Email, Constants.DefaultPasswordResetTokenExpirationHours * 60);
if (user != null)
{
var resetPasswordUrl = Url.ConfirmationUrl(MVC.Users.ResetPassword(), user.Username, user.PasswordResetToken, protocol: Request.Url.Scheme);
messageService.SendPasswordResetInstructions(user, resetPasswordUrl);
TempData["Email"] = user.EmailAddress;
return RedirectToAction(MVC.Users.PasswordSent());
}
ModelState.AddModelError("Email", "Could not find anyone with that email.");
}
return View("~/Views/Users/ForgotPassword.cshtml", model);
}