Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt user to select google account and auto-link social accounts #1558

Merged
merged 2 commits into from
Dec 19, 2024
Merged
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
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
Loading