Ticket #11676: username_regex_patch.diff

File username_regex_patch.diff, 1.2 KB (added by fterrier, 6 years ago)
  • django/contrib/auth/forms.py

     
    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+$',
     14    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\S+$',
    1515        help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
    1616        error_message = _("This value must contain only letters, numbers and underscores."))
    1717    password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
     
    4444        return user
    4545
    4646class UserChangeForm(forms.ModelForm):
    47     username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\w+$',
     47    username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^\S+$',
    4848        help_text = _("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores)."),
    4949        error_message = _("This value must contain only letters, numbers and underscores."))
    5050   
Back to Top