コード例 #1
0
        public async Task <ActionResult> ResetPasswordConfirmation(
            [FromForm] PostResetPasswordConfirmationRequest request,
            CancellationToken ct)
        {
            if (request.NewPassword != request.NewPasswordConfirmation)
            {
                var resetPasswordConfirmationRequest = new ResetPasswordConfirmationRequest
                {
                    TokenId             = request.TokenId,
                    Code                = request.Code,
                    IsPasswordsNotEqual = true
                };

                return(RedirectToAction("ResetPasswordConfirmation", resetPasswordConfirmationRequest));
            }

            var response = await _passwordResetService.SetNewPasswordAsync(
                request.TokenId,
                request.Code,
                request.NewPassword,
                ct);

            if (response.IsInvalidToken)
            {
                return(BadRequest("Invalid code"));
            }

            return(View("~/OAuth/Views/NewPasswordSet.cshtml"));
        }