diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py index ee09a626a..711dba529 100644 --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -11,8 +11,8 @@ 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. Letters, digits and @/./+/-/_ only."), + username = forms.RegexField(label=_("Username"), max_length=64, regex=r'^[\w.@+-]+$', + help_text = _("Required. 64 characters or fewer. Letters, digits and @/./+/-/_ only."), error_messages = {'invalid': _("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, @@ -45,8 +45,8 @@ 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. Letters, digits and @/./+/-/_ only."), + username = forms.RegexField(label=_("Username"), max_length=64, regex=r'^[\w.@+-]+$', + help_text = _("Required. 64 characters or fewer. Letters, digits and @/./+/-/_ only."), error_messages = {'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")}) class Meta: @@ -63,7 +63,7 @@ class AuthenticationForm(forms.Form): Base class for authenticating users. Extend this to get a form that accepts username/password logins. """ - username = forms.CharField(label=_("Username"), max_length=30) + username = forms.CharField(label=_("Username"), max_length=64) password = forms.CharField(label=_("Password"), widget=forms.PasswordInput) def __init__(self, request=None, *args, **kwargs): diff --git a/django/contrib/auth/models.py b/django/contrib/auth/models.py index ed5349453..e3e947700 100644 --- a/django/contrib/auth/models.py +++ b/django/contrib/auth/models.py @@ -189,7 +189,7 @@ class User(models.Model): Username and password are required. Other fields are optional. """ - username = models.CharField(_('username'), max_length=64, unique=True, help_text=_("Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters")) + username = models.CharField(_('username'), max_length=64, unique=True, help_text=_("Required. 64 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) email = models.EmailField(_('e-mail address'), blank=True)