diff options
| author | Daniel Hahler <git@thequod.de> | 2017-05-22 17:03:18 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-05-22 12:24:38 -0400 |
| commit | a3ba2662cdaa36183fdfb8a26dfa157e26fca76a (patch) | |
| tree | 52ac55ad1dbb9ea4fbcffdbe4fcee2b2c44fda62 /django | |
| parent | 266b24316841f878c129e6dbb026f6c3edcdb54f (diff) | |
Refs #28207 -- Fixed contrib.auth.authenticate() if 'backend' is in the credentials.
Regression in 3008f30f194af386c354416be4c483f0f6b15f33.
Diffstat (limited to 'django')
| -rw-r--r-- | django/contrib/auth/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/django/contrib/auth/__init__.py b/django/contrib/auth/__init__.py index fc876b4a1e..d96300c503 100644 --- a/django/contrib/auth/__init__.py +++ b/django/contrib/auth/__init__.py @@ -67,7 +67,7 @@ def authenticate(request=None, **credentials): """ for backend, backend_path in _get_backends(return_tuples=True): try: - user = _authenticate_with_backend(backend, backend_path, request, **credentials) + user = _authenticate_with_backend(backend, backend_path, request, credentials) except PermissionDenied: # This backend says to stop in our tracks - this user should not be allowed in at all. break @@ -81,13 +81,14 @@ def authenticate(request=None, **credentials): user_login_failed.send(sender=__name__, credentials=_clean_credentials(credentials), request=request) -def _authenticate_with_backend(backend, backend_path, request, **credentials): +def _authenticate_with_backend(backend, backend_path, request, credentials): args = (request,) # Does the backend accept a request argument? try: inspect.getcallargs(backend.authenticate, request, **credentials) except TypeError: args = () + credentials.pop('request', None) # Does the backend accept a request keyword argument? try: inspect.getcallargs(backend.authenticate, request=request, **credentials) |
