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

Commit

Permalink
Added USERENA_USERNAME_MIN_LENGTH and USERENA_PASSWORD_MIN_LENGTH opt…
Browse files Browse the repository at this point in the history
…ions.
  • Loading branch information
gsfakianakis committed May 22, 2016
1 parent 6cc0954 commit ae4a8ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
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)

0 comments on commit ae4a8ca

Please sign in to comment.