Skip to content

Commit 21e93a8

Browse files
committed
Upgrade django-axes to latest version
Signed-off-by: tdruez <[email protected]>
1 parent deea114 commit 21e93a8

11 files changed

+8
-57
lines changed

dejacode/settings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,8 @@ def get_fake_redis_connection(config, use_strict_redis):
658658
AXES_FAILURE_LIMIT = env.int("AXES_FAILURE_LIMIT", default=5)
659659
# If set, specifies a template to render when a user is locked out.
660660
AXES_LOCKOUT_TEMPLATE = env.str("AXES_LOCKOUT_TEMPLATE", default="axes_lockout.html")
661-
# If True, only lock based on username, and never lock based on IP
662-
# if attempts to exceed the limit.
663-
AXES_ONLY_USER_FAILURES = True
661+
# Lock based on username
662+
AXES_LOCKOUT_PARAMETERS = ["username"]
664663
# If True, a successful login will reset the number of failed logins.
665664
AXES_RESET_ON_SUCCESS = True
666665
# If True, disable writing login and logout access logs to database,

dje/tests/test_access.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ def test_user_locked_out_on_unsuccessful_login_attempts(self):
419419
self.assertEqual(1, attempt.failures_since_start)
420420

421421
response = self.client.post(login_url, data=credentials)
422-
self.assertContains(response, "Account locked", status_code=403)
422+
self.assertContains(response, "Account locked", status_code=429)
423423
attempt = AccessAttempt.objects.get(username=credentials["username"])
424424
self.assertEqual(2, attempt.failures_since_start)
425425

@@ -434,7 +434,7 @@ def test_user_locked_out_on_unsuccessful_login_attempts(self):
434434
self.assertEqual(1, attempt.failures_since_start)
435435

436436
response = self.client.post(login_url, data=credentials)
437-
self.assertContains(response, "Account locked", status_code=403)
437+
self.assertContains(response, "Account locked", status_code=429)
438438
attempt = AccessAttempt.objects.get(username=credentials["username"])
439439
self.assertEqual(2, attempt.failures_since_start)
440440

@@ -457,7 +457,7 @@ def test_notification_on_unsuccessful_login_attempts(self, method_mock):
457457
}
458458
self.client.post(login_url, data=credentials)
459459
response = self.client.post(login_url, data=credentials)
460-
self.assertEqual(403, response.status_code)
460+
self.assertEqual(429, response.status_code)
461461

462462
subject = "[DejaCode] Login attempt on locked account requires review!"
463463
self.assertEqual(1, len(mail.outbox))
@@ -487,7 +487,7 @@ def test_notification_on_unsuccessful_login_attempts(self, method_mock):
487487
response = self.client.post(login_url, data=credentials)
488488
self.assertEqual(200, response.status_code)
489489
response = self.client.post(login_url, data=credentials)
490-
self.assertEqual(403, response.status_code)
490+
self.assertEqual(429, response.status_code)
491491
self.assertIn(
492492
'"real_user" is an existing DejaCode user in Dataspace "nexB"', mail.outbox[2].body
493493
)

setup.cfg

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,8 @@ install_requires =
7777
itypes==1.2.0
7878
Jinja2==3.1.6
7979
uritemplate==4.1.1
80-
# Access log
81-
django-axes==5.35.0
82-
django-appconf==1.1.0
83-
django-ipware==7.0.1
80+
# Track failed login attempts
81+
django-axes==8.0.0
8482
# Multi-factor authentication
8583
django-otp==1.6.0
8684
qrcode==8.2
-6.24 KB
Binary file not shown.

thirdparty/dist/django_appconf-1.1.0-py3-none-any.whl.ABOUT

Lines changed: 0 additions & 14 deletions
This file was deleted.
-58.1 KB
Binary file not shown.

thirdparty/dist/django_axes-5.35.0-py3-none-any.whl.ABOUT

Lines changed: 0 additions & 17 deletions
This file was deleted.

thirdparty/dist/django_axes-5.35.0-py3-none-any.whl.NOTICE

Lines changed: 0 additions & 1 deletion
This file was deleted.
67.3 KB
Binary file not shown.
-6.27 KB
Binary file not shown.

0 commit comments

Comments
 (0)