deleteRegistrationAttempts method

Future<void> deleteRegistrationAttempts(
  1. Session session, {
  2. Duration? olderThan,
  3. String? email,
  4. Transaction? transaction,
})

Deletes the log of registration attempts.

If olderThan is Duration.zero, this removes all matching attempts, including those timestamped at or after the current time.

If olderThan is null, this will remove all attempts outside the time window that is checked upon registration requests, as configured in EmailIdpConfig.maxRegistrationAttempts.timeframe.

Other durations remove only attempts strictly older than olderThan.

If email is provided, only attempts for the given email will be deleted. Passing it with olderThan set to Duration.zero allows a user to start a new registration even though they hit the rate limit.

Implementation

Future<void> deleteRegistrationAttempts(
  Session session, {
  Duration? olderThan,
  String? email,
  Transaction? transaction,
}) async {
  return DatabaseUtil.runInTransactionOrSavepoint(
    session.db,
    transaction,
    (transaction) => _utils.accountCreation.deleteRegistrationAttempts(
      session,
      olderThan: olderThan,
      email: email,
      transaction: transaction,
    ),
  );
}