[英]Validating Google reCaptcha
這只是我面臨的一個簡單挑戰。 我正在使用Bootstrap驗證程序來驗證我的表單,並且希望將其與Google reCaptcha集成。
我的密碼
<div class="form-group">
<div class="g-recaptcha" data-sitekey="my site key"></div>
<span class="help-block" style="display: none;">Please check that you are not a robot.</span>
</div>
<span class="help-block" style="display: none;">Please enter a the security code.</span>
<script src="https://www.google.com/recaptcha/api.js"></script>
我該怎么做才能使用戶無法完成驗證碼就不能提交它。 我找到了一些JavaScript可以做到這一點,但我想將其與此庫集成。
我用過這樣的東西,它的工作原理。 您可以根據需要提供反饋。
<div class="form-group container-captcha">
<label style="display:none;" for="">Check "I am human" below <span class="required"></span></label>
<input type="text" name="recaptcha" required value="" id="recaptchaValidator" pattern="1" data-error="Check `I am human` !" style="display:none;">
<div class="g-recaptcha" data-sitekey="my site key" data-callback="captcha_onclick" align="center" ></div>
<p class="help-block with-errors">Prove you are a human!</p>
<script>
function captcha_onclick() {
$('#recaptchaValidator').val(1);
$('#my-form-id').validator('validate')
}
</script>
</div>
<script src="https://www.google.com/recaptcha/api.js"></script>
您可以參考reCaptcha參考
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.