Case Insensitive retrieve

0
I want to implement a case-insensitive retrieve in the database to see if an email address exists for a password reset request: The problem is that the person might have an email address of ‘email@email.com’ but type in to the forgot password box ‘Email@Email.com’ (or indeed ‘Email@EMAIL.com’ or similar. This does not retrieve a matching account as the database sees them differently. How can I check for the existence of an email address no matter what the person has originally saved in the database?
asked
4 answers
1

I think you can combine a contains and a length statement, that would give the result you need:

 

answered
2

You can force all lowercase on a string. Check out the toLowerCase() documentation. You can use this on both the input and account email fields for your check.

answered
0

I think you are going to need to normalise your data so both the stored email address and the entered email address are in the same format.

To normalise i’d look at converting to lowercase and trimming whitespace so they are consistent. This probably means updating the email address you have stored for existing users.

Hope this helps.

 

answered
0

You could do a “contains” xpath, but this could retrieve more than you bargain for. You’d have to do a subsequent check converting both to upper or lower case to confirm it is indeed a match

answered