网站所有者错误:使用Google recapcha的无效网站密钥

时间:2019-03-08 09:08:25

标签: javascript angularjs recaptcha

这是网站所有者的错误ERROR:使用Google recapcha(角度js)的无效网站密钥。提供有效密钥后,我不知道为什么会收到此回复。该错误的可能原因是什么?

html

 <form ng-submit="submit()">
            <div
                vc-recaptcha
                theme="'light'"
                key="model.key"
                on-create="setWidgetId(widgetId)"
                on-success="setResponse(response)"
                on-expire="cbExpiration()"
            ></div>
            <button class="btn" type="submit">Submit</button>
</form>

mycode

$scope.response = null;
    $scope.widgetId = null;

    $scope.model = {
         key: 'key is here'
    };

    $scope.setResponse = function (response) {
        console.info('Response available');

        $scope.response = response;
    };

    $scope.setWidgetId = function (widgetId) {
        console.info('Created widget ID: %s', widgetId);

        $scope.widgetId = widgetId;
    };

    $scope.cbExpiration = function () {
        console.info('Captcha expired. Resetting response object');

        vcRecaptchaService.reload($scope.widgetId);

        $scope.response = null;
    };

    $scope.submit = function () {
        var valid;

        /**
         * SERVER SIDE VALIDATION
         *
         * You need to implement your server side validation here.
         * Send the reCaptcha response to the server and use some of the server side APIs to validate it
         * See https://developers.google.com/recaptcha/docs/verify
         */
        console.log('sending the captcha response to the server', $scope.response);

        if (valid) {
            console.log('Success');
        } else {
            console.log('Failed validation');

            // In case of a failed validation you need to reload the captcha
            // because each response can be checked just once
            vcRecaptchaService.reload($scope.widgetId);
        }
    };

0 个答案:

没有答案