Disallow + in usernames.

master
Tom Hacohen 4 years ago
parent a7268443ca
commit 3d6ba634ce

@ -7,10 +7,10 @@ from django.utils.translation import gettext_lazy as _
@deconstructible
class UnicodeUsernameValidator(validators.RegexValidator):
regex = r'^[\w.+-]+\Z'
regex = r'^[\w.-]+\Z'
message = _(
'Enter a valid username. This value may contain only letters, '
'numbers, and ./+/-/_ characters.'
'numbers, and ./-/_ characters.'
)
flags = 0
@ -29,7 +29,7 @@ class User(AbstractUser):
_('username'),
max_length=150,
unique=True,
help_text=_('Required. 150 characters or fewer. Letters, digits and ./+/-/_ only.'),
help_text=_('Required. 150 characters or fewer. Letters, digits and ./-/_ only.'),
validators=[username_validator],
error_messages={
'unique': _("A user with that username already exists."),

Loading…
Cancel
Save