mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-28 08:48:19 +00:00
from axes.utils import reset reset() will reset all lockouts and access records. reset(ip) will clear lockout/records for ip reset will print a message to std out if there is nothing to reset, unless called with silent = True
19 lines
552 B
Python
19 lines
552 B
Python
from axes.models import AccessAttempt
|
|
|
|
def reset(ip=None, silent=False):
|
|
if not ip:
|
|
attempts = AccessAttempt.objects.all()
|
|
if attempts:
|
|
for attempt in AccessAttempt.objects.all():
|
|
attempt.delete()
|
|
else:
|
|
if not silent:
|
|
print 'No attempts found.'
|
|
else:
|
|
try:
|
|
attempt = AccessAttempt.objects.get(ip_address=ip)
|
|
except:
|
|
if not silent:
|
|
print 'No matching attempt found.'
|
|
else:
|
|
attempt.delete()
|