diff --git a/social_core/pipeline/user.py b/social_core/pipeline/user.py index e7f15b72..79665b10 100644 --- a/social_core/pipeline/user.py +++ b/social_core/pipeline/user.py @@ -11,17 +11,17 @@ def get_username(strategy, details, backend, user=None, *args, **kwargs): storage = strategy.storage if not user: - email_as_username = strategy.setting('USERNAME_IS_FULL_EMAIL', False) - uuid_length = strategy.setting('UUID_LENGTH', 16) + email_as_username = backend.setting('USERNAME_IS_FULL_EMAIL', False) + uuid_length = backend.setting('UUID_LENGTH', 16) max_length = storage.user.username_max_length() - do_slugify = strategy.setting('SLUGIFY_USERNAMES', False) - do_clean = strategy.setting('CLEAN_USERNAMES', True) + do_slugify = backend.setting('SLUGIFY_USERNAMES', False) + do_clean = backend.setting('CLEAN_USERNAMES', True) def identity_func(val): return val if do_clean: - override_clean = strategy.setting('CLEAN_USERNAME_FUNCTION') + override_clean = backend.setting('CLEAN_USERNAME_FUNCTION') if override_clean: clean_func = module_member(override_clean) else: @@ -30,7 +30,7 @@ def identity_func(val): clean_func = identity_func if do_slugify: - override_slug = strategy.setting('SLUGIFY_FUNCTION') + override_slug = backend.setting('SLUGIFY_FUNCTION') if override_slug: slug_func = module_member(override_slug) else: @@ -88,19 +88,19 @@ def user_details(strategy, details, backend, user=None, *args, **kwargs): # Default protected user fields (username, id, pk and email) can be ignored # by setting the SOCIAL_AUTH_NO_DEFAULT_PROTECTED_USER_FIELDS to True - if strategy.setting('NO_DEFAULT_PROTECTED_USER_FIELDS') is True: + if strategy.setting('NO_DEFAULT_PROTECTED_USER_FIELDS', backend=backend) is True: protected = () else: protected = ('username', 'id', 'pk', 'email', 'password', 'is_active', 'is_staff', 'is_superuser',) - protected = protected + tuple(strategy.setting('PROTECTED_USER_FIELDS', [])) + protected = protected + tuple(strategy.setting('PROTECTED_USER_FIELDS', [], backend=backend)) # Update user model attributes with the new data sent by the current # provider. Update on some attributes is disabled by default, for # example username and id fields. It's also possible to disable update # on fields defined in SOCIAL_AUTH_PROTECTED_USER_FIELDS. - field_mapping = strategy.setting('USER_FIELD_MAPPING', {}, backend) + field_mapping = strategy.setting('USER_FIELD_MAPPING', {}, backend=backend) for name, value in details.items(): # Convert to existing user field if mapping exists name = field_mapping.get(name, name) @@ -111,7 +111,7 @@ def user_details(strategy, details, backend, user=None, *args, **kwargs): if current_value == value: continue - immutable_fields = tuple(strategy.setting('IMMUTABLE_USER_FIELDS', [])) + immutable_fields = tuple(strategy.setting('IMMUTABLE_USER_FIELDS', [], backend=backend)) if name in immutable_fields and current_value: continue