diff --git a/InvenTree/InvenTree/forms.py b/InvenTree/InvenTree/forms.py index beec4cc758..b6905fd85a 100644 --- a/InvenTree/InvenTree/forms.py +++ b/InvenTree/InvenTree/forms.py @@ -231,8 +231,12 @@ class CustomSignupForm(SignupForm): ), ) - # reorder fields - set_form_field_order(self, ["username", "email", "email2", "password1", "password2", ]) + # check for two password fields + if not InvenTreeSetting.get_setting('LOGIN_SIGNUP_PWD_TWICE'): + self.fields.pop("password2") + + # reorder fields + set_form_field_order(self, ["username", "email", "email2", "password1", "password2", ]) def clean(self): cleaned_data = super().clean() diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index c04b550e34..20f1bfbf19 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -664,7 +664,6 @@ for app in SOCIAL_BACKENDS: # settings for allauth ACCOUNT_LOGOUT_ON_PASSWORD_CHANGE = True - # override forms / adapters ACCOUNT_FORMS = { 'login': 'allauth.account.forms.LoginForm', diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index 21e2d37c7f..8e36624ad7 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -864,6 +864,12 @@ class InvenTreeSetting(BaseInvenTreeSetting): 'default': False, 'validator': bool, }, + 'LOGIN_SIGNUP_PWD_TWICE': { + 'name': _('Password twice'), + 'description': _('On signup ask users twice for their password'), + 'default': True, + 'validator': bool, + }, } class Meta: diff --git a/InvenTree/templates/InvenTree/settings/login.html b/InvenTree/templates/InvenTree/settings/login.html index bcc2f16767..289f87a3c9 100644 --- a/InvenTree/templates/InvenTree/settings/login.html +++ b/InvenTree/templates/InvenTree/settings/login.html @@ -23,6 +23,7 @@