Allow username display to be case-insensitive
See original GitHub issue- We want to store a case-sensitive version of usernames for display both in the URL and on the profile itself. This is how GitHub, Twitter, and many other services operate.
Twitter example:
What this means as a fix:
-
Add an additional key
usernameDisplay
in the user schema:{ ... "properties": { ... "username": { "type": "string", "index": { "mongodb": { "unique": true, "background": true } }, "require": true }, "usernameDisplay": { "type": "string", ... } ...
-
This new
usernameDisplay
key will default touser.username
on user creation. -
When a user updates their user name in the settings page, we fetch & update the
usernameDisplay
key. We also update theusername
key to its lowercase equivalent from theusernameDisplay
key in the api-server side logic. -
The URL lookup and for a username should still default to the
username
lowercase. -
When the profile page is rendered, the display will render the
usernameDisplay
instead, but should fallback to the username in case itsnull
or empty (existing users will not have this key on db)
_Originally posted by @QuincyLarson in https://github.com/freeCodeCamp/freeCodeCamp/issues/19346#issuecomment-458199335_
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (10 by maintainers)
Top GitHub Comments
I’m interested too. If you like we can work together
Hi @veedata, yes, definitely. We have some contribution docs that help with getting started.