1
0
mirror of https://github.com/etesync/server synced 2024-11-22 08:48:07 +00:00

Disallow + in usernames.

This commit is contained in:
Tom Hacohen 2020-07-16 10:40:30 +03:00
parent a7268443ca
commit 3d6ba634ce

View File

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