mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-11 09:03:12 +00:00
ONLY_USER works when cache is disabled
The _get_user_attempts function now checks for AXES_ONLY_USER_FAILURES, and only includes the IP when AXES_ONLY_USER_FAILURES = False.
This commit is contained in:
parent
fb205cc95c
commit
ad170dabcb
1 changed files with 10 additions and 3 deletions
|
|
@ -171,11 +171,18 @@ def _get_user_attempts(request):
|
|||
)
|
||||
|
||||
if not attempts:
|
||||
params = {'ip_address': ip, 'trusted': False}
|
||||
params = {'trusted': False}
|
||||
|
||||
if AXES_ONLY_USER_FAILURES:
|
||||
params['username'] = username
|
||||
elif LOCK_OUT_BY_COMBINATION_USER_AND_IP:
|
||||
params['username'] = username
|
||||
params['ip_address'] = ip
|
||||
else:
|
||||
params['ip_address'] = ip
|
||||
|
||||
if USE_USER_AGENT:
|
||||
params['user_agent'] = ua
|
||||
if LOCK_OUT_BY_COMBINATION_USER_AND_IP:
|
||||
params['username'] = username
|
||||
|
||||
attempts = AccessAttempt.objects.filter(**params)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue