The first step is to create a User Data Edit Step plugin. It allows the user to enter context data and it can be configured which data items the user may supply.
The details of the configuration of the data edit step for the email address very much depend on the requirements and on the desired user experience.
In our example, we use the email address as an alias for the username and we require all users to use the alias so that we can use an internal identifier for the username.
To support this use case, the User Data Edit Step is configured as follows:
- Required – enabled, to enforce providing an e-mail address.
- Unique – enabled, to prevent duplicate conflicts in the alias' of different users.
- Enable Stealth Mode – enabled, to protect against e-mail enumeration.
- Maximum Input Length – the default is 100 characters.
- The validator is empty because the default validator already checks for a well-formed e-mail address. Configure a regex validator if you require additional validation.
The next step will validate the information provided by the user.
This example validates the e-mail address by sending an e-mail message to this address. The E-Mail Change Verification Step plugin will do just that.
- It requires some configuration:
- E-Mail Item - This is the same plugin as was used in the User Data Edit step. It is required here to ensure that the stealth mode configuration is honored correctly in the verification step.
- E-Mail Address Provider - To verify the e-mail address supplied by the user in the first step. Use the Changed E-Mail Address Provider.
- E-Mail Service - Provide an SMTP Emal Service Plugin to send out the verification e-mail message.
- OTP Generator - Verification requires the user to manually enter a code obtained from the e-mail message sent. Configure the generator for this code in this plugin.
- E-Mail Message Provider - configures the e-mail message to be sent to the user. Subject and Body used here are the default values for the E-Mail Address Change flow. In the value providers, the Context Data Map should be configured to address the user with his name and the Value Provider Map is used to inject the correct value for new_email into the message.
The last step of the flow is the persistence of the newly provided and successfully validated e-mail address.
- This works as follows:
- Create a new step with an Apply Changes Step.
- In this step choose the Apply E-Mail Change as the handler.
- In the plugin select the 'email' entry for the Context Data Name.