|
@@ -191,6 +191,25 @@
|
|
|
{% with settings.coderedcms.LayoutSettings as ls %}
|
|
|
{% if ls.spam_service == ls.SpamService.RECAPTCHA_V3 %}
|
|
|
<script src="https://www.google.com/recaptcha/api.js?render={{ ls.recaptcha_public_key }}"></script>
|
|
|
+ <script>
|
|
|
+ function recaptchaSubmit(formId) {
|
|
|
+ var form = document.getElementById(formId);
|
|
|
+ if (form.reportValidity()) {
|
|
|
+ grecaptcha.ready(function() {
|
|
|
+ grecaptcha.execute(
|
|
|
+ '{{ ls.recaptcha_public_key }}',
|
|
|
+ {action: 'submit'}
|
|
|
+ ).then(function(token) {
|
|
|
+ // Set value for every token input on the page.
|
|
|
+ document.getElementsByName("g-recaptcha-response").forEach(
|
|
|
+ function(el) {el.value = token}
|
|
|
+ );
|
|
|
+ document.getElementById(formId).submit();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </script>
|
|
|
{% elif ls.spam_service == ls.SpamService.RECAPTCHA_V2 %}
|
|
|
<script src="https://www.google.com/recaptcha/api.js"></script>
|
|
|
{% endif %}
|