resetPassword method

Future<void> resetPassword({
  1. required String loginName,
  2. required String newPassword,
  3. UserCredentials? userCredentials,
  4. EventStoreClientOperationOptions? operationOptions,
})

Resets password for user in EventStore with given loginName.

Implementation

Future<void> resetPassword({
  required String loginName,
  required String newPassword,
  UserCredentials? userCredentials,
  EventStoreClientOperationOptions? operationOptions,
}) {
  if (loginName.isEmpty) {
    throw ArgumentOutOfRangeException("'loginName' is empty");
  }
  if (newPassword.isEmpty) {
    throw ArgumentOutOfRangeException("'newPassword' is empty");
  }
  return $runRequest<void>(() async {
    final request = $a.ResetPasswordReq()
      ..options = (ResetPasswordReq_Options()
        ..loginName = loginName
        ..newPassword = newPassword);

    final client = await $getClient();
    await client.resetPassword(
      request,
      options: $getOptions(
        userCredentials: userCredentials,
        operationOptions: operationOptions,
      ),
    );
  });
}