question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Character validation on FacilityUser username

See original GitHub issue

Observed 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:closed
  • Created 4 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
rtibblescommented, Mar 11, 2020

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?

1reaction
rtibblescommented, Mar 11, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Regular expression to validate username - java
I'm trying to create a regular expression to validate usernames against these criteria: Only contains alphanumeric characters ...
Read more >
How to Validate User Account Details Using Regular ...
Regex to Validate a Username. Consider a username that is only valid if it satisfies the following conditions: The number of characters must ......
Read more >
Tennessee Immunization Information System (TennIIS) ...
School/Childcare Facility User Quick Reference Guide ... •Enter patient's first name or last name and birth ... fields to replace multiple characters ......
Read more >
BrokerTec Upload Facility User Guide
BrokerTec Upload Facility User Guide ... Upload and Verification . ... User Name, which must be more than 6 and less than 20...
Read more >
When filling out a form to what extent should validation be ...
I'm working on a registration form and it validates some parts while the user is still typing. For example, the username is being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found