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

**URL:** <https://community.fliplet.com/t/how-can-i-prevent-users-from-being-able-to-register-multiple-times-with-the-same-email-address/242>\
**Category:** Get Help\
**Tags:** login\
**Created:** [January 12, 2022, 3:44pm UTC](https://community.fliplet.com/t/how-can-i-prevent-users-from-being-able-to-register-multiple-times-with-the-same-email-address/242 "2022-01-12T15:44:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.fliplet.com/u/Carina)\
**Post date:** [January 12, 2022, 3:44pm UTC](https://community.fliplet.com/t/how-can-i-prevent-users-from-being-able-to-register-multiple-times-with-the-same-email-address/242/1 "2022-01-12T15:44:29Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Deb](https://dub1.discourse-cdn.com/flex017/user_avatar/community.fliplet.com/deb/32/159_2.png) [@Deb](https://community.fliplet.com/u/Deb)\
**Post date:** [January 12, 2022, 6:48pm UTC](https://community.fliplet.com/t/how-can-i-prevent-users-from-being-able-to-register-multiple-times-with-the-same-email-address/242/2 "2022-01-12T18:48:23Z")

</div>

Hi Carina,

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![Carina](https://avatars.discourse-cdn.com/v4/letter/c/8baadc/32.png) [@Carina](https://community.fliplet.com/u/Carina)\
**Post date:** [January 13, 2022, 12:09pm UTC](https://community.fliplet.com/t/how-can-i-prevent-users-from-being-able-to-register-multiple-times-with-the-same-email-address/242/3 "2022-01-13T12:09:34Z")

</div>

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!
