コード例 #1
0
        public async Task <ActionResult> ForgotPasswordAsync(ForgotPasswordViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("ForgotPassword", model));
            }

            try
            {
                var authResponse = await _oktaAuthenticationClient.ForgotPasswordAsync(new ForgotPasswordOptions
                {
                    FactorType = FactorType.Email,
                    UserName   = model.UserName,
                }).ConfigureAwait(false);

                return(RedirectToAction("VerifyRecoveryToken", "Manage"));
            }
            catch (Exception exception)
            {
                ModelState.AddModelError(string.Empty, exception.Message);
                return(View("ForgotPassword", model));
            }
        }