Skip to content

Commit

Permalink
fix: Always fetch emails when QUERY_EMAILS is set
Browse files Browse the repository at this point in the history
  • Loading branch information
mecampbellsoup committed Aug 15, 2024
1 parent d6e07b2 commit aa89da5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion allauth/socialaccount/providers/github/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ def complete_login(self, request, app, token, **kwargs):
)
resp.raise_for_status()
extra_data = resp.json()
if app_settings.QUERY_EMAIL and not extra_data.get("email"):
if app_settings.QUERY_EMAIL:
emails = self.get_emails(headers)
if emails:
if email := extra_data.get("email"):
emails = [e for e in emails if e["email"] == email]
extra_data["emails"] = emails
return self.get_provider().sociallogin_from_response(request, extra_data)

Expand Down

0 comments on commit aa89da5

Please sign in to comment.