public async Task <IActionResult> RedefinePassword([FromBody] RedefinePasswordRequest redefinePassword)
        {
            try
            {
                _log.LogInformation("Redefinir senha do usuário: {@redefinePassword}", redefinePassword);

                var response = await _mediator.Send(redefinePassword);

                if (!response.IsValid())
                {
                    return(BadRequest(response.Errors));
                }

                return(Ok(response));
            }
            catch (Exception ex)
            {
                _log.LogError(ex, "Erro ao redefinir senha do usuário: {@redefinePassword}", redefinePassword);
                return(BadRequest(ex.Message));
            }
        }
        public async Task <Response> Handle(RedefinePasswordRequest request, CancellationToken cancellationToken)
        {
            var response = new Response();

            var user = await _userRepository.GetUserById(request.Id.Value);

            if (!user.ValidatePassword(request.OldPassword))
            {
                return(new Response("Falha na alteração da senha!"));
            }

            user.CreateHashPassword(request.NewPassword);

            var updateResult = await _userRepository.SetNewPassword(request.Id.Value, request.NewPassword);

            if (!updateResult)
            {
                response = new Response("Falha ao atualizar informações!");
            }

            return(response);
        }