From c3ce70a970e279b00b08423d28eb393aa6a977b1 Mon Sep 17 00:00:00 2001 From: Hannes Struss Date: Thu, 7 Jun 2012 18:43:58 +0200 Subject: [PATCH] introduced setting SOCIAL_AUTH_PROTECTED_USER_FIELDS this can be a tuple of field-names on the user object, which django-social-auth will not overwrite when the user already existed, i.e. was not created in the current auth process. --- social_auth/backends/pipeline/user.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/social_auth/backends/pipeline/user.py b/social_auth/backends/pipeline/user.py index 9ebaf03..6cd3676 100644 --- a/social_auth/backends/pipeline/user.py +++ b/social_auth/backends/pipeline/user.py @@ -91,7 +91,9 @@ def update_user_details(backend, details, response, user, is_new=False, *args, if not setting('SOCIAL_AUTH_CHANGE_SIGNAL_ONLY'): for name, value in details.iteritems(): # do not update username, it was already generated - if name in (USERNAME, 'id', 'pk'): + # do not update configured fields if user already existed + if name in (USERNAME, 'id', 'pk') or (not is_new and + name in setting('SOCIAL_AUTH_PROTECTED_USER_FIELDS', [])): continue if value and value != getattr(user, name, None): setattr(user, name, value) -- 2.39.5