deletePasswordResetRequestAttempts method

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

Deletes password reset request attempts according to olderThan.

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 password reset requests, as configured in EmailIdpConfig.maxPasswordResetAttempts.timeframe.

Other durations remove only attempts strictly older than olderThan.

If email is provided, only attempts for the given email will be deleted.

Implementation

Future<void> deletePasswordResetRequestAttempts(
  Session session, {
  required Duration? olderThan,
  required String? email,
  required Transaction transaction,
}) async {
  await _rateLimitUtil.deleteAttempts(
    session,
    olderThan: olderThan == Duration.zero
        ? null
        : olderThan ?? _rateLimitUtil.config.timeframe,
    key: email,
    transaction: transaction,
  );
}