rconjoe/provana-mono

make usernames unique and case sensitive

rconjoe opened this issue · 5 comments

We have to store them properly in order to display them properly.

This would necessitate logic everywhere that a username is intended to be used case-insensitive, both frontend and backend, to be converted on the way in and out of the database.

This might be well-served by getter methods on supporter and creator classes that return and/or check whatever cases come up for this...

Frontend

  1. user/:username - routes, no matter what you put in case wise you should get the user that matches (this currently doesnt happen yikes)
  2. don't convert when displaying usernames (chats, profiles, notifs...straight from bind in DB where case is as recorded by user.)
  3. Registration - add a check to query against all usernames (eesh) and make sure it returns array of 0 before allowing someone to use that username.
    ...

API

  1. see no. 3 on list above

This is going to require two indexes!

creators/usernames
supporters/usernames

Queries are created now that check for the username before allowing someone to register with it. But, now it needs to check case-insensitively (converting on the way in and out? utility function on either app?)

Store the username as uppercase on register. This is your url and is not changeable. Your vanity display name will be the same thing by default, but not uppercased - stored as the user entered it. That's used for displaying it places and can be changed, but the username/url will remain the same

Still to be done for this is the route handling that uppercases the value pulled from the URL before running the username query.

Now, the vue app just uppercases the username sent to the API so that queries actually match the uppercased usernames stored in the DB.

A more efficient way to do this would be to adjust the API in UserFinder so that the query uses an uppercased version of the username for creator queries and the normal version for supporters.
This however doesn't matter too much right now because supporters don't have profiles!