rpitv / glimpse

Monorepo for the RPI TV Glimpse project
MIT License
3 stars 1 forks source link

Login username is case-sensitive #67

Closed robere2 closed 3 months ago

robere2 commented 3 months ago

If a username in the database is robere2 but they try to log in as Robere2, it will fail. Make sure that you don't just perform a case-insensitive check on login, but on account registration as well (if that does not already exist).

evnxprk commented 3 months ago

Just to clarify, you want the username to be case-sensitive? So in this case, if they signed up with robere2, it HAS to be robere2 and not Robere2.

robere2 commented 3 months ago

Correct! Or perhaps more accurately, all usernames should be required to be lowercase, so all username inputs should also be converted to lowercase.

If you're interested in tackling this issue, I believe you're going to want to update the GraphQL resolvers for createUser and updateUser to modify input.username to be lowercase (note that input.username may be undefined in the updateUser resolver).

Update username to be lowercase in attemptLogin as well in auth.service.ts.

There's no way for new users to make their own accounts right now, so you don't need to worry about that.

robere2 commented 3 months ago

There may be additional locations in the code where this will need to be fixed, such as search filters, but I haven't tested this and this may be a more complex issue that deserves its own lower-priority issue. Feel free to tackle them if you notice them.

evnxprk commented 3 months ago

Okay so would you prefer me just to work on the lowercase and just that? If so, I can work on this but there might be a few trial and errors because I have not worked with GraphQL.