diff --git a/vendor/magento/module-re-captcha-frontend-ui/view/frontend/web/js/reCaptcha.js b/vendor/magento/module-re-captcha-frontend-ui/view/frontend/web/js/reCaptcha.js index 14f2af32..60b8e016 100644 --- a/vendor/magento/module-re-captcha-frontend-ui/view/frontend/web/js/reCaptcha.js +++ b/vendor/magento/module-re-captcha-frontend-ui/view/frontend/web/js/reCaptcha.js @@ -73,8 +73,14 @@ define( * @param {String} token */ reCaptchaCallback: function (token) { + var submitButton; + if (this.getIsInvisibleRecaptcha()) { this.tokenField.value = token; + submitButton = this.$parentForm.find('button:not([type]), [type=submit]'); + if (submitButton.length) { //eslint-disable-line max-depth + submitButton.attr('disabled', false); + } this.$parentForm.submit(); } }, @@ -155,7 +161,13 @@ define( if (this.getIsInvisibleRecaptcha() && parentForm.length > 0) { parentForm.submit(function (event) { + var submitButton; + if (!this.tokenField.value) { + submitButton = this.$parentForm.find('button:not([type]), [type=submit]'); + if (submitButton.length) { //eslint-disable-line max-depth + submitButton.attr('disabled', true); + } // eslint-disable-next-line no-undef grecaptcha.execute(widgetId); event.preventDefault(event);