mirror of
https://github.com/jazzband/django-axes.git
synced 2026-03-16 22:30:23 +00:00
parent
4a7b90e98e
commit
cb2c014334
1 changed files with 13 additions and 12 deletions
|
|
@ -197,24 +197,25 @@ def is_user_lockable(request):
|
|||
# not a valid user
|
||||
return True
|
||||
|
||||
# Django 1.5 does not support profile anymore, ask directly to user
|
||||
if hasattr(user, 'nolockout'):
|
||||
# need to revert since we need to return
|
||||
# false for users that can't be blocked
|
||||
return not user.nolockout
|
||||
|
||||
try:
|
||||
profile = user.get_profile()
|
||||
except (SiteProfileNotAvailable, ObjectDoesNotExist, AttributeError):
|
||||
# no profile
|
||||
return True
|
||||
elif hasattr(settings, 'AUTH_PROFILE_MODULE'):
|
||||
try:
|
||||
profile = user.get_profile()
|
||||
if hasattr(profile, 'nolockout'):
|
||||
# need to revert since we need to return
|
||||
# false for users that can't be blocked
|
||||
return not profile.nolockout
|
||||
|
||||
if hasattr(profile, 'nolockout'):
|
||||
# need to revert since we need to return
|
||||
# false for users that can't be blocked
|
||||
return not profile.nolockout
|
||||
else:
|
||||
return True
|
||||
except (SiteProfileNotAvailable, ObjectDoesNotExist, AttributeError):
|
||||
# no profile
|
||||
return True
|
||||
|
||||
# Default behavior for a user to be lockable
|
||||
return True
|
||||
|
||||
def _get_user_attempts(request):
|
||||
"""Returns access attempt record if it exists.
|
||||
|
|
|
|||
Loading…
Reference in a new issue