这是实现Google Recpatcha v3的正确方法吗?

时间:2018-12-03 23:53:18

标签: javascript recaptcha recaptcha-v3

我已在代码内添加了代码段:

<script src='https://www.google.com/recaptcha/api.js?render=EXAMPLE123456789-_987654321'></script>

之后,我在网站上的每个表单内添加了此javascript回调:(“提交”按钮上方的grcaptcha)。

<form accept-charset="UTF-8" target="_blank" action="https://website.infusionsoft.com/app/form/process/1234567890" class="infusion-form" id="inf_form_1234567890" method="POST">
    <input name="inf_form_xid" type="hidden" value="1234567890" />
    <input name="inf_form_name" type="hidden" value="First Last.com&#a;Web Form submitted&#a;HOME PAGE&#a;First / Last" />
    <input name="infusionsoft_version" type="hidden" value="1.00.00.1" />
    <div>
        <div>
                                <p class ="white">Register Now</p>
        </div>
    </div>
    <div>
        <div>&nbsp;</div>
    </div>
<div class="user-fields">
    <div class="infusion-field">
        <label for="inf_field_FirstName_home">First Name *</label>
        <input class="infusion-field-input" id="inf_field_FirstName" name="inf_field_FirstName" placeholder="First Name *" type="text" required />
    </div>
    <div class="infusion-field">
        <label for="inf_field_Email_home">Email *</label>
        <input class="infusion-field-input" id="inf_field_Email" name="inf_field_Email" placeholder="Email *" type="text" required />
    </div>
</div>
    <div>
        <div>&nbsp;</div>
    </div>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('EXAMPLE123456789-_987654321', {action: 'homepage'})
.then(function(token) {
// Verify the token on the server.
});
});
</script>
    <div class="infusion-submit">
        <button class="infusion-btn" type="submit">Submit!</button>
    </div>
</form>
<script type="text/javascript" src="https://website.infusionsoft.com/app/webTracking/getTrackingCode"></script>
<script type="text/javascript" src="https://website.infusionsoft.com/app/timezone/timezoneInputJs?xid=12345678900987654321"></script>

这是正确的方法吗?

0 个答案:

没有答案