Commit 4228f39b authored by Michal Čihař's avatar Michal Čihař

Allow usernames four characters long

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 825f33bf
...@@ -83,9 +83,9 @@ class NoStripEmailField(forms.EmailField): ...@@ -83,9 +83,9 @@ class NoStripEmailField(forms.EmailField):
class UsernameField(forms.RegexField): class UsernameField(forms.RegexField):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
kwargs['max_length'] = 30 kwargs['max_length'] = 30
kwargs['min_length'] = 5 kwargs['min_length'] = 4
kwargs['regex'] = r'^[\w.@+-]+$' kwargs['regex'] = r'^[\w.@+-]+$'
kwargs['help_text'] = _('At least five characters long.') kwargs['help_text'] = _('At least four characters long.')
kwargs['label'] = _('Username') kwargs['label'] = _('Username')
kwargs['error_messages'] = { kwargs['error_messages'] = {
'invalid': _( 'invalid': _(
...@@ -100,7 +100,7 @@ class UsernameField(forms.RegexField): ...@@ -100,7 +100,7 @@ class UsernameField(forms.RegexField):
def clean(self, value): def clean(self, value):
''' '''
Username validation, requires length of five chars and unique. Username validation, requires unique name.
''' '''
if value is not None: if value is not None:
existing = User.objects.filter( existing = User.objects.filter(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment