Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Describe the bug
@iamareebjamal I will have to make the following changes if we want to allow the users to enter the 'email' in any 'case'.
Changes for Email consistency:
Note: The add/change written in the bracket refers to whether I will be changing the method or adding it.
Can you please review this once and give me a go ahead if you are satisfied with the proposed changes?
This is a good solution however, I feel it will miss some cases. For example: while logging in, if the user entered the email in a different case then the might fail. Moreover, the data in database won't be as consistent, I think it's better if all the emails are stored in lowercase. Therefore, I think the best way to solve this issue might be that whenever we take email as input from the user we should convert it to lowercase before we do any further processing on it.
Why will it fail?
How does your solution work on pre-existing data? And ensures on database level that data will not be inconsistent
I will explain what I am trying to say with an example:
email entered by the user: "EXAMPLE@EXAMPLE.COM"
During Logging In
email entered by the user: "EXAMPLE@example.com"
The email id entered by the user during logging in, does not match the email in database or the lowercase email on which index is constructed.
Also, while coming up with a solution we will also have to keep in mind that there might be existing mixed-case emails in the database.
Every time user enters email, we convert it to lowercase and then store it in the database or do any further processing on it (like querying the database).
We will also construct the index (as you mentioned) on lowercase emails to avoid the clashed with existing mixed-case emails.
My plan was to use both the things mentioned below.
This will prevent future inconsistency.
This will make sure the system works for previously existing emails in database.