Create Your Own Verify Page for Community Sign-Ups

When users sign up for your community with an email address or phone number, Salesforce sends them a verification code and generates the Verify page. The Verify page is where users confirm their identity. Previously, you could brand the page with your logo, colors, and background, but you couldn’t change the form, which comes from Salesforce. Now you can replace the Salesforce Verify page with your own page that you create using Visualforce and a couple of Apex methods.

Where: This change applies to Lightning communities, accessed through Lightning Experience and Salesforce Classic. Communities are available in Enterprise, Performance, Unlimited, and Developer editions.

How: Here you can compare between the default Salesforce-generated Verify page and a custom page created in Visualforce. The Visualforce page uses different fonts, colors, and layout. It also customizes how users enter the verification code. Comparison of Default and Custom Verify pages

To generate your own Verify page for self-registration, create a Visualforce page and include the Apex methods System.UserManagement.initSelfRegistration and System.UserManagement.verifySelfRegistration. First call initSelfRegistration, and include a user object to insert after successful registration. It returns the user identifier as a string.

global String initSelfRegistration(Auth.VerificationMethod method, User u)

Then call verifySelfRegistration, passing in the identifier returned from initSelfRegistration and the verification code that the user entered. The method returns the verification result, which contains the session ID and verification status.

global Auth.VerificationResult verifySelfRegistration(Auth.VerificationMethod method, String identifier, String code, String startUrl)

This example verifies the identity of a user who enters a phone number.

User u = new user;
u.name = 'Tom'; // get input from the signup form
String id = initSelfRegistration(Auth.VerificationMethod.SMS, u);
VerificationResult res = verifySelfRegistrationAuth.VerificationMethod.SMS, id, ‘123456’, null);
if(res.status == SUCCESS){
//redirect
}

The Apex methods support verification by email and SMS. They control verification only for the self-registration process. They don’t apply to the login process.

You can check whether users have verified their email addresses and phone numbers by creating a list view from the Users Setup page. For example, include these verification-related fields.

  • Admin Trusted Mobile Number
  • One-Time Password App
  • Salesforce Authenticator
  • Temporary Code
  • U2F Security Key
  • User Verified Email
  • User Verified Mobile Number