Newer Version Available
VerificationResult Class
Namespace
Usage
When users sign up for or log in to your community with an email address or phone number, Salesforce sends them a verification code. At the same time, Salesforce generates the Verify page for users to enter the code to verify their identity. You can replace the Salesforce-generated Verify page with one that you create with Visualforce. Then invoke the verification challenge and, if the verification code is entered correctly, log in the user. For sign-up, you use the System.UserManagement.verifySelfRegistration method. For passwordless login, you use the System.UserManagement.verifyPasswordlessLogin method. The methods return the verification result, which contains the message displayed as a result of the challenge, whether the challenge is successful, and where to direct the user when the verification code is entered correctly.
Example
This code contains the result of a verification challenge that registers a new user.
1String id = System.UserManagement.initSelfRegistration
2 (Auth.VerificationMethod.SMS, user);
3 Auth.VerificationResult res = System.UserManagement.verifySelfRegistration
4 (Auth.VerificationMethod.SMS, id, ‘123456’, null);
5 if(res.status == SUCCESS){
6 //redirect
7}VerificationResult Constructor
VerificationResult has the following constructor.
VerificationResult(redirect, success, message)
Signature
public VerificationResult(System.PageReference redirect, Boolean success, String message)
Parameters
- redirect
- Type: System.PageReferenceSystem.PageReference
- Where user is directed upon successful verification.
- success
- Type: Boolean
- Indicates whether verification succeeded.
- message
- Type: String
- Message that displays as a result of a verification challenge.
VerificationResult Properties
The following are properties for VerificationResult.
message
Signature
public String message {get; set;}
Property Value
Type: String
redirect
Signature
public System.PageReference redirect {get; set;}
Property Value
Type: System.PageReferenceSystem.PageReference
VerificationResult Method
VerificationResult has the following method.