Debian Codegraph @

axes/management/commands/axes_reset_username.py

raw
1 from django.core.management.base import BaseCommand
2
3 from axes.utils import reset
4
5
6 class Command(BaseCommand):
7 help = "Reset all access attempts and lockouts for given usernames"
8
9 def add_arguments(self, parser):
10 parser.add_argument("username", nargs="+", type=str)
11
12 def handle(self, *args, **options):
13 count = 0
14
15 for username in options["username"]:
16 count += reset(username=username)
17
18 if count:
19 self.stdout.write(f"{count} attempts removed.")
20 else:
21 self.stdout.write("No attempts found.")