From 3d6ba634ce6e4b291ae138345a81625e9759aaf6 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 16 Jul 2020 10:40:30 +0300 Subject: [PATCH] Disallow + in usernames. --- myauth/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/myauth/models.py b/myauth/models.py index 4046b2f..611555b 100644 --- a/myauth/models.py +++ b/myauth/models.py @@ -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."),