Search code examples
spartacus-storefront

How to check for duplicate email address in spartacus storefront?


How can you check that an email address already exists in Spartacus? The reference class for this type of query would be UserService. But it does not contain this kind of method or anything similar.


Solution

  • In the past, we had this functionality built in. But because of security reasons our backend is not sending us any feedback about email/password/account being incorrect/existing/etc anymore. So even if you'd do anything on the frontend, the backend will not help with that.

    Here's one of the PRs, where we had to change the register flow - before, it was logging you in automatically once registered successfully, but if your email was already used, it wasn't logging you in - boom, security issue (possibility to check if a given email is used on this specific site)

    So, unless you customize your backend (not sure if even possible), you cannot really check if email already exists in Spartacus.