How can I prevent users from being able to register multiple times with the same email address?

Hi everyone,

I am having an issue with my app where I have duplicated users on my user Data Source, after investigating I found that users are able to register multiple times with the same email address.

Initially, on my registration screen, I ticked the box “Update existing entries” and thought this would work, unfortunately, it didn’t.

Is this something we could fix with some custom code? Can anyone help?

Thanks in advance!

Hi Carina,

You will need some JS for this to work. You can add this under Developer Options > This screen > JS.

Fliplet.Hooks.on('beforeFormSubmit', function(data) {
//change 123456 to the Data source ID where your users are stored. 
  return Fliplet.DataSources.connect(123456).then(function(connection) {
    return connection
      .findOne({
        where: { Email: data.Email }
      })
      .then(function(record) {
        if (record) {
          return Promise.reject('This account already exists');
        }
      });
  });
});

Hope this helps.

1 Like

Hi Deb,

This worked, I tested this on my app and got the error message this account already exists.
This is a massive help thanks!