If you have an app that allows users to create their own user profiles, you may want to consider adding email validation. When a user submits an email address via a registration Web Form, your app can send an acknowledgment email with a personalized validation hyperlink. The end-user must go to their email account and click on that hyperlink to activate their profile. This way you are certain that you have a valid email address for that user.
Steps to create an email address validation DataPage:
Prepare your authentication table and filtered authentication view
- Navigate to the Tables listing in an app and select your authentication table. Open the Design view by clicking Table Design.
- Add a new verification field to the table. In this example, this verification field is named Email_Verified. Select Yes/No as the data type.
- To create the hyperlink that will be sent to your end-user’s email account, also add another field. This field will hold a GUID or Globally Unique Identifier. This GUID will be automatically generated by the registration Web Form, and will be used by the validation Update Form to locate the end-user’s profile record. Set the data type to Text(255) and mark the field as Unique.
- Click Save.
Base your Web User Authentication on a filtered view of your authentication table
Now we are going to limit access to your DataPages to only allow end-users who have verified their email address. This is accomplished using a filtered view of the authentication table. In a filtered view of the authentication table only validated user profiles will be visible.
- Navigate to the Views listing and click New View.
- Name your view and select your authentication table and move it to the right-hand panel using the arrow button.
- In the Fields panel locate and select your Yes/No verification field (In this example, it is Email_Verified). Check Filter data by this Field and check the Value checkbox.
- Click Finish to save your view.
Now this view will only include records where the email address has been marked as verified. Use this view as your authentication table to implement Web User Authentication.
Create an Update Form to find and validate the user’s record
Now that the extra fields have been added to the authentication table, you can create and deploy the validation Update Form. You create this Web Form before the registration Web Form so that you can note the hosting web page URL. You are going to need this URL to write the acknowledgment email at the end of the registration Web Form.
- Navigate to the DataPages listing and click New DataPage. Select the Single Record Update Form.
- On the DataPage DataSource screen, choose the authentication table as the base table (data source) for this DataPage. Enable advanced options and parameters.
- To locate the user’s record, you are going to receive a GUID value from a query string parameter in the URL. Select your GUID field from the Unique ID field dropdown. Change the parameter name to match the fieldname of your GUID field. Be sure to remember this parameter fieldname (GUID) as it will be needed later when you create the hyperlink in the acknowledgment email.
Now we’re going to configure the Update Form to change the verification field value to “Yes”.
- In the Select Fields screen select your verification field (in this example “Email_Verified”) and move it to the right-hand panel using the arrow button.
- From the Form element dropdown field select Hidden.
- Make sure the default value checkbox is checked.
- This verification field value is automatically set to “Yes”.
Now when your end-user submits the form, their profile will be activated.
- Click the Insert button at the lower right-hand corner of the DataPage Elements panel and add HTML Block.
Redirect the end-user after verification
On the Destination and Emails screen of the DataPage wizard you can choose a destination page. In this example, after the Update Form has been submitted the end-user is directed to a confirmation web page. Click Finish to save your DataPage.
Deploy the Update Form to a web page
Deploy the Update Form to a web page and note the URL. We will be using this URL in the next step to create the hyperlink contained in the acknowledgment email.
Create a registration Web Form with an email hyperlink
- Click on the New DataPage button and create a Submission Form.
- Select your authentication table as a base table (data source).
- Proceed to the Select Fields screen add the email field and the GUID field to the included fields.
- In the Configure Fields screen select your email field.
- Select Email from the Form element dropdown field.
Now we will configure the GUID field to automatically create a GUID value.
- Select your GUID field from the DataPage Elements panel.
- Select AutoValue from the Form elements dropdown field.
- From the AutoValue Type dropdown field, select Random Unique ID.
- From the Format dropdown field select For Application Use. This will automatically fill your GUID field with a 128-bit Globally Unique Identifier.
On the Destination and Emails screen of the DataPage wizard configure your destination page options. In this example we changed the display message to alert the end-user that they will need to check their email to complete their registration.
Configure the automatic email
On the Destination and Emails screen of the DataPage wizard, in the Automatic Email Options section., click on Acknowledgment email to email address submitted in form, and select your authentication table’s email field from the dropdown field. Click Next.
On the Acknowledgment Email screen, we will configure the acknowledgment email to link to the validation Update Form’s host web page.
- Enter an email address into the From field. The email address can be either a real email address from your organization, or a “no reply” address (for example: firstname.lastname@example.org) to indicate that the email address isn’t valid.
- Enter a subject in the subject field to indicate that action is still required from your end-user.
- Select HTML from the Email format dropdown field on the bottom of the screen.
- Write a message in the message panel using HTML.
Now create a hyperlink to the validation Update Form host web page. First write out an HTML hyperlink to the URL of the host the web page. You can copy the HTML hyperlink syntax from the bottom of this article. Be sure to change the URL in the sample to your validation Update Form web page URL.
Next add the user’s GUID to the URL as a query string parameter.
- After the URL add a question mark (?).
- Type the parameter name of your GUID field followed by an equal sign (GUID=).
- Select your GUID field in the Insert fields dropdown field.
- Click the Insert button.
- Close the quotation marks and the tag
Make sure that the entire URL including the query string is contained in quotation marks. The format of the hyperlink should follow the example below. Click Finish to save your DataPage.
Deploy and Test
Now you can deploy your registration Web Form to your web page. Test the system by registering. Be sure to check your Junk Mail folder for the acknowledgment email. It is a good idea to suggest your end-users do the same. Click on the hyperlink in the acknowledgment email. Verify the authentication view to be sure your profile has been validated. Now you can be sure that you have a valid email address for each new end-user profile. If you have existing end-user profiles, you may want to mark them as already validated.
HTML Hyperlink Syntax
<a href="URL">Link Text</a>