fix(SSO): log error message when EMAIL_HOST is empty (#6067)

fixes #4553
This commit is contained in:
Philipp Fruck 2023-12-10 20:49:50 +00:00 committed by GitHub
parent 676a97b709
commit b59cf0f4a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: