Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions social_core/backends/gae.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)."""
Expand Down
1 change: 1 addition & 0 deletions social_core/backends/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 1 addition & 0 deletions social_core/backends/ping.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
2 changes: 2 additions & 0 deletions social_core/pipeline/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
2 changes: 2 additions & 0 deletions social_core/pipeline/social_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions social_core/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
1 change: 1 addition & 0 deletions social_core/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down
3 changes: 3 additions & 0 deletions social_core/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 2 additions & 0 deletions social_core/tests/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))

Expand All @@ -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"))
4 changes: 4 additions & 0 deletions social_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def first(func, items):
for item in items:
if func(item):
return item
return None


def parse_qs(value):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
Loading