From 2751b36f8ca2a47760398183747031a7cc70deec Mon Sep 17 00:00:00 2001 From: pedro Date: Wed, 8 Jan 2025 22:34:34 +0100 Subject: [PATCH] add env var ENABLE_DOMAIN_CHECKER when using localhost and standalone idhub instance we could avoid this checker to facilitate testing and deployment --- idhub/mixins.py | 4 ++-- trustchain_idhub/settings.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/idhub/mixins.py b/idhub/mixins.py index 055f867..ab7cafa 100644 --- a/idhub/mixins.py +++ b/idhub/mixins.py @@ -33,7 +33,7 @@ class UserView(LoginRequiredMixin): ] def get(self, request, *args, **kwargs): - if not settings.DEVELOPMENT: + if settings.ENABLE_DOMAIN_CHECKER: err_txt = "User domain is {} which does not match server domain {}".format( request.get_host(), settings.DOMAIN ) @@ -56,7 +56,7 @@ class UserView(LoginRequiredMixin): return url or response def post(self, request, *args, **kwargs): - if not settings.DEVELOPMENT: + if settings.ENABLE_DOMAIN_CHECKER: err_txt = "User domain is {} which does not match server domain {}".format( request.get_host(), settings.DOMAIN ) diff --git a/trustchain_idhub/settings.py b/trustchain_idhub/settings.py index 7610a49..01da39c 100644 --- a/trustchain_idhub/settings.py +++ b/trustchain_idhub/settings.py @@ -241,5 +241,6 @@ OIDC_ORGS = config('OIDC_ORGS', '') ENABLE_EMAIL = config('ENABLE_EMAIL', default=True, cast=bool) CREATE_TEST_USERS = config('CREATE_TEST_USERS', default=False, cast=bool) ENABLE_2FACTOR_AUTH = config('ENABLE_2FACTOR_AUTH', default=True, cast=bool) +ENABLE_DOMAIN_CHECKER = config('ENABLE_DOMAIN_CHECKER', default=True, cast=bool) COMMIT = config('COMMIT', default='')