deleteOtpLoginAttempts method

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

Deletes the log of one-time password requests.

If olderThan is null, this will remove all attempts outside the time window checked by startOtpLogin, as configured in EmailIdpConfig.maxOtpLoginAttempts.

If email is provided, only attempts for the given email will be deleted. This is useful to allow a user to request a new one-time password even though they hit the rate limit.

Implementation

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