-
-
Notifications
You must be signed in to change notification settings - Fork 352
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1138 from p-l-/command-reset-ip-username
Add new management command `axes_reset_ip_username`
- Loading branch information
Showing
3 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from django.core.management.base import BaseCommand | ||
|
||
from axes.utils import reset | ||
|
||
|
||
class Command(BaseCommand): | ||
help = "Reset all access attempts and lockouts for a given IP address and username" | ||
|
||
def add_arguments(self, parser): | ||
parser.add_argument("ip", type=str) | ||
parser.add_argument("username", type=str) | ||
|
||
def handle(self, *args, **options): | ||
count = reset(ip=options["ip"], username=options["username"]) | ||
|
||
if count: | ||
self.stdout.write(f"{count} attempts removed.") | ||
else: | ||
self.stdout.write("No attempts found.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters