diff --git a/vendor/magento/module-captcha/Plugin/ResetPaymentAttemptsAfterOrderIsPlacedPlugin.php b/vendor/magento/module-captcha/Plugin/ResetPaymentAttemptsAfterOrderIsPlacedPlugin.php
new file mode 100644
index 00000000000..660d5acc758
--- /dev/null
+++ b/vendor/magento/module-captcha/Plugin/ResetPaymentAttemptsAfterOrderIsPlacedPlugin.php
@@ -0,0 +1,65 @@
+helper = $helper;
+ $this->resLogFactory = $resLogFactory;
+ }
+
+ /**
+ * Reset attempts for frontend checkout
+ *
+ * @param OrderManagementInterface $subject
+ * @param OrderInterface $result
+ * @param OrderInterface $order
+ * @return OrderInterface
+ */
+ public function afterPlace(
+ OrderManagementInterface $subject,
+ OrderInterface $result,
+ OrderInterface $order
+ ): OrderInterface {
+ $captchaModel = $this->helper->getCaptcha(self::FORM_ID);
+ $captchaModel->setShowCaptchaInSession(false);
+ $this->resLogFactory->create()->deleteUserAttempts($order->getCustomerEmail());
+ return $result;
+ }
+}
diff --git a/vendor/magento/module-captcha/composer.json b/vendor/magento/module-captcha/composer.json
index 5f9c0d31d7f..235f8e4bf6b 100644
--- a/vendor/magento/module-captcha/composer.json
+++ b/vendor/magento/module-captcha/composer.json
@@ -16,6 +16,7 @@
"magento/module-backend": "102.0.*",
"magento/module-checkout": "100.4.*",
"magento/module-customer": "103.0.*",
+ "magento/module-sales": "*",
"magento/module-store": "101.1.*",
"magento/module-authorization": "100.4.*",
"laminas/laminas-captcha": "^2.7.1",
diff --git a/vendor/magento/module-captcha/etc/frontend/di.xml b/vendor/magento/module-captcha/etc/frontend/di.xml
index 490f1eab851..6ecbb156b44 100644
--- a/vendor/magento/module-captcha/etc/frontend/di.xml
+++ b/vendor/magento/module-captcha/etc/frontend/di.xml
@@ -34,4 +34,7 @@
+
+
+
diff --git a/vendor/magento/module-captcha/etc/frontend/sections.xml b/vendor/magento/module-captcha/etc/frontend/sections.xml
index 7f2070e10c8..665d989e229 100644
--- a/vendor/magento/module-captcha/etc/frontend/sections.xml
+++ b/vendor/magento/module-captcha/etc/frontend/sections.xml
@@ -10,4 +10,10 @@
+
+
+
+
+
+
diff --git a/vendor/magento/module-captcha/etc/module.xml b/vendor/magento/module-captcha/etc/module.xml
index 36a44a65430..7a7ffc7f460 100644
--- a/vendor/magento/module-captcha/etc/module.xml
+++ b/vendor/magento/module-captcha/etc/module.xml
@@ -10,6 +10,7 @@
+
diff --git a/vendor/magento/module-captcha/etc/webapi_rest/di.xml b/vendor/magento/module-captcha/etc/webapi_rest/di.xml
new file mode 100644
index 00000000000..7c5efea56a4
--- /dev/null
+++ b/vendor/magento/module-captcha/etc/webapi_rest/di.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/vendor/magento/module-captcha/view/frontend/web/js/action/refresh.js b/vendor/magento/module-captcha/view/frontend/web/js/action/refresh.js
index c82278269ad..030a990ce2a 100644
--- a/vendor/magento/module-captcha/view/frontend/web/js/action/refresh.js
+++ b/vendor/magento/module-captcha/view/frontend/web/js/action/refresh.js
@@ -4,18 +4,21 @@
*/
define([
- 'mage/storage'
-], function (storage) {
+ 'jquery', 'mage/url'
+], function ($, urlBuilder) {
'use strict';
return function (refreshUrl, formId, imageSource) {
- return storage.post(
- refreshUrl,
- JSON.stringify({
+ return $.ajax({
+ url: urlBuilder.build(refreshUrl),
+ type: 'POST',
+ async: false,
+ data: JSON.stringify({
'formId': formId
}),
- false
- ).done(
+ global: false,
+ contentType: 'application/json'
+ }).done(
function (response) {
if (response.imgSrc) {
imageSource(response.imgSrc);
diff --git a/vendor/magento/module-captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js b/vendor/magento/module-captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
index d79c42a7115..2e32efb3233 100644
--- a/vendor/magento/module-captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
+++ b/vendor/magento/module-captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
@@ -21,6 +21,7 @@ define([
},
dataScope: 'global',
currentCaptcha: null,
+ subscribedFormIds: [],
/**
* @return {*}
@@ -74,9 +75,12 @@ define([
* @param {Object} captcha
*/
subscribeCustomerData: function (formId, captcha) {
- customerData.get('captcha').subscribe(function (captchaData) {
- this.checkCustomerData(formId, captchaData, captcha);
- }.bind(this));
+ if (this.subscribedFormIds.includes(formId) === false) {
+ this.subscribedFormIds.push(formId);
+ customerData.get('captcha').subscribe(function (captchaData) {
+ this.checkCustomerData(formId, captchaData, captcha);
+ }.bind(this));
+ }
},
/**