public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model) { if (ModelState.IsValid) { var user = await UserManager.FindByNameAsync(model.Email); if (user == null || !(user.Status == UserStatusType.CONFIRMED)) { // Don't reveal that the user does not exist or is not confirmed return(View("ForgotPasswordConfirmation")); } var emailSent = await UserManager.SendForgotPasswordEmailAsync(model.Email); if (!emailSent) { AddError("Email send failed."); return(View(model)); } return(RedirectToAction("ForgotPasswordConfirmation", "Account")); } // If we got this far, something failed, redisplay form return(View(model)); }