mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user