diff --git a/.env.sample b/.env.sample index a6d5a9b..742d693 100644 --- a/.env.sample +++ b/.env.sample @@ -53,13 +53,13 @@ DEFAULT_LANGUAGE=en # Geometric settings DEFAULT_SRID=2056 -# Registration disabled by default -REGISTRATION_ENABLED = False +# Registration enabled by default +REGISTRATION_ENABLED=True # OIDC parameters -OIDC_ENABLED = False +OIDC_ENABLED=False OIDC_OP_BASE_URL="please set oidc op base url" ZITADEL_PROJECT="set_zitadel_project" OIDC_RP_CLIENT_ID="set oidc rp client id" OIDC_RP_CLIENT_SECRET="set oidc rp client secret" -OIDC_PRIVATE_KEYFILE="keyfile" \ No newline at end of file +OIDC_PRIVATE_KEYFILE="keyfile" diff --git a/default_settings.py b/default_settings.py index db4bc7b..c1ad6fe 100644 --- a/default_settings.py +++ b/default_settings.py @@ -283,8 +283,8 @@ } FEATURE_FLAGS = { - "oidc": os.environ.get("OIDC_ENABLED", "False") == "False", - "registration": os.environ.get("REGISTRATION_ENABLED", "False") == "False", + "oidc": os.environ.get("OIDC_ENABLED", "False") == "True", + "registration": os.environ.get("REGISTRATION_ENABLED", "True") == "True", } AUTHENTICATION_BACKENDS = ("django.contrib.auth.backends.ModelBackend",) @@ -313,7 +313,7 @@ def discover_endpoints(discovery_url: str) -> dict: def check_oidc() -> bool: - if FEATURE_FLAGS['oidc']: + if not FEATURE_FLAGS['oidc']: return False missing = [] for x in ["OIDC_RP_CLIENT_ID", "ZITADEL_PROJECT", "OIDC_OP_BASE_URL", "OIDC_PRIVATE_KEYFILE"]: diff --git a/oidc.py b/oidc.py index 11d6c0a..acd6567 100644 --- a/oidc.py +++ b/oidc.py @@ -15,7 +15,7 @@ UserModel = get_user_model() def status(request): - return {"OIDC_ENABLED": settings.OIDC_ENABLED} + return {"OIDC_ENABLED": settings.FEATURE_FLAGS["oidc"]} def _updateUser(user, claims): diff --git a/urls.py b/urls.py index 52610ca..affe7ee 100644 --- a/urls.py +++ b/urls.py @@ -106,4 +106,4 @@ router.register_additional_route_to_root(f'{ROOTURL}auth/register', 'auth_register') urlpatterns += [ path(f'{ROOTURL}auth/register/', views.RegisterView.as_view(), name='auth_register'), - ] \ No newline at end of file + ]