Skip to content

Commit

Permalink
Configure project to conditionally use the new app based on environme…
Browse files Browse the repository at this point in the history
…nt configured
  • Loading branch information
ababic committed May 27, 2022
1 parent 3586e6c commit 86c70ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,15 @@
"allauth.account.auth_backends.AuthenticationBackend",
]

WSGI_APPLICATION = "config.wsgi.application"

# django-allauth configuration
ACCOUNT_AUTHENTICATION_METHOD = "email"
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_LOGOUT_ON_GET = False # Bypass logout confirmation form
ACCOUNT_USERNAME_REQUIRED = False # Register using email only
ACCOUNT_SESSION_REMEMBER = False # True|False disables "Remember me?" checkbox"
AUTH_URLS = "allauth.urls"
LOGIN_URL = "/accounts/login"
LOGIN_REDIRECT_URL = "/"
WAGTAIL_FRONTEND_LOGIN_URL = LOGIN_URL
Expand All @@ -135,7 +138,17 @@
ACCOUNT_ADAPTER = "etna.users.adapters.NoSelfSignupAccountAdapter"
ACCOUNT_FORMS = {"login": "etna.users.forms.EtnaLoginForm"}

WSGI_APPLICATION = "config.wsgi.application"
# Auth0 configuration
AUTH0_DOMAIN = os.getenv("AUTH0_DOMAIN")
AUTH0_CLIENT_ID = os.getenv("AUTH0_CLIENT_ID")
AUTH0_CLIENT_SECRET = os.getenv("AUTH0_CLIENT_SECRET")
if AUTH0_DOMAIN:
AUTH_URLS = "etna.auth0.urls"
INSTALLED_APPS.insert(0, "etna.auth0")
AUTHENTICATION_BACKENDS.append("etna.auth0.auth_backend.Auth0Backend")
TERMINATE_SSO_SESSION_ON_LOGOUT = strtobool(
os.getenv("TERMINATE_SSO_SESSION_ON_LOGOUT", "False")
)

# Logging
# https://docs.djangoproject.com/en/3.2/topics/logging/
Expand Down
2 changes: 1 addition & 1 deletion config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ def trigger_error(request):
private_urls = [
path("django-admin/", admin.site.urls),
path("admin/", include(wagtailadmin_urls)),
path("accounts/", include("allauth.urls")),
path("documents/", include(wagtaildocs_urls)),
path("accounts/", include(settings.AUTH_URLS)),
]

if settings.SENTRY_DEBUG_URL_ENABLED:
Expand Down

0 comments on commit 86c70ce

Please sign in to comment.