Skip to content

Conversation

@lbajsarowicz
Copy link

Description (*)

According to the official documentation, Magento 2.4.7 comes without ReCaptcha coverage for Contact form GraphQL endpoint.

image

This Pull Requests fills this incomprehensible gap.

Fixed Issues (if relevant)

  1. magento/magento2#<issue_number>: Issue title

Manual testing scenarios (*)

GraphQL call to verify:

mutation { contactUs( input: { email: "test@example.com", name: "Test User", telephone: "1234567890", comment: "This is a test comment." } ) { status } }

Questions or comments

Contribution checklist (*)

  • Author has signed the Adobe CLA
  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)
@lbajsarowicz
Copy link
Author

@magento run all tests

@lbajsarowicz lbajsarowicz changed the title Add missing ReCaptcha coverage for Contact GraphQL (SwiftOtter's SOP-348) Add ReCaptcha coverage for Contact GraphQL (SwiftOtter's SOP-348) May 14, 2024
@lbajsarowicz
Copy link
Author

@ihor-sviziev Can you take a look?

@lbajsarowicz
Copy link
Author

@hostep
Copy link

hostep commented Jul 29, 2024

Tagging @nathanjosiah, maybe he'll be able to move this PR forward

public function getConfigFor(EndpointInterface $endpoint): ?ValidationConfigInterface
{
if ($endpoint->getServiceMethod() === 'resolve'
&& $endpoint->getServiceClass() === ContactUs::class) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see in other places we have a || here. are you sure it should be &&?
Example: https://github.com/magento/security-package/blob/develop/ReCaptchaCustomer/Model/WebapiConfigProvider.php#L65-L69

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ihor-sviziev After the research, I found out that \Magento\ReCaptchaSendFriend\Model\WebapiConfigProvider::getConfigFor is the most in-line with Contact form, that's why it's && not ||

<type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider">
<arguments>
<argument name="providers" xsi:type="array">
<item name="contactUs" xsi:type="object">Magento\ReCaptchaContact\Model\WebapiConfigProvider</item>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not "Contact", as a module name?

Suggested change
<item name="contactUs" xsi:type="object">Magento\ReCaptchaContact\Model\WebapiConfigProvider</item>
<item name="contact" xsi:type="object">Magento\ReCaptchaContact\Model\WebapiConfigProvider</item>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Introduced change in the codebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants