datatracker/django/django-changeset-12634.patch
2010-07-21 12:48:05 +00:00

77 lines
3.7 KiB
Diff

Index: django/contrib/auth/tests/forms.py
===================================================================
--- django/contrib/auth/tests/forms.py (revision 9906)
+++ django/contrib/auth/tests/forms.py (revision 12634)
@@ -22,5 +22,5 @@
>>> data = {
-... 'username': 'jsmith@example.com',
+... 'username': 'jsmith!',
... 'password1': 'test123',
... 'password2': 'test123',
@@ -30,5 +30,5 @@
False
>>> form["username"].errors
-[u'This value must contain only letters, numbers and underscores.']
+[u'This value may contain only letters, numbers and @/./+/-/_ characters.']
# The verification password is incorrect.
@@ -66,5 +66,5 @@
>>> data = {
-... 'username': 'jsmith2',
+... 'username': 'jsmith2@example.com',
... 'password1': 'test123',
... 'password2': 'test123',
@@ -74,5 +74,5 @@
True
>>> form.save()
-<User: jsmith2>
+<User: jsmith2@example.com>
# The user submits an invalid username.
@@ -190,5 +190,5 @@
False
>>> form['username'].errors
-[u'This value must contain only letters, numbers and underscores.']
+[u'This value may contain only letters, numbers and @/./+/-/_ characters.']
Index: django/contrib/auth/models.py
===================================================================
--- django/contrib/auth/models.py (revision 12506)
+++ django/contrib/auth/models.py (revision 12634)
@@ -178,5 +178,5 @@
Username and password are required. Other fields are optional.
"""
- username = models.CharField(_('username'), max_length=30, unique=True, help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."))
+ username = models.CharField(_('username'), max_length=30, unique=True, help_text=_("Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters"))
first_name = models.CharField(_('first name'), max_length=30, blank=True)
last_name = models.CharField(_('last name'), max_length=30, blank=True)
Index: django/contrib/auth/forms.py
===================================================================
--- django/contrib/auth/forms.py (revision 12218)
+++ django/contrib/auth/forms.py (revision 12634)
@@ -12,7 +12,7 @@
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,
@@ -46,7 +46,7 @@
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: