Skip to content

Commit

Permalink
Prompt user to select google account and auto-link social accounts (b…
Browse files Browse the repository at this point in the history
  • Loading branch information
GregKaleka authored and rbbeeston committed Dec 23, 2024
1 parent 54f9d5d commit 5587a4d
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env.bool("DJANGO_DEBUG", default=False)

# Whether or not we're in local development mode
LOCAL_DEVELOPMENT = env.bool("LOCAL_DEVELOPMENT", default=False)
CI = env.bool("CI", default=False)

if DEBUG:
root = logging.getLogger()
root.setLevel(logging.INFO)
Expand All @@ -33,6 +29,15 @@

env.log_level("LOG_LEVEL", default="DEBUG")

# Whether or not we're in local development mode
LOCAL_DEVELOPMENT = env.bool("LOCAL_DEVELOPMENT", default=False)
CI = env.bool("CI", default=False)

if CI or LOCAL_DEVELOPMENT:
# This is the default value for the development environment.
# This enables the tests to run.
SITE_ID = 1

# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = Path(__file__).parent.parent
APPS_DIR = BASE_DIR.joinpath("config")
Expand Down Expand Up @@ -342,11 +347,8 @@
SOCIALACCOUNT_QUERY_EMAIL = True
SOCIALACCOUNT_LOGIN_ON_GET = True
ACCOUNT_UNIQUE_EMAIL = True

if CI or LOCAL_DEVELOPMENT:
# This is the default value for the development environment.
# This enables the tests to run.
SITE_ID = 1
SOCIALACCOUNT_EMAIL_AUTHENTICATION = True
SOCIALACCOUNT_EMAIL_AUTHENTICATION_AUTO_CONNECT = True

# Allow us to override some of allauth's forms
ACCOUNT_FORMS = {
Expand All @@ -361,6 +363,7 @@
],
"AUTH_PARAMS": {
"access_type": "online",
"prompt": "select_account",
},
"OAUTH_PKCE_ENABLED": True,
},
Expand All @@ -385,14 +388,12 @@
if not google_oauth_client_id or not google_oauth_secret:
logging.warning("Google OAuth credentials not set")
else:
SOCIALACCOUNT_PROVIDERS["google"] = {
"APPS": [
{
"client_id": google_oauth_client_id,
"secret": google_oauth_secret,
}
]
}
SOCIALACCOUNT_PROVIDERS["google"]["APPS"] = [
{
"client_id": google_oauth_client_id,
"secret": google_oauth_secret,
},
]


# Allow Allauth to use HTTPS when deployed but HTTP for local dev
Expand Down

0 comments on commit 5587a4d

Please sign in to comment.