I’m creating signup and login on the same form, when the user fills the form and clicks continue, it searches the database for the email address, if the email address is found, it logs the user in, logged in, if not found, the user is automatically signed up.
The problem is searching the database to see if the user’s email is already registered.
Under Workflows —> Accounts, there’s two actions, Sign the User Up and Log the User In.
You can set each of those up with a “Only when” conditional:
- Search for the email in your user database
- If the returned results is 0, then Sign the user up (assuming that a password is also added, or that you’re using Magic Link)
- If the returned results is > 0, then Log the user in with the credentials.
Does this make sense? Would love to see your workflow setup if you chance…
I imagine this would work very much the same way to prevent users from signing up with the same Email or ‘Username’?
You wont have to check for that. Bubble doesn’t allow the creation of two user accounts with the same email. However, if you need another layer of “security” in a sense, you can do that in the front end with conditionals.
Basically, search for the email in the input field. If there’s already a user with that email, then disable the “Register” button (make it unclickable or hide it).
1 Like