Answer the question
In order to leave comments, you need to log in
How to install recapcha v3 on 1C-Bitrix?
In general, I set myself the task of independently connecting captcha to the feedback form. And not a simple "I'm not a robot", but version #3.
I found a guide: https://fstrange.ru/coder/php/bitrix-recaptcha-v3.html
And started to perform the task using it.
The first thing I did was to find the template file that displays my form:
/local/templates/site_name/components/bitrix/form.result.new/.default/template.php I
added a hidden field to it:
<input type="hidden" name="recaptcha_response" id="recaptchaResponse">
<?php
$APPLICATION->AddHeadScript("/www.google.com/recaptcha/api.js?render=6Ld4DtEUAAAAAGWUfXOC07l8ca0NKwkeYaEbYciS");
$APPLICATION->AddHeadScript("
<script>
var onloadCallbackRecap = function() {
grecaptcha.ready(function () {
grecaptcha.execute('6Ld4DtEUAAAAAGWUfXOC07l8ca0NKwkeYaEbYciS', { action: 'contact_callback' }).then(function (token) {
var recaptchaResponse = document.getElementById('recaptchaResponse');
recaptchaResponse.value = token;
});
});
};
</script>
");
?>
Answer the question
In order to leave comments, you need to log in
$APPLICATION->AddHeadScript("
<script>
var onloadCallbackRecap
// ..e
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question