Exemplo n.º 1
0
        public async Task <IActionResult> ForgotPassword(ForgotPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    model._context         = _context;
                    model._securityOptions = _securityOptions;
                    model._user            = User;
                    model._emailService    = _emailService;

                    if (await model.SendForgotPasswordLink())
                    {
                        return(RedirectToAction("ForgotPasswordConfirmation"));
                    }
                    else
                    {
                        ViewBag.Error = "Unable to send password reset link. Please verify Email address correct. Note: Usernames without an email must be reset by an Administrator.";
                    }
                }
                catch (Exception ex)
                {
                    HelperFunctions.Log(_context, PublicEnums.LogLevel.LEVEL_EXCEPTION, "Controllers.AccountController.ForgotPassword", ex.Message, User, ex);
                }
            }

            return(View(model));
        }