Skip to content

Commit 220533a

Browse files
author
Anna Bukatar
committed
ACP2E-1311: Magento forms can be submitted before the Google Recaptcha appears in the form
1 parent 4b1ac02 commit 220533a

File tree

13 files changed

+194
-322
lines changed

13 files changed

+194
-322
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
10+
11+
<type name="Magento\Framework\View\Element\ButtonLockManager">
12+
<arguments>
13+
<argument name="buttonLockPool" xsi:type="array">
14+
<item name="contact_us_form_submit" xsi:type="object">Magento\ReCaptchaContact\Model\ButtonLock\ContactUsFormSubmit</item>
15+
</argument>
16+
</arguments>
17+
</type>
18+
19+
<virtualType name="Magento\ReCaptchaContact\Model\ButtonLock\ContactUsFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock">
20+
<arguments>
21+
<argument name="buttonCode" xsi:type="string">contact_us_form_submit</argument>
22+
<argument name="reCaptchaId" xsi:type="string">contact</argument>
23+
</arguments>
24+
</virtualType>
25+
</config>

ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php

Lines changed: 0 additions & 46 deletions
This file was deleted.

ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php

Lines changed: 0 additions & 55 deletions
This file was deleted.

ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php

Lines changed: 0 additions & 61 deletions
This file was deleted.

ReCaptchaCustomer/etc/frontend/di.xml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,38 @@
2020
<plugin sortOrder="1" name="inject_recaptcha_in_authentication_popup"
2121
type="Magento\ReCaptchaCustomer\Plugin\Block\Account\InjectRecaptchaInAuthenticationPopup"/>
2222
</type>
23-
<type name="Magento\Customer\ViewModel\LoginButton">
24-
<plugin sortOrder="1" name="recaptcha_disable_login_button"
25-
type="Magento\ReCaptchaCustomer\Plugin\Customer\DisableLoginButton"/>
26-
</type>
27-
<type name="Magento\Customer\ViewModel\CreateAccountButton">
28-
<plugin sortOrder="1" name="recaptcha_disable_create_account_button"
29-
type="Magento\ReCaptchaCustomer\Plugin\Customer\DisableCreateAccountButton"/>
30-
</type>
31-
<type name="Magento\Customer\ViewModel\ForgotPasswordButton">
32-
<plugin sortOrder="1" name="recaptcha_disable_forgot_password_button"
33-
type="Magento\ReCaptchaCustomer\Plugin\Customer\DisableForgotPasswordButton"/>
23+
<type name="Magento\Framework\View\Element\ButtonLockManager">
24+
<arguments>
25+
<argument name="buttonLockPool" xsi:type="array">
26+
<item name="customer_create_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerCreateFormSubmit</item>
27+
<item name="customer_edit_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerEditFormSubmit</item>
28+
<item name="customer_forgot_password_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerForgotPasswordFormSubmit</item>
29+
<item name="customer_login_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerLoginFormSubmit</item>
30+
</argument>
31+
</arguments>
3432
</type>
33+
<virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerCreateFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock">
34+
<arguments>
35+
<argument name="buttonCode" xsi:type="string">customer_create_form_submit</argument>
36+
<argument name="reCaptchaId" xsi:type="string">customer_create</argument>
37+
</arguments>
38+
</virtualType>
39+
<virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerEditFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock">
40+
<arguments>
41+
<argument name="buttonCode" xsi:type="string">customer_edit_form_submit</argument>
42+
<argument name="reCaptchaId" xsi:type="string">customer_edit</argument>
43+
</arguments>
44+
</virtualType>
45+
<virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerForgotPasswordFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock">
46+
<arguments>
47+
<argument name="buttonCode" xsi:type="string">customer_forgot_password_form_submit</argument>
48+
<argument name="reCaptchaId" xsi:type="string">customer_forgot_password</argument>
49+
</arguments>
50+
</virtualType>
51+
<virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerLoginFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock">
52+
<arguments>
53+
<argument name="buttonCode" xsi:type="string">customer_login_form_submit</argument>
54+
<argument name="reCaptchaId" xsi:type="string">customer_login</argument>
55+
</arguments>
56+
</virtualType>
3557
</config>

0 commit comments

Comments
 (0)