Skip to content

New user creation silently fails on username bad regex match

Quick Information

  • Operating System: Linux
  • Install Type: Docker

What Happened?

Trying to create a user that container capital letters causes creation to silently fail without any UI feedback. Opening the developer console shows the add request returned a 500 error with the following content:

Traceback (most recent call last):
  File "/crafty/app/classes/web/routes/api/users/index.py", line 90, in post
    validate(data, new_user_schema)
  File "/crafty/.venv/lib/python3.10/site-packages/jsonschema/validators.py", line 1307, in validate
    raise error
jsonschema.exceptions.ValidationError: 'DJKade' does not match '^[a-z0-9_]+$'

Failed validating 'pattern' in schema['properties']['username']:
    {'examples': ['admin'],
     'maxLength': 20,
     'minLength': 4,
     'pattern': '^[a-z0-9_]+$',
     'title': 'Username',
     'type': 'string'}

On instance['username']:
    'DJKade'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/crafty/.venv/lib/python3.10/site-packages/tornado/web.py", line 1788, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/crafty/app/classes/web/routes/api/users/index.py", line 94, in post
    e.schema["error"],
KeyError: 'error'

Expected result

The successful creation of a user, or feedback on what was wrong with the provided information.

Steps to reproduce

  1. Go to user creation
  2. Fill out a name with capital letters
  3. Fill out the minimum required fields
  4. Submit

Priority/Severity

  • High (anything that impacts the normal user flow or blocks app usage)
  • Medium (anything that negatively affects the user experience)
  • Low (anything else e.g., typos, missing icons/translations, layout/formatting issues, etc.)