Authentication does not work
See original GitHub issueWhen I tried to do an initial setup of the application based on the documentation, I came across this error when trying to sign in to dashboard:
Internal Server Error: /dashboard/login/
Traceback (most recent call last):
File "/home/eshop/env/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
response = get_response(request)
File "/home/eshop/env/lib/python3.5/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
response = self._get_response(request)
File "/home/eshop/env/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/eshop/env/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python3.5/contextlib.py", line 30, in inner
return func(*args, **kwds)
File "/home/eshop/env/lib/python3.5/site-packages/django/contrib/auth/views.py", line 54, in inner
return func(*args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/contrib/auth/views.py", line 139, in login
return LoginView.as_view(**kwargs)(request, *args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
return self.dispatch(request, *args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper
return view(request, *args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/eshop/env/lib/python3.5/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/utils/decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/eshop/env/lib/python3.5/site-packages/django/utils/decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/views/decorators/cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/utils/decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/eshop/env/lib/python3.5/site-packages/django/contrib/auth/views.py", line 90, in dispatch
return super(LoginView, self).dispatch(request, *args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/views/generic/base.py", line 88, in dispatch
return handler(request, *args, **kwargs)
File "/home/eshop/env/lib/python3.5/site-packages/django/views/generic/edit.py", line 182, in post
if form.is_valid():
File "/home/eshop/env/lib/python3.5/site-packages/django/forms/forms.py", line 183, in is_valid
return self.is_bound and not self.errors
File "/home/eshop/env/lib/python3.5/site-packages/django/forms/forms.py", line 175, in errors
self.full_clean()
File "/home/eshop/env/lib/python3.5/site-packages/django/forms/forms.py", line 385, in full_clean
self._clean_form()
File "/home/eshop/env/lib/python3.5/site-packages/django/forms/forms.py", line 412, in _clean_form
cleaned_data = self.clean()
File "/home/eshop/env/lib/python3.5/site-packages/django/contrib/auth/forms.py", line 187, in clean
self.user_cache = authenticate(self.request, username=username, password=password)
File "/home/eshop/env/lib/python3.5/site-packages/django/contrib/auth/__init__.py", line 100, in authenticate
user = backend.authenticate(*args, **credentials)
File "/home/eshop/env/lib/python3.5/site-packages/oscar/apps/customer/auth_backends.py", line 31, in authenticate
clean_email = normalise_email(email)
File "/home/eshop/env/lib/python3.5/site-packages/oscar/apps/customer/utils.py", line 130, in normalise_email
clean_email = email.strip()
AttributeError: 'WSGIRequest' object has no attribute 'strip'
I am using Django 1.11 and in settings:
AUTHENTICATION_BACKENDS = (
'oscar.apps.customer.auth_backends.EmailBackend',
'django.contrib.auth.backends.ModelBackend',
)
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Troubleshooting Authentication Issues | Microsoft Learn
Learn how to troubleshoot issues related to problems users may have when attempting to connect to DirectAccess using OTP authentication.
Read more >Unable to get windows authentication to work through local IIS
You have to whitelist a domain specified in the hosts file in order for windows authentication to work: Click Start, click Run, type...
Read more >WiFi Authentication Errors and Methods to Solve Them - Okta
An authentication error occurs when a device can't connect to WiFi. Learn about what causes WiFi authentication problems and how to fix ...
Read more >Fix common issues with 2-Step Verification - Google Support
My Google Authenticator codes don't work · On your Android device, go to the main menu of the Google Authenticator app. · Tap...
Read more >Troubleshooting Active Directory Authentication / AD login ...
Run ipconfig /all on the Application Server to determine if it's pointed to the organization's DNS IP. If the domain DNS IP is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
OK, got it.
The problem is in the EmailBackend.authenticate method, since there is one argument missing - request.
Instead of
authenticate(self, email=None, password=None, *args, **kwargs)
it should beauthenticate(self, request, email=None, password=None, *args, **kwargs)
because of this calling line:
Closing as duplicate of #2321.