mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-09 16:14:46 +00:00
Merge pull request #96 from zoten/master
Log out only if user was logged in
This commit is contained in:
commit
ee62450b79
1 changed files with 2 additions and 1 deletions
|
|
@ -424,7 +424,8 @@ def check_request(request, login_unsuccessful):
|
|||
if failures > FAILURE_LIMIT and LOCK_OUT_AT_FAILURE and user_lockable:
|
||||
# We log them out in case they actually managed to enter the correct
|
||||
# password
|
||||
logout(request)
|
||||
if hasattr(request, 'user') and request.user.is_authenticated():
|
||||
logout(request)
|
||||
log.warn('AXES: locked out %s after repeated login attempts.' %
|
||||
(ip_address,))
|
||||
# send signal when someone is locked out.
|
||||
|
|
|
|||
Loading…
Reference in a new issue