Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error message when signing up with social and unable to link #96

Open
corradio opened this issue Mar 22, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@corradio
Copy link
Owner

corradio commented Mar 22, 2023

Links:

Internal Server Error: /accounts/social/signup/

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

Request Method: POST
Request URL: https://polynomial.so/accounts/social/signup/
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: Wed, 22 Mar 2023 14:57: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 63, in get_for_user
raise self.model.DoesNotExist()

During handling of the above exception (), 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(

@corradio corradio added the bug Something isn't working label Mar 22, 2023
@corradio
Copy link
Owner Author

corradio commented Mar 27, 2023

Note: we can't auto log in as we'd need to verify that the social email address is verified (else someone could be impersonating). This is only possible with Google and is provider dependant.

Update: a new user friendly error is now shown since c12bc39:

image

@corradio corradio closed this as not planned Won't fix, can't repro, duplicate, stale Mar 27, 2023
@corradio corradio changed the title Attempting to sign up with social should link and log in when existing account already is present Better error message when signing up with social and unable to link May 2, 2023
@corradio
Copy link
Owner Author

corradio commented May 2, 2023

Action: add a better error message, see pennersr/django-allauth#215 (comment)
Depends on #107

Note: we should let the providers define their verified flag on email addresses and avoid overriding it. For example, even if we know LinkedIn addresses are supposed to be verified, it is unclear if the user added a new email that hasn't been verified yet.

@corradio corradio reopened this May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant