mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-05 14:14:46 +00:00
Revert "Optimize user attempts fetching. (#491)"
This reverts commit b8ef12ce84.
This commit is contained in:
parent
d01acf2261
commit
f05ad802e0
1 changed files with 2 additions and 8 deletions
|
|
@ -31,12 +31,6 @@ class AxesDatabaseHandler(AxesHandler): # pylint: disable=too-many-locals
|
|||
Signal handler implementation that records user login attempts to database and locks users out if necessary.
|
||||
"""
|
||||
|
||||
def _get_user_attempts(self, request, credentials: dict = None):
|
||||
if not hasattr(request, "axes_user_attempts"):
|
||||
request.axes_user_attempts = get_user_attempts(request, credentials)
|
||||
|
||||
return request.axes_user_attempts
|
||||
|
||||
def reset_attempts(self, *, ip_address: str = None, username: str = None) -> int:
|
||||
attempts = AccessAttempt.objects.all()
|
||||
|
||||
|
|
@ -66,7 +60,7 @@ class AxesDatabaseHandler(AxesHandler): # pylint: disable=too-many-locals
|
|||
return count
|
||||
|
||||
def get_failures(self, request, credentials: dict = None) -> int:
|
||||
attempts = self._get_user_attempts(request, credentials)
|
||||
attempts = get_user_attempts(request, credentials)
|
||||
return (
|
||||
attempts.aggregate(Max("failures_since_start"))["failures_since_start__max"]
|
||||
or 0
|
||||
|
|
@ -129,7 +123,7 @@ class AxesDatabaseHandler(AxesHandler): # pylint: disable=too-many-locals
|
|||
|
||||
separator = "\n---------\n"
|
||||
|
||||
attempts = self._get_user_attempts(request, credentials)
|
||||
attempts = get_user_attempts(request, credentials)
|
||||
attempts.update(
|
||||
get_data=Concat("get_data", Value(separator + get_data)),
|
||||
post_data=Concat("post_data", Value(separator + post_data)),
|
||||
|
|
|
|||
Loading…
Reference in a new issue