コード例 #1
0
        public ResetPasswordTest(CustomWebApplicationFactory factory,
                                 ITestOutputHelper output) : base(factory)
        {
            _output = output;
            _faker  = new Faker("pt_BR");

            _authorResetPasswordRequest = new AuthorResetPasswordRequest
            {
                Email       = "*****@*****.**",
                NewPassword = _faker.Internet
                              .Password(memorable: true, prefix: "Y#10")
            };
        }
コード例 #2
0
        public async Task <IActionResult> ResetPassword([FromBody] AuthorResetPasswordRequest request)
        {
            var resetResponse = await _authService
                                .ResetPasswordAsync(request.Email, request.NewPassword)
                                .ConfigureAwait(false);

            if (!resetResponse.Success)
            {
                return(BadRequest(new AuthFailedResponse
                {
                    Errors = resetResponse.Errors
                }));
            }

            return(Ok(new ResetPasswordSuccessResponse
            {
                Reseted = true,
                SuccessMessage = "Senha redefinida com sucesso"
            }));
        }