User pre-registration script
This example shows a User pre-registration web script that is executed before a new user is added to Sitecore Content Hub. It validates input and restricts access based on specific criteria, such as whether the external provider is Google and the email domain is yahoo.com.
-
Configure the user groups or profiles required during the pre-registration process.
-
Ensure schema properties align with the script logic for pre-registration workflows.
Script
Script explanation
This section steps through the script in execution order, explaining each part. The numbered items describe the sequence, not instructions to perform.
-
Check the external user provider. If the provider is not Google, the script throws an exception.
-
Get the external user information.
-
If the user email is
nullor empty, throw an exception. -
If the email does not end with
'@yahoo.com', throw an exception.
Setup
-
Create, publish, and enable the User pre-registration script.