public async Task <IActionResult> ForgotPassword(ForgotPasswordViewModel forgotPasswordVM) { if (!ModelState.IsValid) { return(View()); } GolfioUser golfioUser = await _golfioUser.FindByEmailAsync(forgotPasswordVM.Email); if (golfioUser == null) { TempData["MessageTitle"] = "Invalid Email"; TempData["Message"] = "Please ensure the email is correct and you've already registered"; return(RedirectToAction("Login")); } if (!golfioUser.EmailConfirmed) { TempData["MessageTitle"] = "Email Not Confirmed"; TempData["Message"] = "You have not confirmed your email yet"; return(RedirectToAction("Login")); } string token = await _golfioUser.GeneratePasswordResetTokenAsync(golfioUser); var passwordResetLink = Url.Action("ResetPassword", "Account", new { email = forgotPasswordVM.Email, token = token }, Request.Scheme); _email.EmailToken(golfioUser, passwordResetLink, EmailType.PasswordReset); TempData["MessageTitle"] = "Email Sent"; TempData["Message"] = "Please check your email for password reset link"; return(RedirectToAction("Login")); }