Skip to content

Commit 117674e

Browse files
author
Anna Bukatar
committed
ACP2E-1311: Magento forms can be submitted before the Google Recaptcha appears in the form
1 parent 6dbb7fc commit 117674e

File tree

31 files changed

+242
-115
lines changed

31 files changed

+242
-115
lines changed

app/code/Magento/Contact/view/frontend/layout/contact_index_index.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<body>
1313
<referenceContainer name="content">
1414
<block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
15+
<arguments>
16+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
17+
</arguments>
1518
<container name="form.additional.info" label="Form Additional Info"/>
1619
</block>
1720
</referenceContainer>

app/code/Magento/Contact/view/frontend/templates/form.phtml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ $viewModel = $block->getViewModel();
8080
<div class="actions-toolbar">
8181
<div class="primary">
8282
<input type="hidden" name="hideit" id="hideit" value="" />
83-
<button type="submit" title="<?= $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary">
83+
<button type="submit" title="<?= $block->escapeHtmlAttr(__('Submit')) ?>" class="action submit primary"
84+
id="send2"
85+
<?php if ($block->getButtonLockManager()->isDisabled('contact_us_form_submit')): ?>
86+
disabled="disabled"
87+
<?php endif; ?>>
8488
<span><?= $block->escapeHtml(__('Submit')) ?></span>
8589
</button>
8690
</div>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection/StorefrontCustomerSignInFormSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<element name="emailField" type="input" selector="#email"/>
1212
<element name="passwordField" type="input" selector="#pass"/>
1313
<element name="showPasswordCheckbox" type="input" selector="#show-password"/>
14-
<element name="signInAccountButton" type="button" selector="#send2" timeout="30"/>
14+
<element name="signInAccountButton" type="button" selector="(//button[@id='send2'][contains(@class, 'login')])[1]" timeout="30"/>
1515
<element name="forgotPasswordLink" type="button" selector=".action.remind" timeout="10"/>
1616
<element name="customerLoginBlock" type="text" selector=".login-container .block.block-customer-login"/>
1717
<element name="signInAccountLink" type="button" selector="//header[@class='page-header']//li/a[contains(.,'Sign In')]"/>

app/code/Magento/Customer/Test/Mftf/Section/StorefrontCustomerSignInFormSection/StorefrontCustomerSignInPopupFormSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<element name="errorMessage" type="input" selector="[data-ui-id='checkout-cart-validationmessages-message-error']"/>
1212
<element name="email" type="input" selector="#customer-email"/>
1313
<element name="password" type="input" selector="#pass"/>
14-
<element name="signIn" type="button" selector="#send2" timeout="30"/>
14+
<element name="signIn" type="button" selector="(//button[@id='send2'][contains(@class, 'login')])[1]" timeout="30"/>
1515
<element name="forgotYourPassword" type="button" selector="//a[@class='action']//span[contains(text(),'Forgot Your Password?')]" timeout="30"/>
1616
<element name="createAnAccount" type="button" selector="//div[contains(@class,'actions-toolbar')]//a[contains(.,'Create an Account')]" timeout="30"/>
1717
</section>

app/code/Magento/Customer/ViewModel/CreateAccountButton.php

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

app/code/Magento/Customer/ViewModel/ForgotPasswordButton.php

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

app/code/Magento/Customer/ViewModel/LoginButton.php

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

app/code/Magento/Customer/view/frontend/layout/customer_account_create.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<arguments>
1919
<argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument>
2020
<argument name="region_provider" xsi:type="object">Magento\Customer\ViewModel\Address\RegionProvider</argument>
21-
<argument name="create_account_button_view_model" xsi:type="object">Magento\Customer\ViewModel\CreateAccountButton</argument>
21+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
2222
</arguments>
2323
<container name="form.additional.info" as="form_additional_info"/>
2424
<container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/>

app/code/Magento/Customer/view/frontend/layout/customer_account_edit.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
</referenceBlock>
2222
<referenceContainer name="content">
2323
<block class="Magento\Customer\Block\Form\Edit" name="customer_edit" template="Magento_Customer::form/edit.phtml" cacheable="false">
24+
<arguments>
25+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
26+
</arguments>
2427
<container name="form.additional.info" as="form_additional_info"/>
2528
</block>
2629
</referenceContainer>

app/code/Magento/Customer/view/frontend/layout/customer_account_forgotpassword.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<referenceContainer name="content">
1919
<block class="Magento\Customer\Block\Account\Forgotpassword" name="forgotPassword" template="Magento_Customer::form/forgotpassword.phtml">
2020
<arguments>
21-
<argument name="forgot_password_button_view_model" xsi:type="object">Magento\Customer\ViewModel\ForgotPasswordButton</argument>
21+
<argument name="button_lock_manager" xsi:type="object">Magento\Framework\View\Element\ButtonLockManager</argument>
2222
</arguments>
2323
<container name="form.additional.info" as="form_additional_info"/>
2424
</block>

0 commit comments

Comments
 (0)