diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index 2a65cc2e1d..7078448d56 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -210,8 +210,11 @@ class RegistratonMixin: """Mixin to check if registration should be enabled.""" def is_open_for_signup(self, request, *args, **kwargs): - """Check if signup is enabled in settings.""" - if settings.EMAIL_HOST and InvenTreeSetting.get_setting('LOGIN_ENABLE_REG', True): + """Check if signup is enabled in settings. + + Configure the class variable `REGISTRATION_SETTING` to set which setting should be used, defualt: `LOGIN_ENABLE_REG`. + """ + if settings.EMAIL_HOST and (InvenTreeSetting.get_setting('LOGIN_ENABLE_REG') or InvenTreeSetting.get_setting('LOGIN_ENABLE_SSO_REG')): return super().is_open_for_signup(request, *args, **kwargs) return False diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index fa77c35522..28b8322727 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -1375,6 +1375,13 @@ class InvenTreeSetting(BaseInvenTreeSetting): 'validator': bool, }, + 'LOGIN_ENABLE_SSO_REG': { + 'name': _('Enable SSO registration'), + 'description': _('Enable self-registration via SSO for users on the login pages'), + 'default': False, + 'validator': bool, + }, + 'LOGIN_MAIL_REQUIRED': { 'name': _('Email required'), 'description': _('Require user to supply mail on signup'), diff --git a/InvenTree/templates/InvenTree/settings/login.html b/InvenTree/templates/InvenTree/settings/login.html index d9b11eb692..9710a9eec5 100644 --- a/InvenTree/templates/InvenTree/settings/login.html +++ b/InvenTree/templates/InvenTree/settings/login.html @@ -27,6 +27,7 @@
{% trans "This function is currently disabled. Please contact an administrator." %}