Esempio n. 1
0
        public async Task <Response> ChangePassword(UserSetPasswordDTO dto, ClaimsPrincipal claims)
        {
            var userResponse = await _provider.GetUserDetail(claims.GetUserId());

            if (!userResponse.IsSuccess)
            {
                return(userResponse);
            }

            var oldPasswordCorrectResponse = await _tokensService.Authenticate(new CredentialsDTO
            {
                Email    = userResponse.Data.Email,
                Password = dto.OldPassword
            });

            if (!oldPasswordCorrectResponse.IsSuccess)
            {
                return(oldPasswordCorrectResponse);
            }

            return(await _service.SetPassword(userResponse.Data.Email, dto.Password));
        }
Esempio n. 2
0
 public async Task <Response> ChangePassword([FromBody] UserSetPasswordDTO dto)
 {
     return(await _handler.ChangePassword(dto, User));
 }