public async Task<ActionResult> ForgotPassword(ForgotPasswordViewModel model) { if (ModelState.IsValid) { var user = await userManager.FindByNameAsync(model.Email); if (user == null) // || !(await userManager.IsEmailConfirmedAsync(AppMember.Id))) { return View("ForgotPasswordConfirmation"); } string code = await userManager.GeneratePasswordResetTokenAsync(user.Id); var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); var mailer = new UserMailer(); mailer.PasswordReset(user, callbackUrl).Send(); //await userManager.SendEmailAsync(AppMember.Id, "Reset Password", "Please reset your password by clicking <a href=\"" + callbackUrl + "\">here</a>"); return RedirectToAction("ForgotPasswordConfirmation"); } // If we got this far, something failed, redisplay form return View(model); }