Pre-User Registration Action To Prevent Duplicate Users Not Working

Overview

The Pre-User Registration Action can check the availability of an email when a user enters it during the registration process and denies its creation if the email already exists when users authenticate only through a database or passwordless connection. If a user registers through a social or enterprise connection, this action will not prevent duplicate emails from being created. This article provides a potential method for preventing duplicate email addresses in this scenario.

Applies To

  • Extensibility
  • Actions

Cause

The Pre-User Registration Trigger is limited to the Database or Passwordless connection. If any other connection is used, the Action can not trigger, hence the creation of the user is not stopped.

Solution

A potential workaround for this issue is User Account Linking.

This feature allows you to merge two identities with the same email, solving the issue of duplicated emails.

The Account Linking can be done through a Post-Login Action. A detailed example of a starting point of the code for this action can be found here: Example account linking with Actions

An alternative to the Post-Login Action would be the Account Linking Extension, but this solution is more limited than the action.