Beispiel #1
0
        public async Task <ActionResult> ChangePassword([FromForm] PostChangePasswordRequest request,
                                                        CancellationToken ct)
        {
            if (request.NewPassword != request.NewPasswordConfirmation)
            {
                var getChangePasswordRequest = new GetChangePasswordRequest
                {
                    Login = request.Login,
                    IsPasswordsNotEqual = true
                };

                return(RedirectToAction("ChangePassword", getChangePasswordRequest));
            }

            var response = await _passwordChangeService.ChangeAsync(
                request.Country,
                request.Login,
                request.OldPassword,
                request.NewPassword,
                ct);

            if (response.IsInvalidCredentials)
            {
                var getChangePasswordRequest = new GetChangePasswordRequest
                {
                    Login = request.Login,
                    IsInvalidCredentials = true
                };

                return(RedirectToAction("ChangePassword", getChangePasswordRequest));
            }

            return(View("~/OAuth/Views/PasswordChanged.cshtml"));
        }
Beispiel #2
0
        public ActionResult ChangePassword(GetChangePasswordRequest request)
        {
            var model = new ChangePasswordViewModel(
                request.Login,
                request.IsPasswordsNotEqual,
                request.IsInvalidCredentials);

            return(View("~/OAuth/Views/ChangePassword.cshtml", model));
        }