From 9ca5ba974b30126e56b7b273b5585903a5ab3e56 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Thu, 25 May 2023 18:34:55 +0200 Subject: [PATCH] Auth: mark id as protected, otherwise social-core try to create new account at each login: ``` File "/srv/umap/venv/lib/python3.10/site-packages/social_core/backends/base.py", line 83, in pipeline out = self.run_pipeline(pipeline, pipeline_index, *args, **kwargs) File "/srv/umap/venv/lib/python3.10/site-packages/social_core/backends/base.py", line 113, in run_pipeline result = func(*args, **out) or {} File "/srv/umap/venv/lib/python3.10/site-packages/social_core/pipeline/user.py", line 122, in user_details strategy.storage.user.changed(user) File "/srv/umap/venv/lib/python3.10/site-packages/social_django/storage.py", line 16, in changed user.save() django.db.utils.IntegrityError: duplicate key value violates unique constraint "auth_user_username_key" DETAIL: Key (username)=(xxxxx) already exists. ``` --- umap/settings/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/umap/settings/base.py b/umap/settings/base.py index 23881b68..8a640140 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -237,6 +237,7 @@ COMPRESS_OFFLINE = True SOCIAL_AUTH_DEFAULT_USERNAME = lambda u: slugify(u) SOCIAL_AUTH_ASSOCIATE_BY_EMAIL = True SOCIAL_AUTH_NO_DEFAULT_PROTECTED_USER_FIELDS = True +SOCIAL_AUTH_PROTECTED_USER_FIELDS = ("id", ) LOGIN_URL = "login" SOCIAL_AUTH_LOGIN_REDIRECT_URL = "/login/popup/end/" SOCIAL_AUTH_PIPELINE = (