corradio / polynomial

A central place to track your most vital KPIs
https://polynomial.so
9 stars 2 forks source link

Celine can't log in with username/password #106

Closed corradio closed 1 year ago

corradio commented 1 year ago

Internal Server Error: /accounts/login/

IntegrityError at /accounts/login/ duplicate key value violates unique constraint "account_emailaddress_email_key" DETAIL: Key (email)=(celine.poulsen@electricitymaps.com) already exists.

Request Method: POST Request URL: https://polynomial.so/accounts/login/ Django Version: 4.1.7 Python Executable: /usr/local/bin/python Python Version: 3.9.16 Python Path: ['/code', '/code', '/usr/local/bin', '/usr/local/lib/python39.zip', '/usr/local/lib/python3.9', '/usr/local/lib/python3.9/lib-dynload', '/root/.local/lib/python3.9/site-packages', '/usr/local/lib/python3.9/site-packages'] Server time: Mon, 27 Mar 2023 09:01:27 +0000 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'django_jsonform', 'allauth', 'allauth.account', 'allauth.socialaccount', 'allauth.socialaccount.providers.google', 'allauth.socialaccount.providers.linkedin_oauth2', 'compressor', 'mainapp'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/allauth/account/utils.py", line 313, in send_email_confirmation email_address = EmailAddress.objects.get_for_user(user, email) File "/usr/local/lib/python3.9/site-packages/allauth/account/managers.py", line 54, in get_for_user ret = self.get(user=user, email__iexact=email) File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 650, in get raise self.model.DoesNotExist(

During handling of the above exception (EmailAddress matching query does not exist.), another exception occurred: File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 929, in get_or_create return self.get(**kwargs), False File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 650, in get raise self.model.DoesNotExist(

During handling of the above exception (EmailAddress matching query does not exist.), another exception occurred: File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params)

The above exception (duplicate key value violates unique constraint "account_emailaddress_email_key" DETAIL: Key (email)=(celine.poulsen@electricitymaps.com) already exists. ) was the direct cause of the following exception: File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 56, in inner response = get_response(request) File "/usr/local/lib/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response response = wrapped_callback(request, *callback_args, callback_kwargs) File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 103, in view return self.dispatch(request, *args, *kwargs) File "/usr/local/lib/python3.9/site-packages/django/utils/decorators.py", line 46, in _wrapper return bound_method(args, kwargs) File "/usr/local/lib/python3.9/site-packages/django/views/decorators/debug.py", line 92, in sensitive_post_parameters_wrapper return view(request, *args, kwargs) File "/usr/local/lib/python3.9/site-packages/allauth/account/views.py", line 149, in dispatch return super(LoginView, self).dispatch(request, *args, *kwargs) File "/usr/local/lib/python3.9/site-packages/allauth/account/views.py", line 77, in dispatch response = super(RedirectAuthenticatedUserMixin, self).dispatch( File "/usr/local/lib/python3.9/site-packages/django/views/generic/base.py", line 142, in dispatch return handler(request, args, kwargs) File "/usr/local/lib/python3.9/site-packages/allauth/account/views.py", line 105, in post response = self.form_valid(form) File "/usr/local/lib/python3.9/site-packages/allauth/account/views.py", line 162, in form_valid return form.login(self.request, redirect_url=success_url) File "/usr/local/lib/python3.9/site-packages/allauth/account/forms.py", line 196, in login ret = perform_login( File "/usr/local/lib/python3.9/site-packages/allauth/account/utils.py", line 168, in perform_login response = adapter.pre_login(request, user, hook_kwargs) File "/usr/local/lib/python3.9/site-packages/allauth/account/adapter.py", line 412, in pre_login send_email_confirmation(request, user, signup=signup, email=email) File "/usr/local/lib/python3.9/site-packages/allauth/account/utils.py", line 324, in send_email_confirmation email_address = EmailAddress.objects.add_email( File "/usr/local/lib/python3.9/site-packages/allauth/account/managers.py", line 19, in add_email email_address, created = self.get_or_create( File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(args, kwargs) File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 936, in get_or_create return self.create(params), True File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 671, in create obj.save(force_insert=True, using=self.db) File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 812, in save self.save_base( File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 863, in save_base updated = self._save_table( File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 1006, in _save_table results = self._do_insert( File "/usr/local/lib/python3.9/site-packages/django/db/models/base.py", line 1047, in _do_insert return manager._insert( File "/usr/local/lib/python3.9/site-packages/django/db/models/manager.py", line 85, in manager_method return getattr(self.get_queryset(), name)(args, kwargs) File "/usr/local/lib/python3.9/site-packages/django/db/models/query.py", line 1791, in _insert return query.get_compiler(using=using).execute_sql(returning_fields) File "/usr/local/lib/python3.9/site-packages/django/db/models/sql/compiler.py", line 1660, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 67, in execute return self._execute_with_wrappers( File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers return executor(sql, params, many, context) File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.9/site-packages/django/db/utils.py", line 91, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "/usr/local/lib/python3.9/site-packages/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params)

Exception Type: IntegrityError at /accounts/login/ Exception Value: duplicate key value violates unique constraint "account_emailaddress_email_key" DETAIL: Key (email)=(celine.poulsen@electricitymaps.com) already exists.

Raised during: allauth.account.views.LoginView Request information: USER: AnonymousUser

corradio commented 1 year ago

Seems like two accounts with the same email could have been created!! (by email I mean User.email and not EmailAddresses)