Example #1
0
        public async Task <IActionResult> ForgotPassword(UserAc userAc)
        {
            if (string.IsNullOrEmpty(userAc.Email))
            {
                ModelState.AddModelError("Email", "Email can not be null or empty");
            }
            else
            {
                ApplicationUser user = await _userManager.FindByEmailAsync(userAc.Email);

                if (user == null)
                {
                    ModelState.AddModelError("Email", "User does not exist");
                }
                else
                {
                    await _userManagementRepository.SendForgotPasswordEmailAsync(user);

                    userAc.IsForgotPasswordMailSent = true;
                }
            }

            return(View(userAc));
        }