Exemple #1
0
        public IActionResult ForgetPassword(ForgetPasswordModel forgetPasswordModel)
        {
            AppUser user = _userManager.FindByEmailAsync(forgetPasswordModel.Email).Result;

            if (user == null)
            {
                ModelState.AddModelError(string.Empty, "Kullanıcı Bulunamadı.");
                return(RedirectToAction("ForgetPassword"));
            }

            string passwordResetToken = _userManager.GeneratePasswordResetTokenAsync(user).Result;
            string passwordResetLink  = Url.Action("ResetPassword", "Home", new
            {
                userID = user.Id,
                token  = passwordResetToken,
            }, HttpContext.Request.Scheme);

            PasswordReset.SendPasswordResetMail(passwordResetLink, user.Email);
            ViewBag.status = "Succesfull";


            return(RedirectToAction("SentResetPasswordMail"));
        }