From c8015052d935a99a5c8f96434b2d0cd16d8a4e14 Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Mon, 1 Mar 2010 19:49:05 +0000 Subject: Fixed #5786: relaxed the validation for usernames to allow more common characters '@', etc. This is really just a stop-gap until we come up with a improved way of handling disparate auth data, but it should help us stretch a bit more milage out of the current system. Thanks to alextreme, lbruno, and clayg. git-svn-id: http://code.djangoproject.com/svn/django/trunk@12634 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/auth/forms.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'django/contrib/auth/forms.py') diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index 74b0f2ba8e..5ffbc8207c 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -11,9 +11,9 @@ class UserCreationForm(forms.ModelForm): """ A form that creates a user, with no privileges, from the given username and password. """ - username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$', - help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."), - error_message = _("This value must contain only letters, numbers and underscores.")) + username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', + help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), + error_message = _("This value may contain only letters, numbers and @/./+/-/_ characters.")) password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput) password2 = forms.CharField(label=_("Password confirmation"), widget=forms.PasswordInput, help_text = _("Enter the same password as above, for verification.")) @@ -45,9 +45,9 @@ class UserCreationForm(forms.ModelForm): return user class UserChangeForm(forms.ModelForm): - username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$', - help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."), - error_message = _("This value must contain only letters, numbers and underscores.")) + username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', + help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), + error_message = _("This value may contain only letters, numbers and @/./+/-/_ characters.")) class Meta: model = User -- cgit v1.3