---
schema_version: "1"
id: 33405dab45bb6b0df040b90ee21caeb904cb2e79eca420252b0368de92452054
title: Create a Custom Identity Verification Page
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/xcloud/264-0-0/external_identity_passwordless_login_customize_verification_apex.md
canonical_url: https://help.salesforce.com/s/articleView?id=xcloud.external_identity_passwordless_login_customize_verification_apex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: d8cefdaba78a39736be364288f45b17d74e804288da808960f73b66551019937
description: You can use passwordless login to let users register and deregister a variety of verification methods, such as via email, SMS, time-based one-time password (TOTP), physical U2F security key, or Salesforce Authenticator. Users can then log in with a verification method. Create your own verification page, and customize the verification process with Apex.
products:
  - Security
  - Cross Cloud
release: "264"
---
# Create a Custom Identity Verification Page

You can use passwordless login to let users register and deregister a variety of verification methods, such as via email, SMS, time-based one-time password (TOTP), physical U2F security key, or Salesforce Authenticator. Users can then log in with a verification method. Create your own verification page, and customize the verification process with Apex.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, <strong>Unlimited</strong>, and <strong>Developer</strong> Editions</td></tr></tbody></table>

By default, when implementing passwordless login, Salesforce performs the identity verification process for you. It sends the verification code, displays the Verify page where the user enters the code, and confirms the user’s identity. Salesforce provides this default Verify page.

![Default Salesforce Verify page](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-identity-264-0-0-production-enus/699dab6f-8f1a-4662-b24f-6521d5b747f7/identity/images/xid_default_verify_page.png)

You can use Visualforce to create your own Verify page and have full control of the layout. You can also control the identity verification process in the Apex controller. This example of a custom Verify page uses different fonts, colors, and layout. Instead of a separate Verify page, users receive their verification code and enter it directly on the Login page for a smooth passwordless login experience.

![Custom Verify page](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-xcloud-identity-264-0-0-production-enus/699dab6f-8f1a-4662-b24f-6521d5b747f7/identity/images/xid_custom_verify_page.png)

1. Create your Visualforce page. For more information on customizing the content and layout, see [Visualforce](https://help.salesforce.com/s/articleView?id=platform.pages_about.htm&type=5&language=en_US) in Salesforce Help.
2. From Setup, in the Quick Find box, enter Visualforce Pages, and then select **Visualforce Pages**.
3. Click the Visualforce page that you created for identity verification.
4. Click **Edit**.
5. To implement your own verification process, use Apex methods under the `System.UserManagement` class. The methods come in pairs—one method to send the verification code, and one method to verify that the verification code is correct. Which methods you use depend on when you require identity verification.
    
    - To sign up new users, use `initSelfRegistration` and `verifySelfRegistration`.
    - To log in users, use `initPasswordlessLogin` and `verifyPasswordlessLogin`.
    - To register a user’s verification method, use `initRegisterVerificationMethod` and `verifyRegisterVerificationMethod`.
    
    For more information, see [UserManagement Class](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_class_System_UserManagement.htm) in the Apex Reference Guide.

## Example Implementation for Customizing the Verification Process

This code example customizes the Verify page for registering a verification method. When the user enters a verification code on the Visualforce page, it invokes `registerUser()`. The method gets the User ID of the user who’s registering the verification method and the user’s phone number. It also gets the user’s registration status to check whether the phone number is already verified. If the user is registered with a different phone number, the number is updated.

```java
public void registerUser() {
        try {
            exceptionText='';
            String userId = UserInfo.getUserId();
            User u = [Select MobilePhone, Id from User Where Id=:userId];
             currPhone = u.MobilePhone;
             mobilePhone = getFormattedSms(mobilePhone); 
           if (mobilePhone != null && mobilePhone != '') {
           u.MobilePhone = mobilePhone;
           update u;
            // We're updating the email and phone number before verifying. Roll back  
           //  the change in the verify API if it is unsuccessful.
            exceptionText = System.
            UserManagement.initRegisterVerificationMethod(Auth.VerificationMethod.SMS);
            if(exceptionText!= null && exceptionText!=''){
                isInit = false;
                showInitException = true;
            } else {
                 isInit = false;
                 isVerify = true;
            }
            } else {
                showInitException = true;
            }
        } catch (Exception e) {
            exceptionText = e.getMessage();
            isInit = false;
            showInitException = true;
        }
    }

public void verifyUser() {
    // Take the user’s input for the code sent to their phone number
    exceptionText = System.UserManagement.         verifyRegisterVerificationMethod(code, Auth.VerificationMethod.SMS);
    if(exceptionText != null && exceptionText !=''){
    showInitException = true;
    } else {
            //Success    
    }
}
```