changePassword method

Future<bool> changePassword(
  1. String oldUserPassword,
  2. String newUserPassword
)

This is used by an authenticated user to change the current password

Implementation

Future<bool> changePassword(
    String oldUserPassword, String newUserPassword) async {
  if (!(_signInUserSession != null && _signInUserSession!.isValid())) {
    throw Exception('User is not authenticated');
  }

  final paramsReq = {
    'PreviousPassword': oldUserPassword,
    'ProposedPassword': newUserPassword,
    'AccessToken': _signInUserSession!.getAccessToken().getJwtToken(),
  };
  if (_clientSecretHash != null) {
    paramsReq['SecretHash'] = _clientSecretHash;
  }
  await client!.request('ChangePassword', paramsReq);

  return true;
}