Skip to content
This repository has been archived by the owner on Oct 22, 2019. It is now read-only.

Added USERENA_USERNAME_MIN_LENGTH and USERENA_PASSWORD_MIN_LENGTH options #526

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions userena/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')})
Expand All @@ -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):
"""
Expand Down
4 changes: 4 additions & 0 deletions userena/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)