Ticket #9541: 9541-r9368-wider-choice-of-username.diff
File 9541-r9368-wider-choice-of-username.diff, 3.4 KB (added by , 16 years ago) |
---|
-
django/contrib/auth/models.py
124 124 125 125 Username and password are required. Other fields are optional. 126 126 """ 127 username = models.CharField(_('username'), max_length=3 0, unique=True, help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."))127 username = models.CharField(_('username'), max_length=36, unique=True, help_text=_("Required. 36 characters or fewer. Alphanumeric characters only (letters, digits, underscores and hyphens).")) 128 128 first_name = models.CharField(_('first name'), max_length=30, blank=True) 129 129 last_name = models.CharField(_('last name'), max_length=30, blank=True) 130 130 email = models.EmailField(_('e-mail address'), blank=True) -
django/contrib/auth/forms.py
11 11 """ 12 12 A form that creates a user, with no privileges, from the given username and password. 13 13 """ 14 username = forms.RegexField(label=_("Username"), max_length=3 0, regex=r'^\w+$',15 help_text = _("Required. 3 0 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),16 error_message = _("This value must contain only letters, numbers and underscores."))14 username = forms.RegexField(label=_("Username"), max_length=36, regex=r'^[\w-]+$', 15 help_text = _("Required. 36 characters or fewer. Alphanumeric characters only (letters, digits, underscores and hyphens)."), 16 error_message = _("This value must contain only letters, numbers, underscores and hyphens.")) 17 17 password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput) 18 18 password2 = forms.CharField(label=_("Password confirmation"), widget=forms.PasswordInput) 19 19 … … 44 44 return user 45 45 46 46 class UserChangeForm(forms.ModelForm): 47 username = forms.RegexField(label=_("Username"), max_length=3 0, regex=r'^\w+$',48 help_text = _("Required. 3 0 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),49 error_message = _("This value must contain only letters, numbers and underscores."))47 username = forms.RegexField(label=_("Username"), max_length=36, regex=r'^[\w-]+$', 48 help_text = _("Required. 36 characters or fewer. Alphanumeric characters only (letters, digits, underscores and hyphens)."), 49 error_message = _("This value must contain only letters, numbers, underscores and hyphens.")) 50 50 51 51 class Meta: 52 52 model = User … … 56 56 Base class for authenticating users. Extend this to get a form that accepts 57 57 username/password logins. 58 58 """ 59 username = forms.CharField(label=_("Username"), max_length=30) 59 username = forms.RegexField(label=_("Username"), max_length=36, regex=r'^[\w-]+$', 60 help_text = _("Required. 36 characters or fewer. Alphanumeric characters only (letters, digits, underscores and hyphens)."), 61 error_message = _("This value must contain only letters, numbers, underscores and hyphens.")) 60 62 password = forms.CharField(label=_("Password"), widget=forms.PasswordInput) 61 63 62 64 def __init__(self, request=None, *args, **kwargs):