summaryrefslogtreecommitdiff
path: root/django/contrib/auth/forms.py
diff options
context:
space:
mode:
authorJacob Kaplan-Moss <jacob@jacobian.org>2010-03-01 19:49:05 +0000
committerJacob Kaplan-Moss <jacob@jacobian.org>2010-03-01 19:49:05 +0000
commitc8015052d935a99a5c8f96434b2d0cd16d8a4e14 (patch)
tree19c5154c8e84cfafa0781d11fd0b8a187648fd43 /django/contrib/auth/forms.py
parent647651698fb84d864f911db15503f77acdd0cbf0 (diff)
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
Diffstat (limited to 'django/contrib/auth/forms.py')
-rw-r--r--django/contrib/auth/forms.py12
1 files changed, 6 insertions, 6 deletions
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