diff --git a/userena/forms.py b/userena/forms.py index dff9c0bf..9c931cdf 100644 --- a/userena/forms.py +++ b/userena/forms.py @@ -32,6 +32,7 @@ class SignupForm(forms.Form): """ username = forms.RegexField(regex=USERNAME_RE, max_length=30, + min_length = userena_settings.USERENA_USERNAME_MIN_LENGTH, widget=forms.TextInput(attrs=attrs_dict), label=_("Username"), error_messages={'invalid': _('Username must contain only letters, numbers, dots and underscores.')}) @@ -40,10 +41,12 @@ class SignupForm(forms.Form): label=_("Email")) password1 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False), - label=_("Create password")) + label=_("Create password"), + min_length = userena_settings.USERENA_PASSWORD_MIN_LENGTH) password2 = forms.CharField(widget=forms.PasswordInput(attrs=attrs_dict, render_value=False), - label=_("Repeat password")) + label=_("Repeat password"), + min_length = userena_settings.USERENA_PASSWORD_MIN_LENGTH) def clean_username(self): """ diff --git a/userena/settings.py b/userena/settings.py index fb778b79..64e2cc49 100644 --- a/userena/settings.py +++ b/userena/settings.py @@ -120,3 +120,7 @@ USERENA_REGISTER_PROFILE = getattr(settings, 'USERENA_REGISTER_PROFILE', True) USERENA_REGISTER_USER = getattr(settings, 'USERENA_REGISTER_USER', True) + +USERENA_USERNAME_MIN_LENGTH = getattr(settings, 'USERENA_USERNAME_MIN_LENGTH', 1) + +USERENA_PASSWORD_MIN_LENGTH = getattr(settings, 'USERENA_PASSWORD_MIN_LENGTH', 1) \ No newline at end of file