public async Task <ActionResult> ChangePassword([FromBody] ChangePasswordInput input) { if (input.NewPassword != input.PasswordRepeat) { return(BadRequest("Passwords are not matched!")); // TODO: Make these messages static object } var user = await _authenticationAppService.FindUserByUserNameAsync(User.Identity.Name); var result = await _authenticationAppService.ChangePasswordAsync(user, input.CurrentPassword, input.NewPassword); if (!result.Succeeded) { return(BadRequest(string.Join(Environment.NewLine, result.Errors.Select(e => e.Description)))); } return(Ok()); }
public async Task <IActionResult> ChangePassword([FromBody] ChangePasswordDto dto) { await _authAppService.ChangePasswordAsync(dto.Id, dto.OldPassword, dto.NewPassword); return(NoContent()); }