I’m wanting to perform a check to verify that when a new member is registering on the website that their email has not previously been registered.
I’m using the below code to query a Database where i have all the previously registered emails stored.
This issue is that when i query the database the search is case sensitive. This is a problem as if some new user types their email address with upper and lower case letters the website will think its a new email when its actually a previously registered email address.
Anyone have a solution?
wixData.query(“emailDatabase”)
.eq(“userEmail”, $w(“#SignupEmailInput”).value)
.limit(1000)
.find()
.then( (results) => { let numberOfResults = results.totalCount;
console.log(numberOfResults)
You could try to add a data hook to the collection that your user signups go into. That way, you can force all the emails to be in all uppercase regardless of how they entered it, then you can run your query against only uppercase emails.
if you use wix-users or wix-users-backend libraries to register your user checking the unicity of the email is provided out of the box. However you do not have an open access to your users anymore…
If you need to keep a hand on your users with your own collection but need to check against capital letters you can use: