Ticket #5786: django-auth-username-characters-round2.patch
File django-auth-username-characters-round2.patch, 2.5 KB (added by , 15 years ago) |
---|
-
models.py
125 125 126 126 Username and password are required. Other fields are optional. 127 127 """ 128 username = models.CharField(_('username'), max_length=30, unique=True, help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."))128 username = models.CharField(_('username'), max_length=30, unique=True, help_text=_("Required. 30 characters or fewer. Letters, numbers and @/./+/-/_ characters")) 129 129 first_name = models.CharField(_('first name'), max_length=30, blank=True) 130 130 last_name = models.CharField(_('last name'), max_length=30, blank=True) 131 131 email = models.EmailField(_('e-mail address'), blank=True) -
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=30, regex=r'^ \w+$',15 help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),16 error_message = _("This value m ust contain only letters, numbers and underscores."))14 username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', 15 help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), 16 error_message = _("This value may contain only letters, numbers and @/./+/-/_ characters.")) 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=30, regex=r'^ \w+$',48 help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),49 error_message = _("This value m ust contain only letters, numbers and underscores."))47 username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$', 48 help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."), 49 error_message = _("This value may contain only letters, numbers and @/./+/-/_ characters.")) 50 50 51 51 class Meta: 52 52 model = User