mirror of
https://github.com/jazzband/django-axes.git
synced 2026-05-22 22:25:49 +00:00
Merge pull request #77 from eht16/reverse_proxy_log_reducing
Reduce logging of reverse proxy IP lookup and use configured logger. Fixes #76
This commit is contained in:
commit
c93fa4055b
1 changed files with 11 additions and 7 deletions
|
|
@ -64,11 +64,20 @@ ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. "
|
|||
"Note that both fields are case-sensitive.")
|
||||
|
||||
|
||||
log = logging.getLogger(LOGGER)
|
||||
if VERBOSE:
|
||||
log.info('AXES: BEGIN LOG')
|
||||
log.info('Using django-axes ' + axes.get_version())
|
||||
|
||||
|
||||
if BEHIND_REVERSE_PROXY:
|
||||
log.debug('Axes is configured to be behind reverse proxy...looking for header value %s', REVERSE_PROXY_HEADER)
|
||||
|
||||
|
||||
def get_ip(request):
|
||||
if not BEHIND_REVERSE_PROXY:
|
||||
ip = request.META.get('REMOTE_ADDR', '')
|
||||
else:
|
||||
logging.debug('Axes is configured to be behind reverse proxy...looking for header value %s', REVERSE_PROXY_HEADER)
|
||||
ip = request.META.get(REVERSE_PROXY_HEADER, '')
|
||||
if ip == '':
|
||||
raise Warning('Axes is configured for operation behind a reverse proxy but could not find '\
|
||||
|
|
@ -76,6 +85,7 @@ def get_ip(request):
|
|||
'to make sure this header value is being passed.'.format(REVERSE_PROXY_HEADER))
|
||||
return ip
|
||||
|
||||
|
||||
def get_lockout_url():
|
||||
return getattr(settings, 'AXES_LOCKOUT_URL', None)
|
||||
|
||||
|
|
@ -110,12 +120,6 @@ def ip_in_blacklist(ip):
|
|||
return False
|
||||
|
||||
|
||||
log = logging.getLogger(LOGGER)
|
||||
if VERBOSE:
|
||||
log.info('AXES: BEGIN LOG')
|
||||
log.info('Using django-axes ' + axes.get_version())
|
||||
|
||||
|
||||
def is_user_lockable(request):
|
||||
"""Check if the user has a profile with nolockout
|
||||
If so, then return the value to see if this user is special
|
||||
|
|
|
|||
Loading…
Reference in a new issue