Skip to content

Commit 56b8f3e

Browse files
committed
Update forms and helptexts associated with user.username admin to consistently show our tweaked length of 64 characters.
- Legacy-Id: 4156
1 parent 896c127 commit 56b8f3e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

django/contrib/auth/forms.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class UserCreationForm(forms.ModelForm):
1111
"""
1212
A form that creates a user, with no privileges, from the given username and password.
1313
"""
14-
username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
15-
help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
14+
username = forms.RegexField(label=_("Username"), max_length=64, regex=r'^[\w.@+-]+$',
15+
help_text = _("Required. 64 characters or fewer. Letters, digits and @/./+/-/_ only."),
1616
error_messages = {'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")})
1717
password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
1818
password2 = forms.CharField(label=_("Password confirmation"), widget=forms.PasswordInput,
@@ -45,8 +45,8 @@ def save(self, commit=True):
4545
return user
4646

4747
class UserChangeForm(forms.ModelForm):
48-
username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
49-
help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
48+
username = forms.RegexField(label=_("Username"), max_length=64, regex=r'^[\w.@+-]+$',
49+
help_text = _("Required. 64 characters or fewer. Letters, digits and @/./+/-/_ only."),
5050
error_messages = {'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")})
5151

5252
class Meta:
@@ -63,7 +63,7 @@ class AuthenticationForm(forms.Form):
6363
Base class for authenticating users. Extend this to get a form that accepts
6464
username/password logins.
6565
"""
66-
username = forms.CharField(label=_("Username"), max_length=30)
66+
username = forms.CharField(label=_("Username"), max_length=64)
6767
password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
6868

6969
def __init__(self, request=None, *args, **kwargs):

django/contrib/auth/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ class User(models.Model):
189189
190190
Username and password are required. Other fields are optional.
191191
"""
192-
username = models.CharField(_('username'), max_length=64, unique=True, help_text=_("Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters"))
192+
username = models.CharField(_('username'), max_length=64, unique=True, help_text=_("Required. 64 characters or fewer. Letters, numbers and @/./+/-/_ characters"))
193193
first_name = models.CharField(_('first name'), max_length=30, blank=True)
194194
last_name = models.CharField(_('last name'), max_length=30, blank=True)
195195
email = models.EmailField(_('e-mail address'), blank=True)

0 commit comments

Comments
 (0)