Skip to content

Commit

Permalink
fix(socialaccount): Allow new social logins to establish SITE_ID from…
Browse files Browse the repository at this point in the history
… request
  • Loading branch information
jeredfloyd authored Dec 7, 2023
1 parent 1a8b67d commit a255c4b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion allauth/socialaccount/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _add_social_account(request, sociallogin):

def complete_social_login(request, sociallogin):
assert not sociallogin.is_existing
sociallogin.lookup()
sociallogin.lookup(request)
try:
get_adapter().pre_social_login(request, sociallogin)
signals.pre_social_login.send(
Expand Down
4 changes: 2 additions & 2 deletions allauth/socialaccount/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,12 @@ def is_existing(self):
return False
return get_user_model().objects.filter(pk=self.user.pk).exists()

def lookup(self):
def lookup(self, request=None):
"""Look up the existing local user account to which this social login
points, if any.
"""
if not self._lookup_by_socialaccount():
provider_id = self.account.get_provider().id
provider_id = self.account.get_provider(request).id
if app_settings.EMAIL_AUTHENTICATION or app_settings.PROVIDERS.get(
provider_id, {}
).get("EMAIL_AUTHENTICATION", False):
Expand Down

0 comments on commit a255c4b

Please sign in to comment.