diff --git a/axes/management/commands/axes_reset_user.py b/axes/management/commands/axes_reset_user.py new file mode 100644 index 0000000..2612a13 --- /dev/null +++ b/axes/management/commands/axes_reset_user.py @@ -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.')