Character validation on FacilityUser username
See original GitHub issueObserved behavior
I made a test database in the kolibri shell
using a CSV of downloaded random names.
One name on there ended up being Alie L’estrange and I created the username by joining the names with underscores and lower-casing them.
So the username that I successfully saved to the database with FacilityUser.objects.create()
was alie_l'estrange
.
However, when I go to log in with that user I get an error about which characters are acceptable.
Expected behavior
If we validate for formatting on the front-end we should validate for it when we save/create/update the model record itself to avoid saving invalid records to the DB.
User-facing consequences
I know we’re working on CSV user import through the UI for an upcoming feature so we want to be sure that we’re not able to save users with invalid usernames.
Steps to reproduce
Open kolibri shell
from kolibri.core.auth.models import FacilityUser
FacilityUser.objects.create(fullname="whatever", username="something'invalid", facility=FacilityUser.objects.all()[0].facility)
Context
develop (0.14.x)
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (17 by maintainers)
Top GitHub Comments
Any reason to exclude punctuation from class names? If people want to call a class
Wow! Science? A journey into the heart of Learning;
who are we to stop them?Should use the regex here instead to allow Unicode usernames and be consistent with the frontend https://github.com/learningequality/kolibri/blob/develop/kolibri/core/assets/src/validators.js#L16