Skip to content

Commit

Permalink
Make recaptcha callback global
Browse files Browse the repository at this point in the history
Fixes #8
  • Loading branch information
Christopher Mühl committed Jun 5, 2019
1 parent 0d8ac74 commit 3d24354
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Resources/contao/templates/form_recaptcha.html5
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<script src="https://www.google.com/recaptcha/api.js?onload=onRecaptchaLoadCallbackField<?= $this->strCaptchaKey ?><?php if ($this->recaptchaType == 'recaptcha3'): ?>&render=<?= $this->publicKey ?><?php endif; ?>" defer async></script>
<script type="text/javascript" defer async>
function onRecaptchaLoadCallbackField<?= $this->strCaptchaKey ?> () {
var onSubmit_<?= $this->strCaptchaKey ?> = function () { };
window.onSubmit_<?= $this->strCaptchaKey ?> = function () { };

<?php if ($this->recaptchaType == 'invisible'): ?>
var node = document.getElementById('recaptcha-<?= $this->strCaptchaKey ?>');
Expand All @@ -28,7 +28,7 @@
});
}

onSubmit_<?= $this->strCaptchaKey ?> = function () { node.submit(); }
window.onSubmit_<?= $this->strCaptchaKey ?> = function () { node.submit(); }
<?php elseif ($this->recaptchaType == 'recaptcha3'): ?>
grecaptcha
.execute('<?= $this->publicKey ?>', {action: '<?= $this->recaptchaAction ?>'})
Expand Down

0 comments on commit 3d24354

Please sign in to comment.