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.

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:

bri_bri_ _on_twitter___someone_sent_me_a_thank_you_note_for_helping_to_inspire_them__she_comes_to_the_javascript_study_group_every_thursday__this_just_made_my_day_ _https___t_co_aiuapfmtgf_

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 to user.username on user creation.

  • When a user updates their user name in the settings page, we fetch & update the usernameDisplay key. We also update the username key to its lowercase equivalent from the usernameDisplay 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 its null 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:closed
  • Created 5 years ago
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
salma71commented, Mar 6, 2019

I’m interested too. If you like we can work together

0reactions
ojeytonwilliamscommented, Aug 23, 2021

Hi @veedata, yes, definitely. We have some contribution docs that help with getting started.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should username/login ID be case-sensitive?
No, it's not a bug by default. This depends on the requirements of the system, there is not global rule for situations like...
Read more >
How to Implement Case-Insensitive Username
Inspired by a discussion in the How to Extend Django User Modelcomments, I decided to compile a few options on how to implement...
Read more >
How to do username case insensitive in login form?
1 Answer 1 ; createQueryBuilder('user') ; where('LOWER(user.username) = :username') ; 'username', strtolower($username)) ...
Read more >
Case sensitive for username on login · Issue #12549 - GitHub
When using gitlab auth, my username is (displayed as) lowercase causing grafana to think that I am not the same user as compared...
Read more >
Advanced Access Control and username case sensitivity - IBM
If username.legacyBehavior is set to false, AAC will treat usernames as case insensitive. Note: username.legacyBehavior is a read-only parameter ...
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