Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions axes/handlers/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,19 @@ def reset_user_attempts(

count = 0
for attempts in attempts_list:
_count, _ = attempts.delete()
count += _count
try:
_count, _ = attempts.delete()
count += _count
except Exception:
# If the AccessAttemptExpiration table does not exist
# (migration not applied), cascade delete will fail.
# Log a warning and continue with remaining attempts.
log.warning(
"AXES: Failed to delete access attempt for %s. "
"This may happen if the AccessAttemptExpiration "
"migration has not been applied.",
attempts,
)
log.info("AXES: Reset %s access attempts from database.", count)

return count
Expand Down