public async Task <PasswordResponse> ChangePassword(string accessToken, string oldPassword, string newPassword) { try { var request = new ChangePasswordRequest { AccessToken = accessToken, PreviousPassword = oldPassword, ProposedPassword = newPassword }; var response = await _client.ChangePasswordAsync(request); return(new PasswordResponse { IsSuccess = response.HttpStatusCode == System.Net.HttpStatusCode.OK }); } catch (Exception ex) { return(new PasswordResponse { ErrorMessage = ex.Message }); } }
public async Task <ChangePasswordResponse> ChangePasswordAsync( IChangePasswordCredential changePasswordCredentialImp, CancellationToken cancellationToken = new CancellationToken()) { var request = new ChangePasswordRequest(); request.AccessToken = changePasswordCredentialImp.AccessToken; request.PreviousPassword = changePasswordCredentialImp.PreviousPassword; request.ProposedPassword = changePasswordCredentialImp.NewPassword; return(await _client.ChangePasswordAsync(request, cancellationToken)); }
/// <summary> /// Change current password /// </summary> /// <param name="changePassword"></param> /// <returns></returns> public async Task ChangePasswordAsync(ChangePasswordDto changePassword) { ChangePasswordRequest changePasswordRequest = new ChangePasswordRequest() { AccessToken = changePassword.AccessToken, PreviousPassword = changePassword.OldPassword, ProposedPassword = changePassword.NewPassword }; try { await _provider.ChangePasswordAsync(changePasswordRequest); } catch (NotAuthorizedException) { throw new CcsSsoException("INVALID_CREDENTIALS"); } catch (InvalidParameterException) { throw new CcsSsoException("INVALID_PARAMETERS"); } }