[Django] ERROR (EXTERNAL IP): Internal Server Error: /accounts/login/
I have a user attempting to access the list archives and he’s generating this login error. I have verified that he does have a django account. I’ve never seen this one before and I didn’t find anything relevant in the lit archives.
Any ideas what’s going on here?
- Mark
mark@pdc-racing.net | 408-348-2878
From: noreply@pdc-racing.net Subject: [Django] ERROR (EXTERNAL IP): Internal Server Error: /accounts/login/ Date: May 18, 2021 at 2:38:20 PM PDT To: mark@pdc-racing.net
Internal Server Error: /accounts/login/
MultipleObjectsReturned at /accounts/login/ get() returned more than one EmailAddress -- it returned 2!
Request Method: POST Request URL: https://mail.pdc-racing.net/accounts/login/ Django Version: 3.0.12 Python Executable: /opt/mailman/mm/venv/bin/python Python Version: 3.8.5 Python Path: ['/opt/mailman/mm', '/opt/mailman/mm/', '/opt/mailman/mm/bin', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/opt/mailman/mm/venv/lib/python3.8/site-packages'] Server time: Tue, 18 May 2021 14:38:20 -0700 Installed Applications: ('hyperkitty', 'postorius', 'django_mailman3', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'django_gravatar', 'compressor', 'haystack', 'django_extensions', 'django_q', 'allauth', 'allauth.account', 'allauth.socialaccount') Installed Middleware: ('django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', 'django_mailman3.middleware.TimezoneMiddleware', 'postorius.middleware.PostoriusMiddleware')
Traceback (most recent call last): File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner response = get_response(request) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 71, in view return self.dispatch(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/views/decorators/debug.py", line 76, in sensitive_post_parameters_wrapper return view(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/views.py", line 146, in dispatch return super(LoginView, self).dispatch(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/views.py", line 74, in dispatch response = super(RedirectAuthenticatedUserMixin, self).dispatch( File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 97, in dispatch return handler(request, *args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/views.py", line 102, in post response = self.form_valid(form) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/views.py", line 159, in form_valid return form.login(self.request, redirect_url=success_url) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/forms.py", line 195, in login ret = perform_login( File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/utils.py", line 174, in perform_login if not _has_verified_for_login(user, email): File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/utils.py", line 134, in _has_verified_for_login emailaddress = EmailAddress.objects.get_for_user(user, email) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/managers.py", line 54, in get_for_user ret = self.get(user=user, email__iexact=email) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/db/models/query.py", line 419, in get raise self.model.MultipleObjectsReturned(
Exception Type: MultipleObjectsReturned at /accounts/login/ Exception Value: get() returned more than one EmailAddress -- it returned 2! Request information: USER: AnonymousUser
On 5/18/21 4:06 PM, Mark Dadgar wrote:
I have a user attempting to access the list archives and he’s generating this login error. I have verified that he does have a django account. I’ve never seen this one before and I didn’t find anything relevant in the lit archives.
Any ideas what’s going on here? ... File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/utils.py", line 134, in _has_verified_for_login emailaddress = EmailAddress.objects.get_for_user(user, email) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/managers.py", line 54, in get_for_user ret = self.get(user=user, email__iexact=email) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/db/models/query.py", line 419, in get raise self.model.MultipleObjectsReturned(
Exception Type: MultipleObjectsReturned at /accounts/login/ Exception Value: get() returned more than one EmailAddress -- it returned 2! Request information: USER: AnonymousUser
Go to the Django admin users page - something like http(s)://example.com/admin/auth/user/ - and search for the email address. This search is case-insensitive and I'm guessing it will find two users differing in case.
In any event, django allauth is trying to find this user and is finding multiple EmailAddress.objects for this address or username.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On May 18, 2021, at 5:34 PM, Mark Sapiro <mark@msapiro.net> wrote:
On 5/18/21 4:06 PM, Mark Dadgar wrote:
I have a user attempting to access the list archives and he’s generating this login error. I have verified that he does have a django account. I’ve never seen this one before and I didn’t find anything relevant in the lit archives.
Any ideas what’s going on here? ... File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/utils.py", line 134, in _has_verified_for_login emailaddress = EmailAddress.objects.get_for_user(user, email) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/allauth/account/managers.py", line 54, in get_for_user ret = self.get(user=user, email__iexact=email) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/db/models/manager.py", line 82, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/opt/mailman/mm/venv/lib/python3.8/site-packages/django/db/models/query.py", line 419, in get raise self.model.MultipleObjectsReturned(
Exception Type: MultipleObjectsReturned at /accounts/login/ Exception Value: get() returned more than one EmailAddress -- it returned 2! Request information: USER: AnonymousUser
Go to the Django admin users page - something like http(s)://example.com/admin/auth/user/ - and search for the email address. This search is case-insensitive and I'm guessing it will find two users differing in case.
In any event, django allauth is trying to find this user and is finding multiple EmailAddress.objects for this address or username.
I had actually done this but checked the Users section and had overlooked the Email Addresses section. It was as you suggested - duplicate emails differing only in case.
Given that there was only one user account, how does this happen? List subscription without associated user account creation with slightly different case?
- Mark
mark@pdc-racing.net | 408-348-2878
On 5/18/21 7:28 PM, Mark Dadgar wrote:
I had actually done this but checked the Users section and had overlooked the Email Addresses section. It was as you suggested - duplicate emails differing only in case.
Given that there was only one user account, how does this happen? List subscription without associated user account creation with slightly different case?
First, the Django users are separate from Mailman core users and don't have anything directly to do with list subscriptions.
As far as how there got to be one User in Django with two EmailAddresses differing only in case, that's probably a bug in Django allauth. The page at accounts/email/ doesn't allow adding an address that differs only in case from an existing address, but possibly adding via a social auth provider bypasses that check.
I couldn't find an issue at https://github.com/pennersr/django-allauth/issues but that doesn't mean there isn't one.
In case you haven't done it, I think just deleting one of the addresses (the non-primary one) in Django's Email Addresses section will solve your issue.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On May 18, 2021, at 7:58 PM, Mark Sapiro <mark@msapiro.net> wrote:
In case you haven't done it, I think just deleting one of the addresses (the non-primary one) in Django's Email Addresses section will solve your issue.
Yes, it did!
Thanks for the help, as always.
- Mark
mark@pdc-racing.net | 408-348-2878
participants (2)
-
Mark Dadgar
-
Mark Sapiro