Forum Academy Marketplace Showcase Pricing Features

Need help - Search if email already exists in Database

Hi all,

Pretty new here, but loving Bubble already! Just running into a small thing that I think should be super easy to solve, but I just cannot make it seem to work.

I’m combining the sign up and log in into one page.

The conditional logic I’m trying to aim for is the following:
When the “Continue” button is clicked > Do a search in the database if the email entered in the email input exists already.
If not → Sign the user up with the credentials entered
If already exists → Log the user in.

I Googled, tried, but cannot seem to make it work.

It will always return “True” in the above example. I hoped with the above formula it would return “False” if the email already exists in the database. But unfortunately, when I enter an email that already exists in the user database, it will still return true and try to sign the user up.

(Please note that once I’ve got the sign up workflow working I will create the opposite one for the Log In, I understand these should be two separate workflows).

Could someone be so kind and give me an explanation on what I am doing wrong here and how I can ensure my formula works?

Would be greatly appreciated, thank you! :slight_smile:

Update: also tried the below, but it looks like the “Search For User’s email” does not return anything, see the debugger information below.


you need to search for User’s who’s email matches the Email Input’s value.

So do a search for Users, with the constraint:
Email=Email Input’s Value

Then do the count of returned results on that (i.e. is 0, or >0 etc.)

Thank you for replying and helping me.

I’ve tried that exactly. But unfortunately the ‘count = 0’ always is true, because the Search for Users for some reason doesn’t return any results.

I did a “Search for Locations” (another database field), and that actually returns the data immediately. For some reason “Search of Users” doesn’t. I am confused to why. I’ve checked, but there is definitely data in the database.

Screenshot 2021-11-11 at 12.25.05

Could this be due to privacy settings?

Yes, it could well be.

"Solved" the issue:

The functions I tried didn’t work because Search for Users didn’t return any data due to privacy settings. This can be solved by setting the User’s Email to public - which I do not want due to privacy.

So am going to look for an alternative solution, right now I’m thinking about separating login and sign up after all, but let’s see.

If anybody has a good idea for me to solve this, which is still good for privacy reasons, please do let me know.

Although it might not be the most efficient process, you could offload the search for email comparison to the backend. When it’s part of a back and workflow you can check the box to ignore privacy settings. This ensures that no outsiders get access to your users data but also allows your app to check if an email already exist without exposing any information to any other user that’s not requested as part of the query

1 Like