Customize text

更新时间:
复制 MD 格式

You can customize the display text for the secondary authentication component triggered by Captcha.

Customize secondary authentication text

You can use the upLang parameter in the initialization configuration to customize the text for the secondary authentication component.

var btn = document.getElementById("register");
    // Instantiate nvc to initialize the Captcha service.
    AWSC.use("nvc", function (state, module) {
        // Initialize. Call module.init to start initialization.
        window.nvc = module.init({
           ...
           ...
           ...
        });
        // Attach the event.
        btn.onclick = onclick;
    });
    // Send a business request: Triggered when the button is clicked. Gets the verification string and sends it to your application server.
    function onclick() {
        window.nvc.getNVCValAsync(function (nvcVal) {
           ...
           ...
           ...
        });
    }
    // Process the application response: This callback function handles the API response after uploading the verification string. The response from your application server controls the Captcha status.
    function yourRegisterRequest(json) {
        // The callback for the application server request determines if secondary authentication is required.
        if (json.result.code === 100 || json.result.code === 200) {
            ...
        } else if (json.result.code === 800 || json.result.code === 900) {
            ...
        } else if (json.result.code === 400) {
            // Secondary authentication is required.
            var ncoption = {
               ...
               // Configure the text for secondary authentication.
               upLang: {
                   'cn': {
                     // Loading status prompt.
                     'LOADING': "Loading...",
                      // Waiting for slide status prompt.
                      'SLIDE': "Slide to verify",
                      // Verification success status prompt.
                      'SUCCESS': "Verified",
                      // Status prompt for a failed verification.
                      'ERROR': "Sorry, a network error occurred...",
                      // Status prompt for a failed verification.
                      'FAIL': "Verification failed. Please try again."
                    }
               }
               ...
            }
            // Trigger secondary authentication (slider captcha).
            window.nvc.getNC(ncoption);
        }
    }