diff options
Diffstat (limited to 'django/contrib/auth/forms.py')
| -rw-r--r-- | django/contrib/auth/forms.py | 12 |
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 |
