Repository navigation
Decouple reCAPTCHA type modules from the GraphQL config interface - #348
Open
lbajsarowicz wants to merge 1 commit into
Open
lbajsarowicz wants to merge 1 commit into
lbajsarowicz wants to merge 1 commit into
Conversation
Move the reCAPTCHA configuration contract to Magento_ReCaptchaUi so the version 2 and version 3 modules no longer require Magento_ReCaptchaWebapiGraphQl. The GraphQL interface stays as a deprecated extension of the new one; the GraphQL module now declares the V2 packages it already wires. magento/magento2#41558
Author
|
@magento run all tests |
1 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The three reCAPTCHA type modules (
Magento_ReCaptchaVersion2Checkbox,Magento_ReCaptchaVersion2Invisible,Magento_ReCaptchaVersion3Invisible) implementMagento\ReCaptchaWebapiGraphQl\Model\Adapter\ReCaptchaConfigInterfacein theirModel\Configclasses and requiremagento/module-re-captcha-webapi-graph-qlincomposer.json. The interface is a plain configuration contract (getWebsiteKey,getTheme,getLanguageCode,getMinimumScore,getBadgePosition) with nothing GraphQL-specific in it, yet it lives in the GraphQL module. The GraphQL module in turn requiresmodule-re-captcha-version-3-invisible, so the two depend on each other. A store that disables or replaces the GraphQL packages (a common hardening step on Luma / Hyvä / REST-only builds) loses every reCAPTCHA type at class load time.This PR moves the contract to
Magento\ReCaptchaUi\Model\ReCaptchaConfigInterface(the three type modules already requiremagento/module-re-captcha-ui), keeps the GraphQL interface as a deprecated empty extension of the new one so existing implementations still satisfy it, switches the threeConfigclasses to the new interface, and drops the GraphQL requirement from theircomposer.json.ReCaptchaWebapiGraphQlnow declares the two V2 packages it already wires inetc/graphql/di.xml, so the dependency direction is GraphQL → reCAPTCHA types, never the reverse.Behaviour of the GraphQL resolvers is unchanged:
ReCaptchaFormConfigreceives the sameConfigobjects through DI, andReCaptchaV3type-hints the concrete V3Config. The one visible change for extensions: the coreConfigclasses no longer implement the old GraphQL interface, so an extension that type-hintsMagento\ReCaptchaWebapiGraphQl\Model\Adapter\ReCaptchaConfigInterfaceand receives a coreConfigmust switch to theReCaptchaUiinterface. Custom implementations of the old interface keep working because it extends the new one.Related Pull Requests / Issues
Part of magento/magento2#41558 (non-GraphQL modules coupled to
*GraphQlmodules). A second PR in this repository removes the GraphQL requirements fromReCaptchaContactandReCaptchaResendConfirmationEmail.Manual testing scenarios
magento/module-re-captcha-webapi-graph-qlremoved throughreplacein the rootcomposer.json, enable reCAPTCHA v3 invisible for the customer login form, open the storefront login page: the badge renders and a login with a valid token succeeds.recaptchaFormConfigandrecaptchaV3Configqueries; output is identical todevelop.Verification
PHPCS (Magento2 standard) on the changed PHP files: 0 errors, 0 warnings.
check_copyright_pr.phpas run bypr-quality-gates: all files pass. No unit tests cover these classes in the repository.Contribution checklist