diff --git a/kobo/django/auth/migrations/0003_alter_user_username.py b/kobo/django/auth/migrations/0003_alter_user_username.py new file mode 100644 index 00000000..b95f2ffe --- /dev/null +++ b/kobo/django/auth/migrations/0003_alter_user_username.py @@ -0,0 +1,19 @@ +# Generated by Django 3.2.20 on 2023-11-16 11:30 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('kobo_auth', '0002_auto_20220203_1511'), + ] + + operations = [ + migrations.AlterField( + model_name='user', + name='username', + field=models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 255 characters or fewer. Letters, digits and @.+-_/ only.', max_length=255, unique=True, validators=[django.core.validators.RegexValidator('^[\\w.@+\\-/]+$', 'Enter a valid username. This value may contain only letters, numbers and @.+-_/ characters.', 'invalid')], verbose_name='username'), + ), + ] diff --git a/kobo/django/auth/models.py b/kobo/django/auth/models.py index aa4d05ca..01b12d0a 100644 --- a/kobo/django/auth/models.py +++ b/kobo/django/auth/models.py @@ -18,12 +18,12 @@ class User(AbstractBaseUser, PermissionsMixin): Username, password and email are required. Other fields are optional. """ username = models.CharField(_('username'), max_length=MAX_LENGTH, unique=True, - help_text=_('Required. %s characters or fewer. Letters, digits and @/./+/-/_ only.' % MAX_LENGTH), + help_text=_('Required. %s characters or fewer. Letters, digits and @.+-_/ only.' % MAX_LENGTH), validators=[ - validators.RegexValidator(r'^[\w.@+-]+$', + validators.RegexValidator(r'^[\w.@+\-/]+$', _('Enter a valid username. ' 'This value may contain only letters, numbers ' - 'and @/./+/-/_ characters.'), 'invalid'), + 'and @.+-_/ characters.'), 'invalid'), ], error_messages={ 'unique': _("A user with that username already exists."),