diff --git a/social_core/backends/gae.py b/social_core/backends/gae.py index fc67fba1b..1fc3c1a5b 100644 --- a/social_core/backends/gae.py +++ b/social_core/backends/gae.py @@ -18,6 +18,7 @@ def get_user_id(self, details, response): user = users.get_current_user() if user: return user.user_id() + return None def get_user_details(self, response): """Return user basic information (id and email only).""" diff --git a/social_core/backends/oauth.py b/social_core/backends/oauth.py index 4668a373e..287629fdf 100644 --- a/social_core/backends/oauth.py +++ b/social_core/backends/oauth.py @@ -160,6 +160,7 @@ def revoke_token(self, token, uid): method=self.REVOKE_TOKEN_METHOD, ) return self.process_revoke_token_response(response) + return None class BaseOAuth1(OAuthAuth): diff --git a/social_core/backends/ping.py b/social_core/backends/ping.py index 8047de770..5d6b0d230 100644 --- a/social_core/backends/ping.py +++ b/social_core/backends/ping.py @@ -26,6 +26,7 @@ def find_valid_key(self, id_token): decoded_sig = base64url_decode(encoded_sig.encode("utf-8")) if rsakey.verify(message.encode("utf-8"), decoded_sig): return key + return None def validate_and_return_id_token(self, id_token, access_token): """ diff --git a/social_core/pipeline/mail.py b/social_core/pipeline/mail.py index 239600d03..96a3a3fd6 100644 --- a/social_core/pipeline/mail.py +++ b/social_core/pipeline/mail.py @@ -18,6 +18,7 @@ def mail_validation(backend, details, is_new=False, *args, **kwargs): details["email"], data["verification_code"] ): raise InvalidEmail(backend) + return None else: current_partial = kwargs.get("current_partial") backend.strategy.send_email_validation( @@ -27,3 +28,4 @@ def mail_validation(backend, details, is_new=False, *args, **kwargs): return backend.strategy.redirect( backend.strategy.setting("EMAIL_VALIDATION_URL") ) + return None diff --git a/social_core/pipeline/social_auth.py b/social_core/pipeline/social_auth.py index 7ad0d20c8..4ab6e319a 100644 --- a/social_core/pipeline/social_auth.py +++ b/social_core/pipeline/social_auth.py @@ -51,6 +51,7 @@ def associate_user(backend, uid, user=None, social=None, *args, **kwargs): return result else: return {"social": social, "user": social.user, "new_association": True} + return None def associate_by_email(backend, details, user=None, *args, **kwargs): @@ -80,6 +81,7 @@ def associate_by_email(backend, details, user=None, *args, **kwargs): ) else: return {"user": users[0], "is_new": False} + return None def load_extra_data(backend, details, response, uid, user, *args, **kwargs): diff --git a/social_core/storage.py b/social_core/storage.py index 9e3cb6276..a77cbe2de 100644 --- a/social_core/storage.py +++ b/social_core/storage.py @@ -82,6 +82,7 @@ def expiration_timedelta(self): reference = datetime.fromtimestamp(auth_time, tz=timezone.utc) return (reference + timedelta(seconds=expires)) - now return timedelta(seconds=expires) + return None def expiration_datetime(self): # backward compatible alias @@ -108,6 +109,7 @@ def set_extra_data(self, extra_data=None): else: self.extra_data = extra_data return True + return None @classmethod def clean_username(cls, value): diff --git a/social_core/store.py b/social_core/store.py index cb6228b8b..eea1e4a6e 100644 --- a/social_core/store.py +++ b/social_core/store.py @@ -48,6 +48,7 @@ def getAssociation(self, server_url, handle=None): if associations: # return most recet association return associations[0] + return None def useNonce(self, server_url, timestamp, salt): """Generate one use number and return *if* it was created""" diff --git a/social_core/tests/models.py b/social_core/tests/models.py index bf6111fce..66774fd74 100644 --- a/social_core/tests/models.py +++ b/social_core/tests/models.py @@ -116,12 +116,14 @@ def get_user(cls, pk): for username, user in User.cache.items(): if user.id == pk: return user + return None @classmethod def get_social_auth(cls, provider, uid): social_user = cls.cache_by_uid.get(uid) if social_user and social_user.provider == provider: return social_user + return None @classmethod def get_social_auth_for_user(cls, user, provider=None, id=None): @@ -216,6 +218,7 @@ def get_code(cls, code): for c in cls.cache.values(): if c.code == code: return c + return None class TestPartial(PartialMixin, BaseModel): diff --git a/social_core/tests/pipeline.py b/social_core/tests/pipeline.py index 94a91565f..b54003530 100644 --- a/social_core/tests/pipeline.py +++ b/social_core/tests/pipeline.py @@ -31,6 +31,7 @@ def remove_user(strategy, user, *args, **kwargs): def set_user_from_kwargs(strategy, *args, **kwargs): if strategy.session_get("attribute"): kwargs["user"].id + return None else: return strategy.redirect(strategy.build_absolute_uri("/attribute")) @@ -39,5 +40,6 @@ def set_user_from_kwargs(strategy, *args, **kwargs): def set_user_from_args(strategy, user, *args, **kwargs): if strategy.session_get("attribute"): user.id + return None else: return strategy.redirect(strategy.build_absolute_uri("/attribute")) diff --git a/social_core/utils.py b/social_core/utils.py index 894e31274..67bdaacf9 100644 --- a/social_core/utils.py +++ b/social_core/utils.py @@ -153,6 +153,7 @@ def first(func, items): for item in items: if func(item): return item + return None def parse_qs(value): @@ -208,6 +209,8 @@ def partial_pipeline_data(backend, user=None, partial_token=None, *args, **kwarg partial.extend_kwargs(kwargs) return partial backend.strategy.clean_partial_pipeline(partial_token) + return None + return None def build_absolute_uri(host_url, path=None): @@ -240,6 +243,7 @@ def setting_url(backend, *names): value = backend.setting(name) if is_url(value): return value + return None def handle_http_errors(func):