mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
Add missing get_failures handler proxy implementation
This missing implementation prevented custom implementations for the failure fetching logic in the handler classes because Axes would not invoke them from them, and would use the base handler class implementation instead.
This commit is contained in:
parent
245ba0310d
commit
e4929d2c11
2 changed files with 20 additions and 0 deletions
|
|
@ -82,6 +82,11 @@ class AxesProxyHandler(AxesHandler):
|
|||
cls.update_request(request)
|
||||
return cls.get_implementation().is_allowed(request, credentials)
|
||||
|
||||
@classmethod
|
||||
def get_failures(cls, request, credentials: dict = None) -> int:
|
||||
cls.update_request(request)
|
||||
return cls.get_implementation().get_failures(request, credentials)
|
||||
|
||||
@classmethod
|
||||
@toggleable
|
||||
def user_login_failed(cls, sender, credentials: dict, request=None, **kwargs):
|
||||
|
|
|
|||
|
|
@ -275,3 +275,18 @@ class AxesDummyHandlerTestCase(AxesHandlerBaseTestCase):
|
|||
self.login()
|
||||
|
||||
self.check_login()
|
||||
|
||||
|
||||
@override_settings(AXES_HANDLER="axes.handlers.test.AxesTestHandler")
|
||||
class AxesTestHandlerTestCase(AxesHandlerBaseTestCase):
|
||||
def test_handler_reset_attempts(self):
|
||||
self.assertEqual(0, AxesProxyHandler.reset_attempts())
|
||||
|
||||
def test_handler_reset_logs(self):
|
||||
self.assertEqual(0, AxesProxyHandler.reset_logs())
|
||||
|
||||
def test_handler_is_allowed(self):
|
||||
self.assertEqual(True, AxesProxyHandler.is_allowed(self.request, {}))
|
||||
|
||||
def test_handler_get_failures(self):
|
||||
self.assertEqual(0, AxesProxyHandler.get_failures(self.request, {}))
|
||||
|
|
|
|||
Loading…
Reference in a new issue