django-axes/axes/utils.py
Mike Blume aa411ddcd6 add reset command.
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
2010-09-27 17:43:23 +00:00

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()