setting for two password fields on signup

This commit is contained in:
Matthias 2021-09-07 07:37:28 +02:00
parent af286766ea
commit 53de59f84b
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
4 changed files with 13 additions and 3 deletions

View File

@ -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()

View File

@ -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',

View File

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

View File

@ -23,6 +23,7 @@
<td colspan='4'></td>
</tr>
{% include "InvenTree/settings/setting.html" with key="LOGIN_SIGNUP_MAIL_TWICE" icon="fa-info-circle" %}
{% include "InvenTree/settings/setting.html" with key="LOGIN_SIGNUP_PWD_TWICE" icon="fa-info-circle" %}
{% include "InvenTree/settings/setting.html" with key="LOGIN_SIGNUP_SSO_AUTO" icon="fa-info-circle" %}
</tbody>
</table>