CSC207-2022F-UofT / course-project-translate-chat-program

course-project-translate-chat-program created by GitHub Classroom
0 stars 4 forks source link

Login will need to use user id instead of (or in addition to) username #37

Closed alfred-mikhael closed 1 year ago

alfred-mikhael commented 1 year ago

Since usernames are not unique and passwords are not unique either, there can be two users with the exact same username and password. This would cause an error when signing in. I see that there are a few solutions to this:

  1. Make it so that usernames are unique and use only the username
  2. Make it so that the emails are unique and sign in using the email
  3. Have the users remember their user id land use both username and user id to sign in

Personally, I lean towards the third option because that allows users to have the same username and lets users have multiple accounts per email. What are your opinions?

Dismany0 commented 1 year ago

I think it feels more right to have usernames be unique. If this were a real app, I think i would forget my own id number pretty quickly.

Would it be better to have the login username or email be unique, and maybe have a separate display name? It would be like discord or skype, where you log in with an email, but you can choose a nickname

alfred-mikhael commented 1 year ago

Yeah that makes sense. In order to make this easier, would it be okay to change the User documents in the database, so that they name of the document is the username rather than the user id? This would cost us less reads and overall be faster.

muzammil004 commented 1 year ago

If the usernames end up being unique, we can definitely change the user document names to be the usernames. I also am leaning towards having the user choose a unique username. Would we want to add a displayName attribute to the User entity, as well as making a displayName field in the Firebase database for users?

alfred-mikhael commented 1 year ago

That's a good idea, I can certainly make those changes. @alx672219, are you okay with this? You will have to do a little refactoring.

alx672219 commented 1 year ago

Then, are we changing the user IDs to be String instead of Integer?

alfred-mikhael commented 1 year ago

Not exactly, in this case, we would have usernames be unique, and possibly add a separate display name. So you would add contacts via username instead of user id, but the display name would be the one shown on screen. Seeing how a lot of our code depends on the documents being named by user ID, we can keep this part the same.