Skip to content

Commit

Permalink
Merge pull request #100 from AJRenold/two_factor
Browse files Browse the repository at this point in the history
PASSWORD_FORM_FIELD set from django settings file
  • Loading branch information
camilonova committed Oct 23, 2014
2 parents e2c0059 + b77daf2 commit c060bde
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion axes/decorators.py
Expand Up @@ -43,6 +43,9 @@
# use a specific username field to retrieve from login POST data
USERNAME_FORM_FIELD = getattr(settings, 'AXES_USERNAME_FORM_FIELD', 'username')

# use a specific password field to retrieve from login POST data
PASSWORD_FORM_FIELD = getattr(settings, 'AXES_PASSWORD_FORM_FIELD', 'password')

# see if the django app is sitting behind a reverse proxy
BEHIND_REVERSE_PROXY = getattr(settings, 'AXES_BEHIND_REVERSE_PROXY', False)

Expand Down Expand Up @@ -159,7 +162,7 @@ def query2str(items, max_length=1024):

kvs = []
for k, v in items:
if k != 'password':
if k != PASSWORD_FORM_FIELD:
kvs.append(six.u('%s=%s') % (k, v))

return '\n'.join(kvs)[:max_length]
Expand Down Expand Up @@ -307,6 +310,7 @@ def decorated_login(request, *args, **kwargs):

if request.method == 'POST':
# see if the login was successful

login_unsuccessful = (
response and
not response.has_header('location') and
Expand Down

0 comments on commit c060bde

Please sign in to comment.