Simple Integration For Google Recaptcha V3 in Opencard 3.0.2.0
Posted: Fri Jan 01, 2021 5:05 am
Im not sure if this is the right place to post this but I ran into this problem for a client. Needed to integrate Recaptcha V3 and didnt want to buy an extension. So to get around this:
In theme editor edit: extension/captcha/google
Replace existing code with this:
Then replace your Keys with the V3 keys.
In theme editor edit: extension/captcha/google
Replace existing code with this:
Code: Select all
<script src="//www.google.com/recaptcha/api.js?render={{ site_key }}" type="text/javascript"></script>
<script>
function onClick(e) {
e.preventDefault();
grecaptcha.ready(function(){
grecaptcha.execute('{{ site_key }}', { action: 'submit'}).then(function(token) {
var recaptchaResponse = document.getElementById('recaptchaResponse');
recaptchaResponse.value = token;
})
});
}
</script>
<input type="hidden" name="g-recaptcha-response" value="" id="recaptchaResponse">
<div class="text-danger">{{ error_captcha }}</div>