Send password reset email after creating account for someone

Hey everyone,

I think I’ve run into a strange logic issue in Bubble.
Here’s the workflow I’m trying to set up:

1. Check if a user already has an account.
2. If they don’t, create one.
3. Then, send a password reset email to the newly created user, only if they didn’t have an account already created.

The problem is with step 3. I only want the password reset email to be sent if the account was just created (i.e., if the user didn’t already have one). But Bubble treats the user as “existing” immediately after the account is created, so there’s no clear way to tell whether the account was already in the system or just created in that session.

So essentially, I’m trying to trigger the email only when an account was newly created, but Bubble doesn’t let me distinguish between a pre-existing user and a user created just now.

Does anyone know how I can workaround this?

You can set a type of email data to send for example, when the account is created (first create a type of yes/no data in the database). When the account is created (if it does not exist), mail to be sent becomes yes. Consequently, send the email only if this field for that user is to be sent=si. So you should have solved it!

That’s a decent workaround I guess, it’s kind of a pain though. I think there’s an issue with this expression:
image

Because no matter what, it will always return false, because it creates an account lol. I wish there was an option for “didn’t have an account”

Search by user and use the email in the email field to check if the account exists.

  1. Make changes to Do a Search for User:first item (user with that email, returns the user if they exist, empty if they don’t)
  2. Create a new user if Result of step 1 is empty
  3. Send password email if Result of step 1 is empty