From b59cf0f4a463777939b1fc8ac2d4f0677788679c Mon Sep 17 00:00:00 2001 From: Philipp Fruck Date: Sun, 10 Dec 2023 20:49:50 +0000 Subject: [PATCH] fix(SSO): log error message when EMAIL_HOST is empty (#6067) fixes #4553 --- InvenTree/InvenTree/forms.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index 4896dc75b8..b3ca485fd9 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -228,7 +228,12 @@ class CustomSignupForm(SignupForm): def registration_enabled(): """Determine whether user registration is enabled.""" - return settings.EMAIL_HOST and (InvenTreeSetting.get_setting('LOGIN_ENABLE_REG') or InvenTreeSetting.get_setting('LOGIN_ENABLE_SSO_REG')) + if InvenTreeSetting.get_setting('LOGIN_ENABLE_REG') or InvenTreeSetting.get_setting('LOGIN_ENABLE_SSO_REG'): + if settings.EMAIL_HOST: + return True + else: + logger.error("Registration cannot be enabled, because EMAIL_HOST is not configured.") + return False class RegistratonMixin: