Пример #1
0
        public async Task <IActionResult> ConfirmResetPassword([FromQuery] ResetPasswordCallbackViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(this.ErrorPage());
            }

            return(await resetPasswordManager.ResetPassword(viewModel.Email, viewModel.NewPassword, viewModel.Token)
                ? (IActionResult)RedirectToAction("Login").PushAlert("Password has been changed") : this.ErrorPage());
        }
Пример #2
0
        public async Task <ResetPasswordResponse> Handle(ResetPasswordRequest request,
                                                         CancellationToken cancellationToken)
        {
            var(token, email) = (cryptoService.Decrypt(request.Token), cryptoService.Decrypt(request.Email));

            return(await resetPasswordManager.ResetPassword(email, token, request.NewPassword)
                ? (ResetPasswordResponse) new ResetPasswordResponse().LogInformation(
                       $"User with email {email} has resetted their password")
                : throw new ResetPasswordException("Error occured during resetting password"));
        }
Пример #3
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            if (!await resetPasswordManager.ResetPassword(UserId, Code, Input.NewPassword))
            {
                Alertify.Push("Reset password failed", AlertType.Error);
                return(Page());
            }

            PasswordChanged = true;

            return(Page());
        }