deletePasswordResetAttempts method
Future<void>
deletePasswordResetAttempts(
- Session session, {
- Duration? olderThan,
- Transaction? transaction,
Cleans up the log of failed password reset attempts older than
olderThan
.
If olderThan
is null
, this will remove all attempts outside the time
window that is checked upon password reset requets, as configured in
EmailAccountConfig.maxPasswordResetAttempts.
Implementation
Future<void> deletePasswordResetAttempts(
final Session session, {
Duration? olderThan,
final Transaction? transaction,
}) async {
olderThan ??= EmailAccounts.config.maxPasswordResetAttempts.timeframe;
final removeBefore = clock.now().subtract(olderThan);
await EmailAccountPasswordResetAttempt.db.deleteWhere(
session,
where: (final t) => t.attemptedAt < removeBefore,
transaction: transaction,
);
}