From 235b650ab6a34dd6c54b40081687271768c2c3e5 Mon Sep 17 00:00:00 2001 From: Yuhuai Liu Date: Wed, 17 Apr 2024 14:23:16 -0400 Subject: [PATCH] add return {} --- website/oauth/views.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/website/oauth/views.py b/website/oauth/views.py index 5396a8c48e1..3367047e99f 100644 --- a/website/oauth/views.py +++ b/website/oauth/views.py @@ -52,19 +52,20 @@ def oauth_connect(service_name, auth): def oauth_callback(service_name, auth): if waffle.flag_is_active(request, features.ENABLE_GV): _forward_to_addon_service() - else: - user = auth.user - provider = get_service(service_name) + return {} - # Retrieve permanent credentials from provider - if not provider.auth_callback(user=user): - return {} + user = auth.user + provider = get_service(service_name) + + # Retrieve permanent credentials from provider + if not provider.auth_callback(user=user): + return {} - if provider.account and not user.external_accounts.filter(id=provider.account.id).exists(): - user.external_accounts.add(provider.account) - user.save() + if provider.account and not user.external_accounts.filter(id=provider.account.id).exists(): + user.external_accounts.add(provider.account) + user.save() - oauth_complete.send(provider, account=provider.account, user=user) + oauth_complete.send(provider, account=provider.account, user=user) return {}