Skip to content

Commit

Permalink
django: allow '/' character in usernames
Browse files Browse the repository at this point in the history
All worker usernames use the `worker/hostname` format which did not match
the regular expression in the corresponding field validator.  Therefore,
worker user profiles could not be directly edited in the Django Admin.

Resolves: openscanhub/openscanhub#185
  • Loading branch information
lzaoral committed Nov 15, 2023
1 parent 424b279 commit 7717746
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kobo/django/auth/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."),
Expand Down

0 comments on commit 7717746

Please sign in to comment.