Code

Ticket #11676: username_regex_patch.diff

File username_regex_patch.diff, 1.2 KB (added by fterrier, 5 years ago)
Line 
1Index: django/contrib/auth/forms.py
2===================================================================
3--- django/contrib/auth/forms.py        (revision 11428)
4+++ django/contrib/auth/forms.py        (working copy)
5@@ -11,7 +11,7 @@
6     """
7     A form that creates a user, with no privileges, from the given username and password.
8     """
9-    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
10+    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\S+$',
11         help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
12         error_message = _("This value must contain only letters, numbers and underscores."))
13     password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
14@@ -44,7 +44,7 @@
15         return user
16 
17 class UserChangeForm(forms.ModelForm):
18-    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
19+    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\S+$',
20         help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
21         error_message = _("This value must contain only letters, numbers and underscores."))
22