mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-22 14:21:52 +00:00
Move signal's callbacks to AxesDatabaseHandler as they only make sense for a DB backend.
This commit is contained in:
parent
9bb04a01b8
commit
87d8a974a3
2 changed files with 13 additions and 24 deletions
|
|
@ -118,30 +118,6 @@ class AxesHandler(AbstractAxesHandler): # pylint: disable=unused-argument
|
|||
|
||||
return True
|
||||
|
||||
def post_save_access_attempt(self, instance, **kwargs):
|
||||
"""
|
||||
Handles the ``axes.models.AccessAttempt`` object post save signal.
|
||||
|
||||
:raises NotImplementedError: if the handler does not support post save signal.
|
||||
"""
|
||||
|
||||
raise NotImplementedError(
|
||||
"Post save signal callback is not supported on this backend"
|
||||
)
|
||||
|
||||
|
||||
def post_delete_access_attempt(self, instance, **kwargs):
|
||||
"""
|
||||
Handles the ``axes.models.AccessAttempt`` object post delete signal.
|
||||
|
||||
:raises NotImplementedError: if the handler does not support post delete signal.
|
||||
"""
|
||||
|
||||
raise NotImplementedError(
|
||||
"Post delete signal callback is not supported on this backend"
|
||||
)
|
||||
|
||||
|
||||
def is_blacklisted(
|
||||
self, request, credentials: dict = None
|
||||
) -> bool: # pylint: disable=unused-argument
|
||||
|
|
|
|||
|
|
@ -235,3 +235,16 @@ class AxesDatabaseHandler(AxesHandler): # pylint: disable=too-many-locals
|
|||
AccessLog.objects.filter(
|
||||
username=username, logout_time__isnull=True
|
||||
).update(logout_time=request.axes_attempt_time)
|
||||
|
||||
def post_save_access_attempt(self, instance, **kwargs):
|
||||
"""
|
||||
Handles the ``axes.models.AccessAttempt`` object post save signal.
|
||||
"""
|
||||
pass
|
||||
|
||||
def post_delete_access_attempt(self, instance, **kwargs):
|
||||
"""
|
||||
Handles the ``axes.models.AccessAttempt`` object post delete signal.
|
||||
|
||||
"""
|
||||
pass
|
||||
Loading…
Reference in a new issue