mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-14 02:23:11 +00:00
Merge pull request #196 from vladimirnani/patch-1
Reset lockouts for user
This commit is contained in:
commit
f8d1031fdb
1 changed files with 19 additions and 0 deletions
19
axes/management/commands/axes_reset_user.py
Normal file
19
axes/management/commands/axes_reset_user.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from axes.utils import reset
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = ("Resets any lockouts or failed login records. If called with an "
|
||||
"User name, resets only for that User name")
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('username')
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
count = 0
|
||||
count += reset(username=kwargs['username'])
|
||||
if count:
|
||||
print('{0} attempts removed.'.format(count))
|
||||
else:
|
||||
print('No attempts found.')
|
||||
Loading…
Reference in a new issue