From ad8fc1815f41448354954580b834dcfe14a21a7a Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Thu, 28 Oct 2021 15:10:53 +0530 Subject: [PATCH 001/208] AC-461: Add reCAPTCHA support to coupon code --- .../LayoutProcessor/Checkout/Onepage.php | 62 ++++++++ .../Model/WebapiConfigProvider.php | 65 +++++++++ .../Observer/CouponCodeObserver.php | 73 ++++++++++ .../Plugin/CouponSetLayoutPlugin.php | 38 +++++ ReCaptchaCheckoutSalesRule/README.md | 6 + .../Test/Api/CouponApplyFormRecaptchaTest.php | 115 +++++++++++++++ .../Test/Api/CouponApplyGraphQLTest.php | 72 ++++++++++ .../Test/Integration/CouponApplyPostTest.php | 133 ++++++++++++++++++ ReCaptchaCheckoutSalesRule/composer.json | 26 ++++ .../etc/adminhtml/system.xml | 21 +++ ReCaptchaCheckoutSalesRule/etc/config.xml | 17 +++ ReCaptchaCheckoutSalesRule/etc/di.xml | 17 +++ .../etc/frontend/di.xml | 20 +++ .../etc/frontend/events.xml | 13 ++ ReCaptchaCheckoutSalesRule/etc/module.xml | 11 ++ ReCaptchaCheckoutSalesRule/registration.php | 12 ++ .../frontend/layout/checkout_cart_index.xml | 29 ++++ .../frontend/layout/checkout_index_index.xml | 52 +++++++ .../view/frontend/web/css/source/_module.less | 9 ++ .../frontend/web/js/checkout-sales-rule.js | 80 +++++++++++ .../view/frontend/web/js/reCaptcha.js | 6 +- _metapackage/composer.json | 3 +- 22 files changed, 878 insertions(+), 2 deletions(-) create mode 100644 ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php create mode 100644 ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php create mode 100644 ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php create mode 100644 ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php create mode 100644 ReCaptchaCheckoutSalesRule/README.md create mode 100644 ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php create mode 100644 ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php create mode 100644 ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php create mode 100644 ReCaptchaCheckoutSalesRule/composer.json create mode 100644 ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml create mode 100644 ReCaptchaCheckoutSalesRule/etc/config.xml create mode 100644 ReCaptchaCheckoutSalesRule/etc/di.xml create mode 100644 ReCaptchaCheckoutSalesRule/etc/frontend/di.xml create mode 100644 ReCaptchaCheckoutSalesRule/etc/frontend/events.xml create mode 100644 ReCaptchaCheckoutSalesRule/etc/module.xml create mode 100644 ReCaptchaCheckoutSalesRule/registration.php create mode 100644 ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_cart_index.xml create mode 100644 ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml create mode 100644 ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less create mode 100644 ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js diff --git a/ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php new file mode 100644 index 00000000..6cf7b10f --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php @@ -0,0 +1,62 @@ +captchaUiConfigResolver = $captchaUiConfigResolver; + $this->isCaptchaEnabled = $isCaptchaEnabled; + } + + /** + * @inheritDoc + */ + public function process($jsLayout) + { + $key = 'coupon_code'; + if ($this->isCaptchaEnabled->isCaptchaEnabledFor($key)) { + $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['afterMethods']['children']['discount']['children'] + ['checkout_sales_rule']['settings'] = $this->captchaUiConfigResolver->get($key); + } else { + if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['afterMethods']['children']['discount']['children']['checkout_sales_rule'])) { + unset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['afterMethods']['children']['discount']['children']['checkout_sales_rule']); + } + } + + return $jsLayout; + } +} diff --git a/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php b/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php new file mode 100644 index 00000000..f68d9e5d --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php @@ -0,0 +1,65 @@ +isEnabled = $isEnabled; + $this->configResolver = $configResolver; + } + + /** + * @inheritDoc + */ + public function getConfigFor(EndpointInterface $endpoint): ?ValidationConfigInterface + { + //phpcs:disable Magento2.PHP.LiteralNamespaces + if ((($endpoint->getServiceClass() === 'Magento\Quote\Api\CouponManagementInterface' || + $endpoint->getServiceClass() === 'Magento\Quote\Api\GuestCouponManagementInterface') && + $endpoint->getServiceMethod() === 'set') + || ($endpoint->getServiceClass() === 'Magento\QuoteGraphQl\Model\Resolver\ApplyCouponToCart' + || $endpoint->getServiceMethod() === 'ApplyCouponToCart') + || ($endpoint->getServiceClass() === 'Magento\Checkout\Controller\Cart\CouponPost' + && $endpoint->getServiceMethod() === 'execute') + ) { + if ($this->isEnabled->isCaptchaEnabledFor(self::CAPTCHA_ID)) { + return $this->configResolver->get(self::CAPTCHA_ID); + } + } + //phpcs:enable Magento2.PHP.LiteralNamespaces + + return null; + } +} diff --git a/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php new file mode 100644 index 00000000..e1cfbebf --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php @@ -0,0 +1,73 @@ +redirect = $redirect; + $this->isCaptchaEnabled = $isCaptchaEnabled; + $this->requestHandler = $requestHandler; + } + + /** + * @inheritdoc + * @param Observer $observer + * @return void + * @throws InputException + */ + public function execute(Observer $observer): void + { + if ($this->isCaptchaEnabled->isCaptchaEnabledFor(self::CAPTCHA_KEY)) { + /** @var Action $controller */ + $controller = $observer->getControllerAction(); + $request = $controller->getRequest(); + $response = $controller->getResponse(); + $redirectOnFailureUrl = $this->redirect->getRefererUrl(); + + $this->requestHandler->execute(self::CAPTCHA_KEY, $request, $response, $redirectOnFailureUrl); + } + } +} diff --git a/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php b/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php new file mode 100644 index 00000000..a6a972a0 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php @@ -0,0 +1,38 @@ +getChildBlock('captcha')) { + $subject->addChild( + 'captcha', + ReCaptcha::class, + [ + 'jsLayout' => [ + 'components' => [ + 'captcha' => ['component' => 'Magento_ReCaptchaFrontendUi/js/reCaptcha'] + ] + ] + ] + ); + } + return $subject; + } +} diff --git a/ReCaptchaCheckoutSalesRule/README.md b/ReCaptchaCheckoutSalesRule/README.md new file mode 100644 index 00000000..3898b6fd --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/README.md @@ -0,0 +1,6 @@ +Magento reCAPTCHA +Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. + +This module provides the reCAPTCHA implementations related to coupon code apply action on checkout cart & payment. + +For more information please visit the Magento document for reCAPTCHA. \ No newline at end of file diff --git a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php new file mode 100644 index 00000000..1bd5b150 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php @@ -0,0 +1,115 @@ +_markTestAsRestOnly(); + $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->quoteFactory = $this->objectManager->get(QuoteFactory::class); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote.php + * @magentoApiDataFixture Magento/Customer/_files/customer.php + * @magentoConfigFixture default_store customer/captcha/enable 0 + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible + */ + public function testRequired(): void + { + $this->expectException(\Throwable::class); + $this->expectExceptionCode(400); + $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again","trace":null}'); + + // get customer ID token + /** @var \Magento\Integration\Api\CustomerTokenServiceInterface $customerTokenService */ + $customerTokenService = $this->objectManager->create( + \Magento\Integration\Api\CustomerTokenServiceInterface::class + ); + $token = $customerTokenService->createCustomerAccessToken('customer@example.com', 'password'); + + /** @var Quote $quote */ + $quote = $this->quoteFactory->create(); + $quote->load('test_order_1', 'reserved_order_id'); + $cartId = $quote->getId(); + + $api_url = sprintf(self::API_ROUTE, self::COUPON_CODE); + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => $api_url, + 'httpMethod' => Request::HTTP_METHOD_PUT, + 'token' => $token, + ], + ]; + $requestData = [ + 'cart_id' => $cartId + ]; + + $this->_webApiCall($serviceInfo, $requestData); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote.php + * @magentoConfigFixture default_store customer/captcha/enable 0 + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible + */ + public function testGuestCartTest(): void + { + $this->expectException(\Throwable::class); + $this->expectExceptionCode(400); + $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again","trace":null}'); + + /** @var Quote $quote */ + $quote = $this->quoteFactory->create(); + $quote->load('test_order_1', 'reserved_order_id'); + $cartId = $quote->getId(); + $api_url = "/V1/guest-carts/$cartId/coupons/".self::COUPON_CODE; + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => $api_url, + 'httpMethod' => Request::HTTP_METHOD_PUT, + 'token' => null + ], + ]; + $requestData = []; + $this->_webApiCall($serviceInfo, $requestData); + } +} diff --git a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php new file mode 100644 index 00000000..17240f73 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php @@ -0,0 +1,72 @@ +quoteFactory = $objectManager->get(QuoteFactory::class); + } + + /** + * @magentoApiDataFixture Magento/Checkout/_files/quote.php + * @magentoConfigFixture default_store customer/captcha/enable 0 + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible + */ + public function testCreateCouponApply(): void + { + $this->expectExceptionMessage('ReCaptcha validation failed, please try again'); + + /** @var Quote $quote */ + $quote = $this->quoteFactory->create(); + $quote->load('test_order_1', 'reserved_order_id'); + $cartId = $quote->getId(); + + $query = <<graphQlMutation($query); + } +} diff --git a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php new file mode 100644 index 00000000..66355008 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php @@ -0,0 +1,133 @@ +customerSession = $this->_objectManager->get(Session::class); + $this->customerSession->setCustomerId(self::CUSTOMER_ID); + $this->url = $this->_objectManager->get(UrlInterface::class); + } + + /** + * Checks the coupon post with ReCaptcha validation when `g-recaptcha-response` missed + * + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible + * + * It's needed for proper work of "ifconfig" in layout during tests running + * @magentoConfigFixture default_store recaptcha_frontend/type_for/coupon_code invisible + * @magentoDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php + */ + public function testPostRequestIfReCaptchaParameterIsMissed(): void + { + $this->checkFailedPostRequest(); + } + + /** + * Checks the failed coupon post with ReCaptcha validation + * + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible + * + * @magentoConfigFixture default_store recaptcha_frontend/type_for/coupon_code invisible + * @magentoDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php + */ + public function testPostRequestWithFailedReCaptchaValidation(): void + { + $this->checkFailedPostRequest(true); + $this->assertSessionMessages( + $this->equalTo(['Something went wrong with reCAPTCHA. Please contact the store owner.']), + \Magento\Framework\Message\MessageInterface::TYPE_ERROR + ); + } + + /** + * Checks failed sharing process + * + * @param bool $withParamReCaptcha + */ + private function checkFailedPostRequest(bool $withParamReCaptcha = false): void + { + $this->makePostRequest($withParamReCaptcha); + $this->assertSessionMessages( + $this->equalTo(['Something went wrong with reCAPTCHA. Please contact the store owner.']), + MessageInterface::TYPE_ERROR + ); + } + + /** + * Makes post request + * + * @param bool $withParamReCaptcha + * @return void + */ + private function makePostRequest(bool $withParamReCaptcha = false): void + { + $postValue = [ + 'remove' => 0, + 'coupon_code' => 'test' + ]; + + if ($withParamReCaptcha) { + $postValue[CaptchaResponseResolverInterface::PARAM_RECAPTCHA] = 'test'; + } + + $this->getRequest() + ->setMethod(Http::METHOD_POST) + ->setPostValue($postValue); + + $this->dispatch('checkout/cart/couponPost/'); + } + + /** + * @inheritDoc + */ + public function tearDown(): void + { + $this->customerSession->setCustomerId(null); + parent::tearDown(); + } +} diff --git a/ReCaptchaCheckoutSalesRule/composer.json b/ReCaptchaCheckoutSalesRule/composer.json new file mode 100644 index 00000000..b1632765 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/composer.json @@ -0,0 +1,26 @@ +{ + "name": "magento/module-re-captcha-checkout-sales-rule", + "description": "Google ReCaptcha integration for Magento2 coupons", + "require": { + "php": "~7.4.0||~8.0.0", + "magento/framework": "*", + "magento/module-checkout": "*", + "magento/module-sales-rule": "*", + "magento/module-re-captcha-ui": "*", + "magento/module-re-captcha-validation-api": "*", + "magento/module-re-captcha-admin-ui": "*", + "magento/module-re-captcha-frontend-ui": "*", + "magento/module-re-captcha-webapi-api": "*", + "magento/module-re-captcha-webapi-ui": "*" + }, + "type": "magento2-module", + "license": "OSL-3.0", + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\ReCaptchaCheckoutSalesRule\\": "" + } + } +} diff --git a/ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml b/ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml new file mode 100644 index 00000000..87faa3b0 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml @@ -0,0 +1,21 @@ + + + + +
+ + + + Magento\ReCaptchaAdminUi\Model\OptionSource\Type + + +
+
+
diff --git a/ReCaptchaCheckoutSalesRule/etc/config.xml b/ReCaptchaCheckoutSalesRule/etc/config.xml new file mode 100644 index 00000000..a49b695d --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/etc/config.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/ReCaptchaCheckoutSalesRule/etc/di.xml b/ReCaptchaCheckoutSalesRule/etc/di.xml new file mode 100644 index 00000000..f35f2636 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/etc/di.xml @@ -0,0 +1,17 @@ + + + + + + + Magento\ReCaptchaCheckoutSalesRule\Model\WebapiConfigProvider + + + + \ No newline at end of file diff --git a/ReCaptchaCheckoutSalesRule/etc/frontend/di.xml b/ReCaptchaCheckoutSalesRule/etc/frontend/di.xml new file mode 100644 index 00000000..6130ef3c --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/etc/frontend/di.xml @@ -0,0 +1,20 @@ + + + + + + + + + + Magento\ReCaptchaCheckoutSalesRule\Block\LayoutProcessor\Checkout\Onepage + + + + diff --git a/ReCaptchaCheckoutSalesRule/etc/frontend/events.xml b/ReCaptchaCheckoutSalesRule/etc/frontend/events.xml new file mode 100644 index 00000000..2436e87d --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/etc/frontend/events.xml @@ -0,0 +1,13 @@ + + + + + + + diff --git a/ReCaptchaCheckoutSalesRule/etc/module.xml b/ReCaptchaCheckoutSalesRule/etc/module.xml new file mode 100644 index 00000000..ea717982 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/etc/module.xml @@ -0,0 +1,11 @@ + + + + + diff --git a/ReCaptchaCheckoutSalesRule/registration.php b/ReCaptchaCheckoutSalesRule/registration.php new file mode 100644 index 00000000..adf95955 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/registration.php @@ -0,0 +1,12 @@ + + + + + + + + coupon_code + + + + Magento_ReCaptchaFrontendUi/js/reCaptcha + + + + + + + + diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml b/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml new file mode 100644 index 00000000..7509e6eb --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + uiComponent + + + + + + + Magento_SalesRule/js/view/payment/discount + + + Magento_ReCaptchaCheckoutSalesRule/js/checkout-sales-rule + captcha + checkout-sales-rule-request + checkoutConfig + recaptcha-checkout-coupon-apply + + + + + + + + + + + + + + + + + + + diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less b/ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less new file mode 100644 index 00000000..85870020 --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less @@ -0,0 +1,9 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +.form-discount { + .g-recaptcha { + margin-top: 50px !important; + } +} diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js new file mode 100644 index 00000000..56bb323e --- /dev/null +++ b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js @@ -0,0 +1,80 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +/* global grecaptcha */ +define( + [ + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptcha', + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry', + 'jquery', + 'Magento_SalesRule/js/action/set-coupon-code', + 'Magento_SalesRule/js/action/cancel-coupon', + 'Magento_Checkout/js/model/quote', + 'ko' + ], function (Component, recaptchaRegistry, $, setCouponCodeAction, cancelCouponAction, quote, ko) { + 'use strict'; + + var totals = quote.getTotals(), + couponCode = ko.observable(null), + isApplied; + + if (totals()) { + couponCode(totals()['coupon_code']); + } + //Captcha can only be required for adding a coupon so we need to know if one was added already. + isApplied = ko.observable(couponCode() != null); + + return Component.extend({ + + /** + * Initialize parent form. + * + * @param {Object} parentForm + * @param {String} widgetId + */ + initParentForm: function (parentForm, widgetId) { + var self = this, + xRecaptchaValue, + captchaId = this.getReCaptchaId(); + + this._super(); + + if (couponCode() != null) { + if (isApplied) { + self.validateReCaptcha(true); + $('#' + captchaId).hide(); + } + } + + if (recaptchaRegistry.triggers.hasOwnProperty('recaptcha-checkout-coupon-apply')) { + recaptchaRegistry.addListener('recaptcha-checkout-coupon-apply', function (token) { + //Add reCaptcha value to coupon request + xRecaptchaValue = token; + }); + } + + setCouponCodeAction.registerDataModifier(function (headers) { + headers['X-ReCaptcha'] = xRecaptchaValue; + }); + + //Refresh reCaptcha after failed request. + setCouponCodeAction.registerFailCallback(function () { + self.validateReCaptcha(false); + grecaptcha.reset(widgetId); + $('#' + captchaId).show(); + }); + //Hide captcha when a coupon has been applied. + setCouponCodeAction.registerSuccessCallback(function () { + self.validateReCaptcha(true); + $('#' + captchaId).hide(); + }); + //Show captcha again if it was canceled. + cancelCouponAction.registerSuccessCallback(function () { + self.validateReCaptcha(false); + grecaptcha.reset(widgetId); + $('#' + captchaId).show(); + }); + } + }); + }); diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index c88dccd9..9528f06e 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -59,7 +59,6 @@ define( * @returns {Boolean} */ getIsInvisibleRecaptcha: function () { - if (this.settings === void 0) { @@ -113,6 +112,11 @@ define( $parentForm = $wrapper.parents('form'); + if (this.settings === undefined) { + + return; + } + parameters = _.extend( { 'callback': function (token) { // jscs:ignore jsDoc diff --git a/_metapackage/composer.json b/_metapackage/composer.json index bf5fe0b7..23d52829 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -27,6 +27,7 @@ "magento/module-re-captcha-webapi-ui": "*", "magento/module-securitytxt": "*", "magento/module-two-factor-auth": "*", - "google/recaptcha": "^1.2" + "google/recaptcha": "^1.2", + "magento/module-re-captcha-checkout-sales-rule": "*" } } From da139fc429e36b717ff5c43ba7a9c8c5868762b9 Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Thu, 28 Oct 2021 17:23:32 +0530 Subject: [PATCH 002/208] AC-461: Add reCAPTCHA support to coupon code * Fixed webApi-test --- .../Test/Api/CouponApplyFormRecaptchaTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php index 1bd5b150..262cb0c7 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php @@ -54,7 +54,7 @@ public function testRequired(): void { $this->expectException(\Throwable::class); $this->expectExceptionCode(400); - $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again","trace":null}'); + $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again"}'); // get customer ID token /** @var \Magento\Integration\Api\CustomerTokenServiceInterface $customerTokenService */ @@ -94,7 +94,7 @@ public function testGuestCartTest(): void { $this->expectException(\Throwable::class); $this->expectExceptionCode(400); - $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again","trace":null}'); + $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again"}'); /** @var Quote $quote */ $quote = $this->quoteFactory->create(); From 0acc76a5da3bb7679d2a8db74b02dced34c1b94a Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Tue, 2 Nov 2021 14:20:47 +0530 Subject: [PATCH 003/208] AC-461: Add reCAPTCHA support to coupon code * Updated test case in Integration test * Fixed review comments --- .../Model/WebapiConfigProvider.php | 2 - .../Test/Integration/CouponApplyPostTest.php | 56 ++++++++++++++++--- 2 files changed, 47 insertions(+), 11 deletions(-) diff --git a/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php b/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php index f68d9e5d..422313db 100644 --- a/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php +++ b/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php @@ -51,8 +51,6 @@ public function getConfigFor(EndpointInterface $endpoint): ?ValidationConfigInte $endpoint->getServiceMethod() === 'set') || ($endpoint->getServiceClass() === 'Magento\QuoteGraphQl\Model\Resolver\ApplyCouponToCart' || $endpoint->getServiceMethod() === 'ApplyCouponToCart') - || ($endpoint->getServiceClass() === 'Magento\Checkout\Controller\Cart\CouponPost' - && $endpoint->getServiceMethod() === 'execute') ) { if ($this->isEnabled->isCaptchaEnabledFor(self::CAPTCHA_ID)) { return $this->configResolver->get(self::CAPTCHA_ID); diff --git a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php index 66355008..60c87a4d 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php @@ -8,14 +8,14 @@ namespace Magento\ReCaptchaCheckoutSalesRule\Test\Integration; use Magento\Customer\Model\Session; +use Magento\Checkout\Model\Session as CheckoutSession; use Magento\Framework\App\Request\Http; use Magento\Framework\Message\MessageInterface; use Magento\TestFramework\TestCase\AbstractController; use Magento\ReCaptchaUi\Model\CaptchaResponseResolverInterface; -use Magento\Framework\UrlInterface; /** - * Tests for create wish list + * Tests for Coupon Post form * * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDbIsolation enabled @@ -29,14 +29,16 @@ class CouponApplyPostTest extends AbstractController private const CUSTOMER_ID = 1; /** + * Customer session * @var Session */ private $customerSession; /** - * @var UrlInterface + * Checkout Session + * @var Session */ - private $url; + private $checkoutSession; /** * @inheritdoc @@ -46,7 +48,25 @@ protected function setUp(): void parent::setUp(); $this->customerSession = $this->_objectManager->get(Session::class); $this->customerSession->setCustomerId(self::CUSTOMER_ID); - $this->url = $this->_objectManager->get(UrlInterface::class); + $this->checkoutSession = $this->_objectManager->create(CheckoutSession::class); + } + + /** + * Verifying that recaptcha is present on the CouponPost form/page and keys are configured + * + * @magentoDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php + * @magentoDataFixture Magento/Usps/Fixtures/cart_rule_coupon_free_shipping.php + * + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible + * @magentoConfigFixture default_store recaptcha_frontend/type_for/coupon_code invisible + */ + public function testGetRequestIfReCaptchaIsEnabled(): void + { + $quote = $this->checkoutSession->getQuote(); + $quote->setData('trigger_recollect', 1)->setTotalsCollectedFlag(true); + $this->checkSuccessfulGetResponse(true); } /** @@ -78,10 +98,28 @@ public function testPostRequestIfReCaptchaParameterIsMissed(): void public function testPostRequestWithFailedReCaptchaValidation(): void { $this->checkFailedPostRequest(true); - $this->assertSessionMessages( - $this->equalTo(['Something went wrong with reCAPTCHA. Please contact the store owner.']), - \Magento\Framework\Message\MessageInterface::TYPE_ERROR - ); + } + + /** + * Checks GET response + * + * @param bool $shouldContainReCaptcha + * @return void + */ + private function checkSuccessfulGetResponse(bool $shouldContainReCaptcha = false): void + { + $this->getRequest()->setMethod(Http::METHOD_GET); + $this->dispatch('checkout/cart/'); + $response = $this->getResponse(); + $content = $response->getContent(); + + $this->assertNotEmpty($content); + $shouldContainReCaptcha + ? $this->assertStringContainsString('field-recaptcha', $content) + : $this->assertStringNotContainsString('field-recaptcha', $content); + + $this->assertEmpty($this->getSessionMessages( + \Magento\Framework\Message\MessageInterface::TYPE_ERROR)); } /** From 69237c546deb1ee087abe657e3a0d6522134ac82 Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Tue, 2 Nov 2021 16:12:43 +0530 Subject: [PATCH 004/208] AC-461: Add reCAPTCHA support to coupon code * Static test fix in Integration test --- .../Test/Integration/CouponApplyPostTest.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php index 60c87a4d..9d782ca0 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php @@ -29,14 +29,12 @@ class CouponApplyPostTest extends AbstractController private const CUSTOMER_ID = 1; /** - * Customer session * @var Session */ private $customerSession; /** - * Checkout Session - * @var Session + * @var CheckoutSession */ private $checkoutSession; @@ -118,8 +116,7 @@ private function checkSuccessfulGetResponse(bool $shouldContainReCaptcha = false ? $this->assertStringContainsString('field-recaptcha', $content) : $this->assertStringNotContainsString('field-recaptcha', $content); - $this->assertEmpty($this->getSessionMessages( - \Magento\Framework\Message\MessageInterface::TYPE_ERROR)); + $this->assertEmpty($this->getSessionMessages(\Magento\Framework\Message\MessageInterface::TYPE_ERROR)); } /** From ba1c11c14eb3b660e8d967f339292f48a97ac384 Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Tue, 2 Nov 2021 23:52:35 +0530 Subject: [PATCH 005/208] AC-461: Add reCAPTCHA support to coupon code * Fixed description in Observer & Plugin files --- ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php | 2 +- ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php index e1cfbebf..84f6ae53 100644 --- a/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php +++ b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php @@ -16,7 +16,7 @@ use Magento\ReCaptchaUi\Model\RequestHandlerInterface; /** - * Adds Captcha support for share wishlist + * Add ReCaptcha support for Coupon Code */ class CouponCodeObserver implements ObserverInterface { diff --git a/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php b/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php index a6a972a0..309d8cfd 100644 --- a/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php +++ b/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php @@ -9,14 +9,16 @@ use Magento\ReCaptchaUi\Block\ReCaptcha; /** - * Reset attempts for frontend checkout + * Plugin for adding recaptcha in coupon form */ class CouponSetLayoutPlugin { /** - * Add Child captcha afterLayout in Coupon form + * Add Child ReCaptcha in Coupon form * * @param Coupon $subject + * @return Coupon + * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterSetLayout(Coupon $subject): Coupon { From 09739baf3c763935ea74cf96eb22e9e11b6e0968 Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Mon, 22 Nov 2021 20:01:06 +0530 Subject: [PATCH 006/208] AC-461: Add ReCaptcha support to coupon code * Coupon cancel defect fixes --- .../Observer/CouponCodeObserver.php | 8 ++++---- .../Test/Integration/CouponApplyPostTest.php | 13 ++++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php index 84f6ae53..47a5fb0e 100644 --- a/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php +++ b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php @@ -60,13 +60,13 @@ public function __construct( */ public function execute(Observer $observer): void { - if ($this->isCaptchaEnabled->isCaptchaEnabledFor(self::CAPTCHA_KEY)) { - /** @var Action $controller */ - $controller = $observer->getControllerAction(); + /** @var Action $controller */ + $controller = $observer->getControllerAction(); + $request_param = $controller->getRequest()->getParams(); + if (!isset($request_param['remove']) && $this->isCaptchaEnabled->isCaptchaEnabledFor(self::CAPTCHA_KEY)) { $request = $controller->getRequest(); $response = $controller->getResponse(); $redirectOnFailureUrl = $this->redirect->getRefererUrl(); - $this->requestHandler->execute(self::CAPTCHA_KEY, $request, $response, $redirectOnFailureUrl); } } diff --git a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php index 9d782ca0..3091bc06 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php @@ -81,6 +81,10 @@ public function testGetRequestIfReCaptchaIsEnabled(): void public function testPostRequestIfReCaptchaParameterIsMissed(): void { $this->checkFailedPostRequest(); + $this->assertSessionMessages( + $this->equalTo(['The coupon code "test" is not valid.']), + MessageInterface::TYPE_ERROR + ); } /** @@ -96,6 +100,10 @@ public function testPostRequestIfReCaptchaParameterIsMissed(): void public function testPostRequestWithFailedReCaptchaValidation(): void { $this->checkFailedPostRequest(true); + $this->assertSessionMessages( + $this->equalTo(['The coupon code "test" is not valid.']), + MessageInterface::TYPE_ERROR + ); } /** @@ -127,10 +135,6 @@ private function checkSuccessfulGetResponse(bool $shouldContainReCaptcha = false private function checkFailedPostRequest(bool $withParamReCaptcha = false): void { $this->makePostRequest($withParamReCaptcha); - $this->assertSessionMessages( - $this->equalTo(['Something went wrong with reCAPTCHA. Please contact the store owner.']), - MessageInterface::TYPE_ERROR - ); } /** @@ -153,7 +157,6 @@ private function makePostRequest(bool $withParamReCaptcha = false): void $this->getRequest() ->setMethod(Http::METHOD_POST) ->setPostValue($postValue); - $this->dispatch('checkout/cart/couponPost/'); } From 618eed2c86d48e0abb8481da70e21dd22df67a85 Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Mon, 20 Dec 2021 16:54:29 +0530 Subject: [PATCH 007/208] AC-461: Add ReCaptcha support to coupon code * PHP version update in composer.json --- ReCaptchaCheckoutSalesRule/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaCheckoutSalesRule/composer.json b/ReCaptchaCheckoutSalesRule/composer.json index b1632765..fba933ad 100644 --- a/ReCaptchaCheckoutSalesRule/composer.json +++ b/ReCaptchaCheckoutSalesRule/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout-sales-rule", "description": "Google ReCaptcha integration for Magento2 coupons", "require": { - "php": "~7.4.0||~8.0.0", + "php": "~7.4.0||~8.0.0||~8.1.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-sales-rule": "*", From 8a69ba6f73c4404f4082cd3d03de2fb0aaab6842 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi Date: Mon, 20 Dec 2021 14:25:45 +0200 Subject: [PATCH 008/208] Changed restrictions for php to "~7.4.0||~8.1.0" into `composer.json` files --- ReCaptchaAdminUi/composer.json | 2 +- ReCaptchaCheckout/composer.json | 2 +- ReCaptchaContact/composer.json | 2 +- ReCaptchaCustomer/composer.json | 2 +- ReCaptchaFrontendUi/composer.json | 2 +- ReCaptchaMigration/composer.json | 2 +- ReCaptchaNewsletter/composer.json | 2 +- ReCaptchaPaypal/composer.json | 2 +- ReCaptchaReview/composer.json | 2 +- ReCaptchaSendFriend/composer.json | 2 +- ReCaptchaStorePickup/composer.json | 2 +- ReCaptchaUi/composer.json | 2 +- ReCaptchaUser/composer.json | 2 +- ReCaptchaValidation/composer.json | 2 +- ReCaptchaValidationApi/composer.json | 2 +- ReCaptchaVersion2Checkbox/composer.json | 2 +- ReCaptchaVersion2Invisible/composer.json | 2 +- ReCaptchaVersion3Invisible/composer.json | 2 +- ReCaptchaWebapiApi/composer.json | 2 +- ReCaptchaWebapiGraphQl/composer.json | 2 +- ReCaptchaWebapiRest/composer.json | 2 +- ReCaptchaWebapiUi/composer.json | 2 +- Securitytxt/composer.json | 2 +- TwoFactorAuth/composer.json | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ReCaptchaAdminUi/composer.json b/ReCaptchaAdminUi/composer.json index 8d1d68c8..602ce4b0 100644 --- a/ReCaptchaAdminUi/composer.json +++ b/ReCaptchaAdminUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-admin-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckout/composer.json b/ReCaptchaCheckout/composer.json index 5222f4dd..c2d67de0 100644 --- a/ReCaptchaCheckout/composer.json +++ b/ReCaptchaCheckout/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaContact/composer.json b/ReCaptchaContact/composer.json index 8bdd4488..5146c8df 100644 --- a/ReCaptchaContact/composer.json +++ b/ReCaptchaContact/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-contact", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*" }, diff --git a/ReCaptchaCustomer/composer.json b/ReCaptchaCustomer/composer.json index 62b1ac9c..cdbed567 100644 --- a/ReCaptchaCustomer/composer.json +++ b/ReCaptchaCustomer/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-customer", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-customer": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaFrontendUi/composer.json b/ReCaptchaFrontendUi/composer.json index 3598b12e..42e28501 100644 --- a/ReCaptchaFrontendUi/composer.json +++ b/ReCaptchaFrontendUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-frontend-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaMigration/composer.json b/ReCaptchaMigration/composer.json index f72df210..6d823f30 100644 --- a/ReCaptchaMigration/composer.json +++ b/ReCaptchaMigration/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-migration", "description": "Google reCAPTCHA config migration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-config": "*" }, diff --git a/ReCaptchaNewsletter/composer.json b/ReCaptchaNewsletter/composer.json index a4d3408b..3507d1da 100644 --- a/ReCaptchaNewsletter/composer.json +++ b/ReCaptchaNewsletter/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-newsletter", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index 9ac1f26a..983a5922 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-paypal", "description": "Google reCaptcha integration for Magento2 PayPal PayflowPro payment form", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaReview/composer.json b/ReCaptchaReview/composer.json index 1e4fb15d..c4f0b517 100644 --- a/ReCaptchaReview/composer.json +++ b/ReCaptchaReview/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-review", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaSendFriend/composer.json b/ReCaptchaSendFriend/composer.json index ff4f1e7b..1d5ac164 100644 --- a/ReCaptchaSendFriend/composer.json +++ b/ReCaptchaSendFriend/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-send-friend", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaStorePickup/composer.json b/ReCaptchaStorePickup/composer.json index 31f247a0..686dbfe1 100644 --- a/ReCaptchaStorePickup/composer.json +++ b/ReCaptchaStorePickup/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-store-pickup", "description": "Google reCaptcha integration for Magento2 Inventory Store Pickup shipping form", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaUi/composer.json b/ReCaptchaUi/composer.json index 208ac3e9..ef7438b6 100644 --- a/ReCaptchaUi/composer.json +++ b/ReCaptchaUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaUser/composer.json b/ReCaptchaUser/composer.json index ddb60c77..b2e0cc08 100644 --- a/ReCaptchaUser/composer.json +++ b/ReCaptchaUser/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-user", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*" diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index afe236b8..b1542885 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", "google/recaptcha": "^1.2" diff --git a/ReCaptchaValidationApi/composer.json b/ReCaptchaValidationApi/composer.json index 97d9dab4..2a6cc9aa 100644 --- a/ReCaptchaValidationApi/composer.json +++ b/ReCaptchaValidationApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*" }, "type": "magento2-module", diff --git a/ReCaptchaVersion2Checkbox/composer.json b/ReCaptchaVersion2Checkbox/composer.json index e325cddb..d856134d 100644 --- a/ReCaptchaVersion2Checkbox/composer.json +++ b/ReCaptchaVersion2Checkbox/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-checkbox", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion2Invisible/composer.json b/ReCaptchaVersion2Invisible/composer.json index e42e7b25..cae5a5e8 100644 --- a/ReCaptchaVersion2Invisible/composer.json +++ b/ReCaptchaVersion2Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion3Invisible/composer.json b/ReCaptchaVersion3Invisible/composer.json index 84917125..f03262d4 100644 --- a/ReCaptchaVersion3Invisible/composer.json +++ b/ReCaptchaVersion3Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-3-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaWebapiApi/composer.json b/ReCaptchaWebapiApi/composer.json index 8f8ead52..d2d3ae10 100644 --- a/ReCaptchaWebapiApi/composer.json +++ b/ReCaptchaWebapiApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaWebapiGraphQl/composer.json b/ReCaptchaWebapiGraphQl/composer.json index 5b099fbc..e857046e 100644 --- a/ReCaptchaWebapiGraphQl/composer.json +++ b/ReCaptchaWebapiGraphQl/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-graph-ql", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiRest/composer.json b/ReCaptchaWebapiRest/composer.json index f2b545e8..cf15d4c6 100644 --- a/ReCaptchaWebapiRest/composer.json +++ b/ReCaptchaWebapiRest/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-rest", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiUi/composer.json b/ReCaptchaWebapiUi/composer.json index 3dbd5a1b..c17bbba6 100644 --- a/ReCaptchaWebapiUi/composer.json +++ b/ReCaptchaWebapiUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-re-captcha-frontend-ui": "*" }, diff --git a/Securitytxt/composer.json b/Securitytxt/composer.json index 667c555c..8f00f67f 100644 --- a/Securitytxt/composer.json +++ b/Securitytxt/composer.json @@ -3,7 +3,7 @@ "description": "Security.txt file for Magento 2 websites", "type": "magento2-module", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-store": "*" diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 42bb5f09..78d1ab57 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-two-factor-auth", "description": "Two Factor Authentication module for Magento2", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~7.4.0||~8.1.0", "magento/framework": "*", "magento/magento-composer-installer": "*", "magento/module-backend": "*", From 8479e60a7e933ee16cbe673076ce26ded8824938 Mon Sep 17 00:00:00 2001 From: rizwankhan Date: Tue, 11 Jan 2022 22:02:08 +0530 Subject: [PATCH 009/208] AC-1920: ReCaptchaCustomer module updated with graphql resolver * update on resolver in webapiconfiguration --- .../Model/WebapiConfigProvider.php | 82 +++++++++++++------ 1 file changed, 56 insertions(+), 26 deletions(-) diff --git a/ReCaptchaCustomer/Model/WebapiConfigProvider.php b/ReCaptchaCustomer/Model/WebapiConfigProvider.php index 27e31b04..3915f43d 100644 --- a/ReCaptchaCustomer/Model/WebapiConfigProvider.php +++ b/ReCaptchaCustomer/Model/WebapiConfigProvider.php @@ -46,6 +46,55 @@ public function __construct(IsCaptchaEnabledInterface $isEnabled, ValidationConf $this->configResolver = $configResolver; } + /** + * Validates ifChangedPasswordCaptchaEnabled using captcha_id + * + * @param string $serviceMethod + * @param string $serviceClass + * @return ValidationConfigInterface|null + */ + private function validateChangePasswordCaptcha($serviceMethod, $serviceClass): ?ValidationConfigInterface + { + //phpcs:disable Magento2.PHP.LiteralNamespaces + if ($serviceMethod === 'resetPassword' || $serviceMethod === 'initiatePasswordReset' + || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\ResetPassword' + || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\RequestPasswordResetEmail' + ) { + return $this->isEnabled->isCaptchaEnabledFor(self::RESET_PASSWORD_CAPTCHA_ID) ? + $this->configResolver->get(self::RESET_PASSWORD_CAPTCHA_ID) : null; + } elseif ($serviceMethod === 'changePasswordById' + || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\ChangePassword' + ) { + return $this->isEnabled->isCaptchaEnabledFor(self::CHANGE_PASSWORD_CAPTCHA_ID) ? + $this->configResolver->get(self::CHANGE_PASSWORD_CAPTCHA_ID) : null; + } + //phpcs:enable Magento2.PHP.LiteralNamespaces + + return null; + } + + /** + * Validates ifLoginCaptchaEnabled using captcha_id + * + * @return ValidationConfigInterface|null + */ + private function validateLoginCaptcha(): ?ValidationConfigInterface + { + return $this->isEnabled->isCaptchaEnabledFor(self::LOGIN_CAPTCHA_ID) ? + $this->configResolver->get(self::LOGIN_CAPTCHA_ID) : null; + } + + /** + * Validates ifCreateCustomerCaptchaEnabled using captcha_id + * + * @return ValidationConfigInterface|null + */ + private function validateCreateCustomerCaptcha(): ?ValidationConfigInterface + { + return $this->isEnabled->isCaptchaEnabledFor(self::CREATE_CAPTCHA_ID) ? + $this->configResolver->get(self::CREATE_CAPTCHA_ID) : null; + } + /** * @inheritDoc */ @@ -55,38 +104,19 @@ public function getConfigFor(EndpointInterface $endpoint): ?ValidationConfigInte $serviceMethod = $endpoint->getServiceMethod(); //phpcs:disable Magento2.PHP.LiteralNamespaces - if ($serviceMethod === 'resetPassword' - || $serviceMethod === 'initiatePasswordReset' - || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\ResetPassword') { - if ($this->isEnabled->isCaptchaEnabledFor(self::RESET_PASSWORD_CAPTCHA_ID)) { - return $this->configResolver->get(self::RESET_PASSWORD_CAPTCHA_ID); - } - } elseif ($serviceMethod === 'changePasswordById' - || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\ChangePassword') { - if ($this->isEnabled->isCaptchaEnabledFor(self::CHANGE_PASSWORD_CAPTCHA_ID)) { - return $this->configResolver->get(self::CHANGE_PASSWORD_CAPTCHA_ID); - } - } elseif ( - ($serviceClass === 'Magento\Integration\Api\CustomerTokenServiceInterface' - && $serviceMethod === 'createCustomerAccessToken' - ) + if (($serviceClass === 'Magento\Integration\Api\CustomerTokenServiceInterface' + && $serviceMethod === 'createCustomerAccessToken') || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\GenerateCustomerToken' ) { - if ($this->isEnabled->isCaptchaEnabledFor(self::LOGIN_CAPTCHA_ID)) { - return $this->configResolver->get(self::LOGIN_CAPTCHA_ID); - } - } elseif ( - ($serviceClass === 'Magento\Customer\Api\AccountManagementInterface' - && $serviceMethod === 'createAccount' - ) + return $this->validateLoginCaptcha(); + } elseif (($serviceClass === 'Magento\Customer\Api\AccountManagementInterface' + && $serviceMethod === 'createAccount') || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\CreateCustomer' ) { - if ($this->isEnabled->isCaptchaEnabledFor(self::CREATE_CAPTCHA_ID)) { - return $this->configResolver->get(self::CREATE_CAPTCHA_ID); - } + return $this->validateCreateCustomerCaptcha(); } //phpcs:enable Magento2.PHP.LiteralNamespaces - return null; + return $this->validateChangePasswordCaptcha($serviceMethod, $serviceClass); } } From c4c892caa666f26dad388208d6bd8011db4f910c Mon Sep 17 00:00:00 2001 From: Nishant Rana Date: Mon, 7 Feb 2022 20:48:56 +0530 Subject: [PATCH 010/208] ACP2E-451: Google reCAPTCHA tab navigation issue fixed --- ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html | 1 + 1 file changed, 1 insertion(+) diff --git a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html index 9f8eac95..0084f13d 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html @@ -20,6 +20,7 @@ class="required-captcha checkbox" name="recaptcha-validate-" data-validate="{required:true}" + tabindex="-1" /> From dc3d3bed109d8748e4ebf0cb5977d86e7c2c82e5 Mon Sep 17 00:00:00 2001 From: Viktor Rad Date: Thu, 10 Feb 2022 10:02:37 -0600 Subject: [PATCH 011/208] ACP2E-222: Magento forms can be submitted before the Google Recaptcha appears in the form --- .../Customer/DisableCreateAccountButton.php | 46 +++++++++++++++++ .../Plugin/Customer/DisableLoginButton.php | 50 +++++++++++++++++++ ReCaptchaCustomer/etc/frontend/di.xml | 9 +++- .../view/frontend/web/js/reCaptcha.js | 1 + 4 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php create mode 100644 ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php diff --git a/ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php b/ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php new file mode 100644 index 00000000..ea6e3ebc --- /dev/null +++ b/ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php @@ -0,0 +1,46 @@ +isCaptchaEnabled = $isCaptchaEnabled; + } + + /** + * Temporally disable button Create Account while captcha is loading + * + * @param CreateAccountButton $subject + * @return bool + * @throws InputException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterDisabled(CreateAccountButton $subject): bool + { + $key = 'customer_create'; + return $this->isCaptchaEnabled->isCaptchaEnabledFor($key); + } +} diff --git a/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php b/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php new file mode 100644 index 00000000..f745359f --- /dev/null +++ b/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php @@ -0,0 +1,50 @@ +captchaUiConfigResolver = $captchaUiConfigResolver; + $this->isCaptchaEnabled = $isCaptchaEnabled; + } + + /** + * Temporally disable Login button while captcha is loading + * + * @param LoginButton $subject + * @return bool + * @throws InputException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterDisabled(LoginButton $subject): bool + { + $key = 'customer_login'; + return $this->isCaptchaEnabled->isCaptchaEnabledFor($key); + } +} diff --git a/ReCaptchaCustomer/etc/frontend/di.xml b/ReCaptchaCustomer/etc/frontend/di.xml index 1d090238..de5be017 100644 --- a/ReCaptchaCustomer/etc/frontend/di.xml +++ b/ReCaptchaCustomer/etc/frontend/di.xml @@ -20,5 +20,12 @@ - + + + + + + diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index 9528f06e..14f2af32 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -174,6 +174,7 @@ define( } else { this.tokenField = null; } + if ($('#send2').length > 0) {$('#send2').prop('disabled', false);} }, /** From 65af6947a85c20acea68dd7e1816f3bfdbfb1b23 Mon Sep 17 00:00:00 2001 From: Viktor Rad Date: Thu, 10 Feb 2022 12:02:30 -0600 Subject: [PATCH 012/208] ACP2E-222: Magento forms can be submitted before the Google Recaptcha appears in the form --- .../Plugin/Customer/DisableLoginButton.php | 3 - .../DisableCreateAccountButtonTest.php | 55 +++++++++++++++++ .../Customer/DisableLoginButtonTest.php | 61 +++++++++++++++++++ 3 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php create mode 100644 ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php diff --git a/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php b/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php index f745359f..b0713fa3 100644 --- a/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php +++ b/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php @@ -23,14 +23,11 @@ class DisableLoginButton private $isCaptchaEnabled; /** - * @param UiConfigResolverInterface $captchaUiConfigResolver * @param IsCaptchaEnabledInterface $isCaptchaEnabled */ public function __construct( - UiConfigResolverInterface $captchaUiConfigResolver, IsCaptchaEnabledInterface $isCaptchaEnabled ) { - $this->captchaUiConfigResolver = $captchaUiConfigResolver; $this->isCaptchaEnabled = $isCaptchaEnabled; } diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php new file mode 100644 index 00000000..5d8085e7 --- /dev/null +++ b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php @@ -0,0 +1,55 @@ +isCaptchaEnabled = $this->getMockForAbstractClass( + IsCaptchaEnabledInterface::class + ); + $this->subject = $this->createMock(CreateAccountButton::class); + + $this->plugin = new DisableCreateAccountButton( + $this->isCaptchaEnabled + ); + } + + public function testAfterEnabled() + { + $key = 'customer_login'; + $this->isCaptchaEnabled->expects($this->once()) + ->method('isCaptchaEnabledFor')->with($key)->willReturn(true); + $this->assertEquals(true, $this->plugin->afterDisabled($this->subject)); + } +} diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php new file mode 100644 index 00000000..3ef369b5 --- /dev/null +++ b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php @@ -0,0 +1,61 @@ +isCaptchaEnabled = $this->getMockForAbstractClass( + IsCaptchaEnabledInterface::class + ); + $this->subject = $this->createMock(LoginButton::class); + + $this->plugin = new DisableLoginButton( + $this->isCaptchaEnabled + ); + } + + public function testAfterEnabled() + { + $key = 'customer_login'; + $this->isCaptchaEnabled->expects($this->once()) + ->method('isCaptchaEnabledFor')->with($key)->willReturn(true); + $this->assertEquals(true, $this->plugin->afterDisabled($this->subject)); + } +} From 9918a0b84ea07bddd875f39009acab6216c2e1f1 Mon Sep 17 00:00:00 2001 From: Viktor Rad Date: Fri, 11 Feb 2022 11:33:22 -0600 Subject: [PATCH 013/208] ACP2E-222: Magento forms can be submitted before the Google Recaptcha appears in the form --- .../Unit/Plugin/Customer/DisableCreateAccountButtonTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php index 5d8085e7..bc4b4239 100644 --- a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php +++ b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php @@ -47,7 +47,7 @@ protected function setUp(): void public function testAfterEnabled() { - $key = 'customer_login'; + $key = 'customer_create'; $this->isCaptchaEnabled->expects($this->once()) ->method('isCaptchaEnabledFor')->with($key)->willReturn(true); $this->assertEquals(true, $this->plugin->afterDisabled($this->subject)); From 4f52f1029275c363c9a7716a6f1e8db7620e73a1 Mon Sep 17 00:00:00 2001 From: Nishant Rana Date: Thu, 17 Feb 2022 21:49:53 +0530 Subject: [PATCH 014/208] Static test fixes --- ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html index 0084f13d..e8a16dad 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html @@ -20,8 +20,7 @@ class="required-captcha checkbox" name="recaptcha-validate-" data-validate="{required:true}" - tabindex="-1" - /> + tabindex="-1"> From b21dd85b1107728556da7d7037f223d37c31e2d2 Mon Sep 17 00:00:00 2001 From: Viktor Rad Date: Wed, 30 Mar 2022 18:47:12 -0500 Subject: [PATCH 015/208] ACP2E-547: Magento forms can be submitted before the Google Recaptcha appears in the form --- .../Customer/DisableForgotPasswordButton.php | 46 ++++++++++++++++ .../DisableForgotPasswordButtonTest.php | 55 +++++++++++++++++++ ReCaptchaCustomer/etc/frontend/di.xml | 4 ++ 3 files changed, 105 insertions(+) create mode 100644 ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php create mode 100644 ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php diff --git a/ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php b/ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php new file mode 100644 index 00000000..6c3d7df6 --- /dev/null +++ b/ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php @@ -0,0 +1,46 @@ +isCaptchaEnabled = $isCaptchaEnabled; + } + + /** + * Temporally disable Forgot password button while captcha is loading + * + * @param ForgotPasswordButton $subject + * @return bool + * @throws InputException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterDisabled(ForgotPasswordButton $subject): bool + { + $key = 'customer_forgot_password'; + return $this->isCaptchaEnabled->isCaptchaEnabledFor($key); + } +} diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php new file mode 100644 index 00000000..12889a66 --- /dev/null +++ b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php @@ -0,0 +1,55 @@ +isCaptchaEnabled = $this->getMockForAbstractClass( + IsCaptchaEnabledInterface::class + ); + $this->subject = $this->createMock(DisableForgotPasswordButton::class); + + $this->plugin = new DisableForgotPasswordButton( + $this->isCaptchaEnabled + ); + } + + public function testAfterEnabled() + { + $key = 'customer_forgot_password'; + $this->isCaptchaEnabled->expects($this->once()) + ->method('isCaptchaEnabledFor')->with($key)->willReturn(true); + $this->assertEquals(true, $this->plugin->afterDisabled($this->subject)); + } +} diff --git a/ReCaptchaCustomer/etc/frontend/di.xml b/ReCaptchaCustomer/etc/frontend/di.xml index de5be017..73640968 100644 --- a/ReCaptchaCustomer/etc/frontend/di.xml +++ b/ReCaptchaCustomer/etc/frontend/di.xml @@ -28,4 +28,8 @@ + + + From ad5d8ca3aa339e5ba004e359b86b4bf4079a4d62 Mon Sep 17 00:00:00 2001 From: Viktor Rad Date: Thu, 31 Mar 2022 10:05:12 -0500 Subject: [PATCH 016/208] ACP2E-547: Magento forms can be submitted before the Google Recaptcha appears in the form --- .../Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php index 12889a66..489a5136 100644 --- a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php +++ b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php @@ -38,7 +38,7 @@ protected function setUp(): void $this->isCaptchaEnabled = $this->getMockForAbstractClass( IsCaptchaEnabledInterface::class ); - $this->subject = $this->createMock(DisableForgotPasswordButton::class); + $this->subject = $this->createMock(ForgotPasswordButton::class); $this->plugin = new DisableForgotPasswordButton( $this->isCaptchaEnabled From 042191ad914063004dfc30b0b7ad3f2df70e329d Mon Sep 17 00:00:00 2001 From: anastasiia Date: Mon, 25 Apr 2022 16:27:38 +0200 Subject: [PATCH 017/208] CABPI-380 - check for the flag if Adobe 2FA is enabled --- .../Observer/ControllerActionPredispatch.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/TwoFactorAuth/Observer/ControllerActionPredispatch.php b/TwoFactorAuth/Observer/ControllerActionPredispatch.php index 94c3add7..5cff82b0 100644 --- a/TwoFactorAuth/Observer/ControllerActionPredispatch.php +++ b/TwoFactorAuth/Observer/ControllerActionPredispatch.php @@ -11,9 +11,11 @@ use Magento\Backend\App\AbstractAction; use Magento\Framework\App\Action\Action; use Magento\Framework\App\ActionFlag; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\AuthorizationInterface; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; +use Magento\Framework\Module\Manager as ModuleManager; use Magento\Framework\UrlInterface; use Magento\TwoFactorAuth\Controller\Adminhtml\Tfa\Configure; use Magento\TwoFactorAuth\Controller\Adminhtml\Tfa\Index; @@ -74,6 +76,14 @@ class ControllerActionPredispatch implements ObserverInterface * @var UserContextInterface */ private $userContext; + /** + * @var ModuleManager + */ + private $moduleManager; + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; /** * @param TfaInterface $tfa @@ -84,6 +94,8 @@ class ControllerActionPredispatch implements ObserverInterface * @param UrlInterface $url * @param AuthorizationInterface $authorization * @param UserContextInterface $userContext + * @param ModuleManager $moduleManager + * @param ScopeConfigInterface $scopeConfig */ public function __construct( TfaInterface $tfa, @@ -93,7 +105,9 @@ public function __construct( ActionFlag $actionFlag, UrlInterface $url, AuthorizationInterface $authorization, - UserContextInterface $userContext + UserContextInterface $userContext, + ModuleManager $moduleManager, + ScopeConfigInterface $scopeConfig ) { $this->tfa = $tfa; $this->tfaSession = $tfaSession; @@ -103,6 +117,8 @@ public function __construct( $this->url = $url; $this->authorization = $authorization; $this->userContext = $userContext; + $this->moduleManager = $moduleManager; + $this->scopeConfig = $scopeConfig; } /** @@ -122,6 +138,10 @@ private function redirect(string $url): void */ public function execute(Observer $observer) { + if ($this->moduleManager->isEnabled('Magento_AdminAdobeIms') + && !$this->scopeConfig->isSetFlag('adobe_ims/integration/two_factor')) { + return; + } /** @var $controllerAction AbstractAction */ $controllerAction = $observer->getEvent()->getData('controller_action'); $this->action = $controllerAction; From f8224a7adc112cc8afea52d89656536b7fbb120d Mon Sep 17 00:00:00 2001 From: anastasiia Date: Tue, 26 Apr 2022 17:21:24 +0200 Subject: [PATCH 018/208] CABPI-381 - 2FA module disabling - updating config value for the checking if 2FA must be enabled/disabled --- TwoFactorAuth/Observer/ControllerActionPredispatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TwoFactorAuth/Observer/ControllerActionPredispatch.php b/TwoFactorAuth/Observer/ControllerActionPredispatch.php index 5cff82b0..4e3a6173 100644 --- a/TwoFactorAuth/Observer/ControllerActionPredispatch.php +++ b/TwoFactorAuth/Observer/ControllerActionPredispatch.php @@ -139,7 +139,7 @@ private function redirect(string $url): void public function execute(Observer $observer) { if ($this->moduleManager->isEnabled('Magento_AdminAdobeIms') - && !$this->scopeConfig->isSetFlag('adobe_ims/integration/two_factor')) { + && $this->scopeConfig->isSetFlag('adobe_ims/integration/adobe_ims_2fa_enabled')) { return; } /** @var $controllerAction AbstractAction */ From 9746de301305a728c5eae8c780fedda0d13c645b Mon Sep 17 00:00:00 2001 From: venkatashivakumar Date: Fri, 29 Apr 2022 13:43:13 +0530 Subject: [PATCH 019/208] AC-2642: ReCaptcha validation changes --- .../view/frontend/web/js/webapiReCaptchaRegistry.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js index ba2f786d..119e8e43 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js @@ -32,11 +32,7 @@ define([], function () { * @param {Function} func - Will be called back with the token */ addListener: function (id, func) { - if (this.tokens.hasOwnProperty(id)) { - func(this.tokens[id]); - } else { - this._listeners[id] = func; - } + this._listeners[id] = func; } }; }); From 32beaeb8a5f6c94a38ab5ed20ef90b4191fa2f33 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" Date: Tue, 3 May 2022 10:01:15 -0500 Subject: [PATCH 020/208] CABPI-390: Do not allow to enable AdminAdobeIms when 2FA is disabled on IMS --- .../Observer/ControllerActionPredispatch.php | 24 +++++++------------ TwoFactorAuth/composer.json | 1 + TwoFactorAuth/etc/module.xml | 1 + 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/TwoFactorAuth/Observer/ControllerActionPredispatch.php b/TwoFactorAuth/Observer/ControllerActionPredispatch.php index 4e3a6173..7749a49e 100644 --- a/TwoFactorAuth/Observer/ControllerActionPredispatch.php +++ b/TwoFactorAuth/Observer/ControllerActionPredispatch.php @@ -11,11 +11,9 @@ use Magento\Backend\App\AbstractAction; use Magento\Framework\App\Action\Action; use Magento\Framework\App\ActionFlag; -use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\AuthorizationInterface; use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; -use Magento\Framework\Module\Manager as ModuleManager; use Magento\Framework\UrlInterface; use Magento\TwoFactorAuth\Controller\Adminhtml\Tfa\Configure; use Magento\TwoFactorAuth\Controller\Adminhtml\Tfa\Index; @@ -24,6 +22,7 @@ use Magento\TwoFactorAuth\Api\UserConfigRequestManagerInterface; use Magento\TwoFactorAuth\Controller\Adminhtml\Tfa\Requestconfig; use Magento\TwoFactorAuth\Model\UserConfig\HtmlAreaTokenVerifier; +use Magento\AdminAdobeIms\Service\ImsConfig; /** * Handle redirection to 2FA page if required @@ -76,14 +75,11 @@ class ControllerActionPredispatch implements ObserverInterface * @var UserContextInterface */ private $userContext; + /** - * @var ModuleManager - */ - private $moduleManager; - /** - * @var ScopeConfigInterface + * @var ImsConfig */ - private $scopeConfig; + private ImsConfig $adminAdobeImsConfig; /** * @param TfaInterface $tfa @@ -94,8 +90,7 @@ class ControllerActionPredispatch implements ObserverInterface * @param UrlInterface $url * @param AuthorizationInterface $authorization * @param UserContextInterface $userContext - * @param ModuleManager $moduleManager - * @param ScopeConfigInterface $scopeConfig + * @param ImsConfig $adminAdobeImsConfig */ public function __construct( TfaInterface $tfa, @@ -106,8 +101,7 @@ public function __construct( UrlInterface $url, AuthorizationInterface $authorization, UserContextInterface $userContext, - ModuleManager $moduleManager, - ScopeConfigInterface $scopeConfig + ImsConfig $adminAdobeImsConfig ) { $this->tfa = $tfa; $this->tfaSession = $tfaSession; @@ -117,8 +111,7 @@ public function __construct( $this->url = $url; $this->authorization = $authorization; $this->userContext = $userContext; - $this->moduleManager = $moduleManager; - $this->scopeConfig = $scopeConfig; + $this->adminAdobeImsConfig = $adminAdobeImsConfig; } /** @@ -138,8 +131,7 @@ private function redirect(string $url): void */ public function execute(Observer $observer) { - if ($this->moduleManager->isEnabled('Magento_AdminAdobeIms') - && $this->scopeConfig->isSetFlag('adobe_ims/integration/adobe_ims_2fa_enabled')) { + if ($this->adminAdobeImsConfig->enabled()) { return; } /** @var $controllerAction AbstractAction */ diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 78d1ab57..0c95b23d 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -12,6 +12,7 @@ "magento/module-ui": "*", "magento/module-user": "*", "magento/module-integration": "*", + "magento/module-admin-adobe-ims": "*", "christian-riesen/base32": "^1.3", "spomky-labs/otphp": "^10.0", "endroid/qr-code": "^4.3.5", diff --git a/TwoFactorAuth/etc/module.xml b/TwoFactorAuth/etc/module.xml index 9f24769d..2ea67442 100644 --- a/TwoFactorAuth/etc/module.xml +++ b/TwoFactorAuth/etc/module.xml @@ -11,6 +11,7 @@ + From 05edeca4d38e5ee467384a14bb4c0e136c64b6fe Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" Date: Fri, 6 May 2022 12:53:55 -0500 Subject: [PATCH 021/208] CABPI-392: Fix Failed Static Tests --- TwoFactorAuth/Observer/ControllerActionPredispatch.php | 1 + 1 file changed, 1 insertion(+) diff --git a/TwoFactorAuth/Observer/ControllerActionPredispatch.php b/TwoFactorAuth/Observer/ControllerActionPredispatch.php index 7749a49e..d27d84d2 100644 --- a/TwoFactorAuth/Observer/ControllerActionPredispatch.php +++ b/TwoFactorAuth/Observer/ControllerActionPredispatch.php @@ -128,6 +128,7 @@ private function redirect(string $url): void /** * @inheritDoc + * @SuppressWarnings(PHPMD.CyclomaticComplexity) */ public function execute(Observer $observer) { From 95fffe61aa9b27fcc1108ff6efac8a37e6c8f63f Mon Sep 17 00:00:00 2001 From: venkatashivakumar Date: Mon, 9 May 2022 18:47:43 +0530 Subject: [PATCH 022/208] AC-2642: ReCaptcha validation changes * changes in validations --- .../view/frontend/requirejs-config.js | 4 ++++ .../web/js/webapiReCaptchaRegistry-mixin.js | 22 +++++++++++++++++++ .../web/js/webapiReCaptchaRegistry.js | 6 ++++- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js diff --git a/ReCaptchaCheckout/view/frontend/requirejs-config.js b/ReCaptchaCheckout/view/frontend/requirejs-config.js index 2c6f3490..57feceac 100644 --- a/ReCaptchaCheckout/view/frontend/requirejs-config.js +++ b/ReCaptchaCheckout/view/frontend/requirejs-config.js @@ -9,7 +9,11 @@ var config = { mixins: { 'Magento_Checkout/js/model/place-order': { 'Magento_ReCaptchaCheckout/js/model/place-order-mixin': true + }, + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry': { + 'Magento_ReCaptchaCheckout/js/webapiReCaptchaRegistry-mixin': true } } } }; + diff --git a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js new file mode 100644 index 00000000..3d4ba578 --- /dev/null +++ b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js @@ -0,0 +1,22 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([], function () { + 'use strict'; + + return function(originalFunction){ + /** + * Add a listener to when the ReCaptcha finishes verification + * @param {String} id - ReCaptchaId + * @param {Function} func - Will be called back with the token + */ + originalFunction.addListener = function(id , func) { + this._listeners[id] = func; + } + + return originalFunction; + }; + +}); \ No newline at end of file diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js index 119e8e43..ba2f786d 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js @@ -32,7 +32,11 @@ define([], function () { * @param {Function} func - Will be called back with the token */ addListener: function (id, func) { - this._listeners[id] = func; + if (this.tokens.hasOwnProperty(id)) { + func(this.tokens[id]); + } else { + this._listeners[id] = func; + } } }; }); From 95f62079b3dc7eb07f4cbd3a64a645b50565c3ff Mon Sep 17 00:00:00 2001 From: venkatashivakumar Date: Mon, 9 May 2022 21:23:43 +0530 Subject: [PATCH 023/208] AC-2642: ReCaptcha validation changes * Fixing testcases --- .../frontend/web/js/webapiReCaptchaRegistry-mixin.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js index 3d4ba578..9e48a70f 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js @@ -6,17 +6,15 @@ define([], function () { 'use strict'; - return function(originalFunction){ + return function (originalFunction) { /** - * Add a listener to when the ReCaptcha finishes verification - * @param {String} id - ReCaptchaId - * @param {Function} func - Will be called back with the token + * {@inheritDoc} */ - originalFunction.addListener = function(id , func) { + originalFunction.addListener = function (id , func) { this._listeners[id] = func; } return originalFunction; - }; + } -}); \ No newline at end of file +}); From d8673bccb8aefe1b6ab3d75b78f0f9e782450431 Mon Sep 17 00:00:00 2001 From: venkatashivakumar Date: Tue, 10 May 2022 12:17:27 +0530 Subject: [PATCH 024/208] AC-2642: ReCaptcha validation changes * Fixing test cases --- .../view/frontend/web/js/webapiReCaptchaRegistry-mixin.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js index 9e48a70f..b7780d54 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js @@ -12,9 +12,9 @@ define([], function () { */ originalFunction.addListener = function (id , func) { this._listeners[id] = func; - } + }; return originalFunction; - } + }; }); From d6f227f6ff7b35642d05eae56b6268a09c199c51 Mon Sep 17 00:00:00 2001 From: "Lopukhov, Stanislav" Date: Tue, 10 May 2022 13:03:06 -0500 Subject: [PATCH 025/208] CABPI-397: Fix Failed Functional Tests CE Tests --- TwoFactorAuth/etc/module.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/TwoFactorAuth/etc/module.xml b/TwoFactorAuth/etc/module.xml index 2ea67442..9f24769d 100644 --- a/TwoFactorAuth/etc/module.xml +++ b/TwoFactorAuth/etc/module.xml @@ -11,7 +11,6 @@ - From fe27bad272a001af233fc8fe70473640daefb4d1 Mon Sep 17 00:00:00 2001 From: Anna Bukatar Date: Mon, 20 Jun 2022 19:19:32 -0700 Subject: [PATCH 026/208] ACP2E-876: Google Recaptcha on Checkout not working --- .../view/frontend/web/js/model/place-order-mixin.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 1cb64d19..8695e742 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -8,8 +8,9 @@ define([ 'jquery', 'mage/utils/wrapper', - 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' -], function ($, wrapper, recaptchaRegistry) { + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry', + 'Magento_Checkout/js/action/redirect-on-success' +], function ($, wrapper, recaptchaRegistry, redirectOnSuccessAction) { 'use strict'; return function (placeOrder) { @@ -24,6 +25,7 @@ define([ payload.xReCaptchaValue = token; originalAction(serviceUrl, payload, messageContainer).done(function () { recaptchaDeferred.resolve.apply(recaptchaDeferred, arguments); + redirectOnSuccessAction.execute(); }).fail(function () { recaptchaDeferred.reject.apply(recaptchaDeferred, arguments); }); From 9b90658c93b89237adfbf59b438806bede69f076 Mon Sep 17 00:00:00 2001 From: venkatashivakumar Date: Tue, 21 Jun 2022 11:13:59 +0530 Subject: [PATCH 027/208] AC-3501: ReCaptcha for Checkout Sales rule --- .../view/frontend/web/js/checkout-sales-rule.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js index 56bb323e..551c4558 100644 --- a/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js +++ b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js @@ -58,11 +58,20 @@ define( headers['X-ReCaptcha'] = xRecaptchaValue; }); + if (self.getIsInvisibleRecaptcha()) { + grecaptcha.execute(widgetId); + self.validateReCaptcha(true); + } //Refresh reCaptcha after failed request. setCouponCodeAction.registerFailCallback(function () { - self.validateReCaptcha(false); - grecaptcha.reset(widgetId); - $('#' + captchaId).show(); + if (self.getIsInvisibleRecaptcha()) { + grecaptcha.execute(widgetId); + self.validateReCaptcha(true); + } else { + self.validateReCaptcha(false); + grecaptcha.reset(widgetId); + $('#' + captchaId).show(); + } }); //Hide captcha when a coupon has been applied. setCouponCodeAction.registerSuccessCallback(function () { From 0964841ad85037d9c141cc3bfd45d72c102d9870 Mon Sep 17 00:00:00 2001 From: Anna Bukatar Date: Wed, 22 Jun 2022 14:43:28 -0700 Subject: [PATCH 028/208] ACP2E-876: Google Recaptcha on Checkout not working --- .../js/model/place-order-mixin.test.js | 105 ++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js new file mode 100644 index 00000000..39daff8e --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js @@ -0,0 +1,105 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define(['squire' +], function (Squire) { + 'use strict'; + + var injector = new Squire(), + + defaultContext = require.s.contexts._, + mixin, + registry, + redirect; + + beforeEach(function (done) { + window.checkoutConfig = { + defaultSuccessPageUrl: '' + }; + + injector.require([ + 'Magento_ReCaptchaCheckout/js/model/place-order-mixin', + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry', + 'Magento_Checkout/js/action/redirect-on-success' + ], function (Mixin, Registry, Redirect) { + mixin = Mixin; + registry = Registry; + redirect = Redirect; + done(); + }); + }); + + afterEach(function () { + try { + injector.clean(); + injector.remove(); + } catch (e) {} + }); + + describe('Magento_ReCaptchaCheckout/js/model/place-order-mixin', function () { + it('mixin is applied to Magento_Checkout/js/model/place-order', function () { + var placeOrderMixins = defaultContext.config.config.mixins['Magento_Checkout/js/model/place-order']; + + expect(placeOrderMixins['Magento_ReCaptchaCheckout/js/model/place-order-mixin']).toBe(true); + }); + + it('Magento_Checkout/js/action/redirect-on-success is called', function () { + let recaptchaId = 'recaptcha-checkout-place-order', + messageContainer = jasmine.createSpy('messageContainer'), + payload = {}, + serviceUrl = 'test', + + /** + * Order place action mock + * + * @returns {{fail: fail, done: (function(Function): *)}} + */ + action = function () { + return { + /** + * Success result for request + * + * @param {Function} handler + * @returns {*} + */ + done: function (handler) { + handler(); + return this; + }, + + /** + * Fail result for request + */ + fail: function () {} + }; + }; + + /** + * Triggers declared listener + * + * @returns {*} + */ + registry.triggers[recaptchaId] = function () { + if (registry._listeners[recaptchaId] !== undefined) { + return registry._listeners[recaptchaId]('token'); + } + }; + + /** + * Registers a listener + * + * @param id + * @param func + */ + registry.addListener = function (id, func) { + registry._listeners[id] = func; + }; + + redirect.execute = jasmine.createSpy(); + mixin()(action, serviceUrl, payload, messageContainer); + expect(redirect.execute).toHaveBeenCalled(); + }); + }); +}); From 84d43a6ebed3814fbeb45e951a8d052add9405df Mon Sep 17 00:00:00 2001 From: Anna Bukatar Date: Fri, 24 Jun 2022 16:04:00 -0700 Subject: [PATCH 029/208] ACP2E-876: Google Recaptcha on Checkout not working --- .../view/frontend/web/js/model/place-order-mixin.js | 3 ++- .../view/frontend/web/js/webapiReCaptchaRegistry.js | 9 +++++++++ .../frontend/js/model/place-order-mixin.test.js | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 8695e742..34e3aebd 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -32,7 +32,8 @@ define([ }); //Trigger ReCaptcha validation recaptchaRegistry.triggers['recaptcha-checkout-place-order'](); - + //remove listener so that place order action is only triggered by the 'Place Order' button + recaptchaRegistry.removeListener('recaptcha-checkout-place-order'); return recaptchaDeferred; } diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js index ba2f786d..633f092c 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js @@ -37,6 +37,15 @@ define([], function () { } else { this._listeners[id] = func; } + }, + + /** + * Remove a listener + * + * @param id + */ + removeListener: function (id) { + this._listeners[id] = undefined; } }; }); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js index 39daff8e..1a3632a7 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js @@ -96,10 +96,12 @@ define(['squire' registry.addListener = function (id, func) { registry._listeners[id] = func; }; + registry.removeListener = jasmine.createSpy(); redirect.execute = jasmine.createSpy(); mixin()(action, serviceUrl, payload, messageContainer); expect(redirect.execute).toHaveBeenCalled(); + expect(registry.removeListener).toHaveBeenCalledWith(recaptchaId); }); }); }); From 60d89c1307e343df138df5642ea6b935b2bdcf0f Mon Sep 17 00:00:00 2001 From: Anna Bukatar Date: Fri, 24 Jun 2022 16:13:28 -0700 Subject: [PATCH 030/208] ACP2E-876: Google Recaptcha on Checkout not working --- .../view/frontend/web/js/model/place-order-mixin.js | 4 +--- .../frontend/js/model/place-order-mixin.test.js | 12 +++--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 34e3aebd..e2ac9e3c 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -8,8 +8,7 @@ define([ 'jquery', 'mage/utils/wrapper', - 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry', - 'Magento_Checkout/js/action/redirect-on-success' + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' ], function ($, wrapper, recaptchaRegistry, redirectOnSuccessAction) { 'use strict'; @@ -25,7 +24,6 @@ define([ payload.xReCaptchaValue = token; originalAction(serviceUrl, payload, messageContainer).done(function () { recaptchaDeferred.resolve.apply(recaptchaDeferred, arguments); - redirectOnSuccessAction.execute(); }).fail(function () { recaptchaDeferred.reject.apply(recaptchaDeferred, arguments); }); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js index 1a3632a7..499dca35 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js @@ -11,8 +11,7 @@ define(['squire' defaultContext = require.s.contexts._, mixin, - registry, - redirect; + registry; beforeEach(function (done) { window.checkoutConfig = { @@ -21,12 +20,10 @@ define(['squire' injector.require([ 'Magento_ReCaptchaCheckout/js/model/place-order-mixin', - 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry', - 'Magento_Checkout/js/action/redirect-on-success' - ], function (Mixin, Registry, Redirect) { + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' + ], function (Mixin, Registry) { mixin = Mixin; registry = Registry; - redirect = Redirect; done(); }); }); @@ -97,10 +94,7 @@ define(['squire' registry._listeners[id] = func; }; registry.removeListener = jasmine.createSpy(); - - redirect.execute = jasmine.createSpy(); mixin()(action, serviceUrl, payload, messageContainer); - expect(redirect.execute).toHaveBeenCalled(); expect(registry.removeListener).toHaveBeenCalledWith(recaptchaId); }); }); From 47c0cdb954a0f8ae4faeabc08b3c7a79d5b719d5 Mon Sep 17 00:00:00 2001 From: Anna Bukatar Date: Mon, 27 Jun 2022 10:27:30 -0700 Subject: [PATCH 031/208] ACP2E-876: Google Recaptcha on Checkout not working --- .../view/frontend/web/js/model/place-order-mixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index e2ac9e3c..9693ae7e 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -9,7 +9,7 @@ define([ 'jquery', 'mage/utils/wrapper', 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' -], function ($, wrapper, recaptchaRegistry, redirectOnSuccessAction) { +], function ($, wrapper, recaptchaRegistry) { 'use strict'; return function (placeOrder) { From 6583e3de358c541c08b552de484867836bc61e96 Mon Sep 17 00:00:00 2001 From: Sergiy Vasiutynskyi Date: Thu, 30 Jun 2022 14:10:18 +0300 Subject: [PATCH 032/208] AC-2751 updated Symfony to 5.4, fixed related code --- .../DisableReCaptchaForUserForgotPasswordCommand.php | 3 +++ .../Command/DisableReCaptchaForUserLoginCommand.php | 3 +++ TwoFactorAuth/Command/GoogleSecret.php | 7 +++++-- TwoFactorAuth/Command/TfaReset.php | 4 ++-- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php b/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php index 5ccf1519..64d384e2 100644 --- a/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php +++ b/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php @@ -7,6 +7,7 @@ namespace Magento\ReCaptchaUser\Command; +use Magento\Framework\Console\Cli; use Magento\ReCaptchaUser\Model\DisableReCaptchaForUserForgotPassword; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -47,5 +48,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $this->disableReCaptchaForUserForgotPassword->execute(); + + return Cli::RETURN_SUCCESS; } } diff --git a/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php b/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php index 461067e6..7a678fe5 100644 --- a/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php +++ b/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php @@ -7,6 +7,7 @@ namespace Magento\ReCaptchaUser\Command; +use Magento\Framework\Console\Cli; use Magento\ReCaptchaUser\Model\DisableReCaptchaForUserLogin; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; @@ -47,5 +48,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $this->disableReCaptchaForUserLogin->execute(); + + return Cli::RETURN_SUCCESS; } } diff --git a/TwoFactorAuth/Command/GoogleSecret.php b/TwoFactorAuth/Command/GoogleSecret.php index ba48fbab..3be8f01f 100644 --- a/TwoFactorAuth/Command/GoogleSecret.php +++ b/TwoFactorAuth/Command/GoogleSecret.php @@ -7,6 +7,7 @@ namespace Magento\TwoFactorAuth\Command; +use Magento\Framework\Console\Cli; use Magento\Framework\Exception\LocalizedException; use Magento\TwoFactorAuth\Api\UserConfigManagerInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\Google; @@ -68,8 +69,8 @@ protected function configure() $this->setName('security:tfa:google:set-secret'); $this->setDescription('Set the secret used for Google OTP generation.'); - $this->addArgument('user', InputArgument::REQUIRED, __('Username')); - $this->addArgument('secret', InputArgument::REQUIRED, __('Secret')); + $this->addArgument('user', InputArgument::REQUIRED, __('Username')->render()); + $this->addArgument('secret', InputArgument::REQUIRED, __('Secret')->render()); parent::configure(); } @@ -104,5 +105,7 @@ protected function execute(InputInterface $input, OutputInterface $output) ); $output->writeln((string)__('Google OTP secret has been set')); + + return Cli::RETURN_SUCCESS; } } diff --git a/TwoFactorAuth/Command/TfaReset.php b/TwoFactorAuth/Command/TfaReset.php index c3020ee0..6c4f55de 100644 --- a/TwoFactorAuth/Command/TfaReset.php +++ b/TwoFactorAuth/Command/TfaReset.php @@ -69,8 +69,8 @@ protected function configure() $this->setName('security:tfa:reset'); $this->setDescription('Reset configuration for one user'); - $this->addArgument('user', InputArgument::REQUIRED, __('Username')); - $this->addArgument('provider', InputArgument::REQUIRED, __('Provider code')); + $this->addArgument('user', InputArgument::REQUIRED, __('Username')->render()); + $this->addArgument('provider', InputArgument::REQUIRED, __('Provider code')->render()); parent::configure(); } From 5212b7fc02b5adbed3c7cf4dc168c0b34efdf650 Mon Sep 17 00:00:00 2001 From: SaurabhKumar Date: Fri, 8 Jul 2022 18:32:19 +0530 Subject: [PATCH 033/208] AC-3179::Can not resolve reCAPTCHA parameter --- .../RecaptchaDisabledActionGroup.xml | 26 +++++++ .../RecaptchaEnabledActionGroup.xml | 26 +++++++ .../Mftf/Data/RecaptchaConfigPageData.xml | 17 +++++ .../Mftf/Page/AdminStoreConfigurationPage.xml | 14 ++++ .../Mftf/Section/RecaptchaFormSection.xml | 16 +++++ .../AdminLoginReCaptchaFunctionalityTest.xml | 31 +++++++++ .../view/adminhtml/templates/recaptcha.phtml | 69 ++++++++++++------- 7 files changed, 174 insertions(+), 25 deletions(-) create mode 100644 ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml create mode 100644 ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml create mode 100644 ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml create mode 100644 ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml create mode 100644 ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml create mode 100644 ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml new file mode 100644 index 00000000..6ec51133 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml @@ -0,0 +1,26 @@ + + + + + + + Enable or disable admin login recaptcha + + + + + + + + + + + + + diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml new file mode 100644 index 00000000..0ca801ab --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -0,0 +1,26 @@ + + + + + + + Enable or disable admin login recaptcha + + + + + + + + + + + + + diff --git a/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml b/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml new file mode 100644 index 00000000..0238b563 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml @@ -0,0 +1,17 @@ + + + + + + recaptcha_v3 + + + + + diff --git a/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml b/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml new file mode 100644 index 00000000..f4574393 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml @@ -0,0 +1,14 @@ + + + + + +
+ + diff --git a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml new file mode 100644 index 00000000..300552bb --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml @@ -0,0 +1,16 @@ + + + + +
+ + + +
+
diff --git a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml new file mode 100644 index 00000000..42b41861 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml @@ -0,0 +1,31 @@ + + + + + + + + + + <description value="Admin should be able to login with enabled recaptcha option"/> + <severity value="AVERAGE"/> + <group value="login"/> + <testCaseId value="AC-3179"/> + </annotations> + <before> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> + <actionGroup ref="RecaptchaEnabledActionGroup" stepKey="recaptchaEnabled"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAgain11"/> + <actionGroup ref="RecaptchaDisabledActionGroup" stepKey="recaptchaDisabled"/> + </before> + <after> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + </test> +</tests> diff --git a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml index 35e287b3..c26af6a2 100644 --- a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml +++ b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml @@ -13,7 +13,6 @@ $isInvisible = !empty($config['invisible']); class="admin-recaptcha-content<?= /* @noEscape */ !empty($renderingOptions['size']) ? ' size-' . $renderingOptions['size'] : '' ?>"></div> </div> - <script> require([ 'jquery' @@ -27,36 +26,56 @@ $isInvisible = !empty($config['invisible']); element.src = 'https://www.google.com/recaptcha/api.js' + '?onload=globalOnRecaptchaOnLoadCallback&render=explicit'; - window.globalOnRecaptchaOnLoadCallback = function () { - let token = ''; + let isRecaptchaLoaded = false; + let token = ''; + let maxRetryAttempts = 5; + let attempts = 0; + let widgetId = 0; + <?php if ($isInvisible): ?> + $('#login-form').submit(function (event) { + if (!token) { + event.preventDefault(event); + event.stopImmediatePropagation(); + event.stopPropagation(); - this.widgetId = grecaptcha.render('admin-recaptcha', { - <?php foreach ($renderingOptions as $key => $value): ?> - '<?= $block->escapeJs($key) ?>': '<?= $block->escapeJs($value) ?>', - <?php endforeach; ?> - 'callback': function (token) { // jscs:ignore jsDoc - <?php if ($isInvisible): ?> - this.token = token; - $('#login-form').submit(); - <?php endif; ?> - }.bind(this) - }); + let attemptRecaptcha = () => { + attempts++; + if (attempts > maxRetryAttempts){ + console.error("Could not fetch invisible ReCaptcha token. Please refresh the page and try again."); + return; + } + if (!isRecaptchaLoaded) { - <?php if ($isInvisible): ?> - $('#login-form').submit(function (event) { - if (!this.token) { - grecaptcha.execute(this.widgetId).then( - function() { + setTimeout(() => { + attemptRecaptcha() + }, 1000); + return; + } + grecaptcha.execute(widgetId) + .then( () => { event.preventDefault(event); event.stopImmediatePropagation(); - }, function(reason) { - }); + event.stopPropagation(); + }, (reason) => { }) + .catch(err => { console.error(err); }); } - }.bind(this)); - <?php endif; ?> - - }.bind(this); + attemptRecaptcha(); + } + }); + <?php endif; ?> + window.globalOnRecaptchaOnLoadCallback = function () { + widgetId = grecaptcha.render('admin-recaptcha', { + <?php foreach ($renderingOptions as $key => $value): ?> '<?= $block->escapeJs($key) ?>': '<?= $block->escapeJs($value) ?>', + <?php endforeach; ?> 'callback': function (_token) { + <?php if ($isInvisible): ?> + token = _token; + $('#login-form').unbind('submit'); + $('#login-form').submit(); + <?php endif; ?> } + }); + isRecaptchaLoaded = true; + } scriptTag.parentNode.insertBefore(element, scriptTag); }); </script> From 10373209fe5d937fc59aa7d5f04b9264b0340ffb Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Fri, 8 Jul 2022 18:51:47 +0530 Subject: [PATCH 034/208] AC-3179::Can not resolve reCAPTCHA parameter --- .../RecaptchaDisabledActionGroup.xml | 26 +++++++ .../RecaptchaEnabledActionGroup.xml | 26 +++++++ .../Mftf/Data/RecaptchaConfigPageData.xml | 17 +++++ .../Mftf/Page/AdminStoreConfigurationPage.xml | 14 ++++ .../Mftf/Section/RecaptchaFormSection.xml | 16 +++++ .../AdminLoginReCaptchaFunctionalityTest.xml | 31 +++++++++ .../view/adminhtml/templates/recaptcha.phtml | 69 ++++++++++++------- 7 files changed, 174 insertions(+), 25 deletions(-) create mode 100644 ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml create mode 100644 ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml create mode 100644 ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml create mode 100644 ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml create mode 100644 ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml create mode 100644 ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml new file mode 100644 index 00000000..6ec51133 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RecaptchaDisabledActionGroup"> + <annotations> + <description>Enable or disable admin login recaptcha</description> + </annotations> + <arguments> + <argument name="optionValue" type="string" defaultValue="{{recaptchaFormDisabled.value}}"/> + </arguments> + + <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> + <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdown" /> + <click selector="{{RecaptchaFormSection.optionvalue}}" stepKey="clickedEnableForLogin"/> + <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setValue"/> + <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> + + </actionGroup> +</actionGroups> diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml new file mode 100644 index 00000000..0ca801ab --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="RecaptchaEnabledActionGroup"> + <annotations> + <description>Enable or disable admin login recaptcha</description> + </annotations> + <arguments> + <argument name="optionValue" type="string" defaultValue="{{recaptchaForm.value}}"/> + </arguments> + + <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> + <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdownSelection" /> + <click selector="{{RecaptchaFormSection.optionvalue}}" stepKey="clickDropdown"/> + <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setAttributeValue"/> + <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> + + </actionGroup> +</actionGroups> diff --git a/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml b/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml new file mode 100644 index 00000000..0238b563 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> + <entity name="recaptchaForm"> + <data key="value">recaptcha_v3</data> + </entity> + <entity name="recaptchaFormDisabled"> + <data key="value"></data> + </entity> +</entities> diff --git a/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml b/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml new file mode 100644 index 00000000..f4574393 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> + <page name="AdminStoreConfigurationPage" url="admin/system_config/edit/section/recaptcha_backend" area="admin" module="Magento_Backend"> + <section name="RecaptchaFormSection"/> + </page> +</pages> diff --git a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml new file mode 100644 index 00000000..300552bb --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="RecaptchaFormSection"> + <element name="optionvalue" type="select" selector="#recaptcha_backend_type_for_user_login"/> + <element name="saveConfig" type="button" selector="#save" timeout="30"/> + <element name="label" type="input" selector="#row_recaptcha_backend_type_for_user_login"/> + </section> +</sections> diff --git a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml new file mode 100644 index 00000000..42b41861 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminLoginReCaptchaFunctionalityTest"> + <annotations> + <features value="Backend"/> + <stories value="Check for Recaptcha on the Admin Login page"/> + <title value="Admin should be able to login with enabled recaptcha option"/> + <description value="Admin should be able to login with enabled recaptcha option"/> + <severity value="AVERAGE"/> + <group value="login"/> + <testCaseId value="AC-3179"/> + </annotations> + <before> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> + <actionGroup ref="RecaptchaEnabledActionGroup" stepKey="recaptchaEnabled"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAgain11"/> + <actionGroup ref="RecaptchaDisabledActionGroup" stepKey="recaptchaDisabled"/> + </before> + <after> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + </test> +</tests> diff --git a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml index 35e287b3..c26af6a2 100644 --- a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml +++ b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml @@ -13,7 +13,6 @@ $isInvisible = !empty($config['invisible']); class="admin-recaptcha-content<?= /* @noEscape */ !empty($renderingOptions['size']) ? ' size-' . $renderingOptions['size'] : '' ?>"></div> </div> - <script> require([ 'jquery' @@ -27,36 +26,56 @@ $isInvisible = !empty($config['invisible']); element.src = 'https://www.google.com/recaptcha/api.js' + '?onload=globalOnRecaptchaOnLoadCallback&render=explicit'; - window.globalOnRecaptchaOnLoadCallback = function () { - let token = ''; + let isRecaptchaLoaded = false; + let token = ''; + let maxRetryAttempts = 5; + let attempts = 0; + let widgetId = 0; + <?php if ($isInvisible): ?> + $('#login-form').submit(function (event) { + if (!token) { + event.preventDefault(event); + event.stopImmediatePropagation(); + event.stopPropagation(); - this.widgetId = grecaptcha.render('admin-recaptcha', { - <?php foreach ($renderingOptions as $key => $value): ?> - '<?= $block->escapeJs($key) ?>': '<?= $block->escapeJs($value) ?>', - <?php endforeach; ?> - 'callback': function (token) { // jscs:ignore jsDoc - <?php if ($isInvisible): ?> - this.token = token; - $('#login-form').submit(); - <?php endif; ?> - }.bind(this) - }); + let attemptRecaptcha = () => { + attempts++; + if (attempts > maxRetryAttempts){ + console.error("Could not fetch invisible ReCaptcha token. Please refresh the page and try again."); + return; + } + if (!isRecaptchaLoaded) { - <?php if ($isInvisible): ?> - $('#login-form').submit(function (event) { - if (!this.token) { - grecaptcha.execute(this.widgetId).then( - function() { + setTimeout(() => { + attemptRecaptcha() + }, 1000); + return; + } + grecaptcha.execute(widgetId) + .then( () => { event.preventDefault(event); event.stopImmediatePropagation(); - }, function(reason) { - }); + event.stopPropagation(); + }, (reason) => { }) + .catch(err => { console.error(err); }); } - }.bind(this)); - <?php endif; ?> - - }.bind(this); + attemptRecaptcha(); + } + }); + <?php endif; ?> + window.globalOnRecaptchaOnLoadCallback = function () { + widgetId = grecaptcha.render('admin-recaptcha', { + <?php foreach ($renderingOptions as $key => $value): ?> '<?= $block->escapeJs($key) ?>': '<?= $block->escapeJs($value) ?>', + <?php endforeach; ?> 'callback': function (_token) { + <?php if ($isInvisible): ?> + token = _token; + $('#login-form').unbind('submit'); + $('#login-form').submit(); + <?php endif; ?> } + }); + isRecaptchaLoaded = true; + } scriptTag.parentNode.insertBefore(element, scriptTag); }); </script> From 69e0543df26b908df82d25f66af6d97bfde5abe2 Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Mon, 11 Jul 2022 17:53:37 +0530 Subject: [PATCH 035/208] AC-3179:: Fixing static tests --- ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml index c26af6a2..e4ba91f1 100644 --- a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml +++ b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml @@ -41,7 +41,7 @@ $isInvisible = !empty($config['invisible']); let attemptRecaptcha = () => { attempts++; if (attempts > maxRetryAttempts){ - console.error("Could not fetch invisible ReCaptcha token. Please refresh the page and try again."); + console.error("Could not fetch invisible ReCaptcha token. Please refresh the page."); return; } if (!isRecaptchaLoaded) { @@ -66,7 +66,8 @@ $isInvisible = !empty($config['invisible']); window.globalOnRecaptchaOnLoadCallback = function () { widgetId = grecaptcha.render('admin-recaptcha', { - <?php foreach ($renderingOptions as $key => $value): ?> '<?= $block->escapeJs($key) ?>': '<?= $block->escapeJs($value) ?>', + <?php foreach ($renderingOptions as $key => $value): ?> + '<?= $block->escapeJs($key) ?>': '<?= $block->escapeJs($value) ?>', <?php endforeach; ?> 'callback': function (_token) { <?php if ($isInvisible): ?> token = _token; From 4ac153959dedb9611d7a43fcada8b1bc31293261 Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Tue, 16 Aug 2022 22:35:35 +0530 Subject: [PATCH 036/208] AC-3179: Fixing Mftf AdminLoginReCaptchaFunctionalityTest --- .../Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml | 1 + ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml | 1 + .../Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml index 0ca801ab..06f2d246 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -19,6 +19,7 @@ <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdownSelection" /> <click selector="{{RecaptchaFormSection.optionvalue}}" stepKey="clickDropdown"/> + <uncheckOption selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setAttributeValue"/> <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> diff --git a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml index 300552bb..d4914c04 100644 --- a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml +++ b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml @@ -12,5 +12,6 @@ <element name="optionvalue" type="select" selector="#recaptcha_backend_type_for_user_login"/> <element name="saveConfig" type="button" selector="#save" timeout="30"/> <element name="label" type="input" selector="#row_recaptcha_backend_type_for_user_login"/> + <element name="useConfigSettings" type="checkbox" selector="//input[@name='groups[type_for][fields][user_login][inherit]']"/> </section> </sections> diff --git a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml index 42b41861..a4c2ee47 100644 --- a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml +++ b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml @@ -20,9 +20,9 @@ <before> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="RecaptchaEnabledActionGroup" stepKey="recaptchaEnabled"/> - <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> - <actionGroup ref="AdminLoginActionGroup" stepKey="loginAgain11"/> - <actionGroup ref="RecaptchaDisabledActionGroup" stepKey="recaptchaDisabled"/> +<!-- <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>--> +<!-- <actionGroup ref="AdminLoginActionGroup" stepKey="loginAgain11"/>--> +<!-- <actionGroup ref="RecaptchaDisabledActionGroup" stepKey="recaptchaDisabled"/>--> </before> <after> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> From 3bc19cfcd9d2b4ddcd09811a83f4ee4f458f52c7 Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Wed, 17 Aug 2022 07:56:52 +0530 Subject: [PATCH 037/208] AC-3179: Fixing Mftf AdminLoginReCaptchaFunctionalityTest --- .../Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml index 06f2d246..204d3f3b 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -18,7 +18,7 @@ <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdownSelection" /> - <click selector="{{RecaptchaFormSection.optionvalue}}" stepKey="clickDropdown"/> +<!-- <click selector="{{RecaptchaFormSection.optionvalue}}" stepKey="clickDropdown"/>--> <uncheckOption selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setAttributeValue"/> <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> From 1c5d9cae2b9923e75e9b2c2b4decc3eb683bba7a Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Wed, 17 Aug 2022 09:59:06 +0530 Subject: [PATCH 038/208] AC-3179: Fixing Mftf AdminLoginReCaptchaFunctionalityTest --- .../Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml index 204d3f3b..a9adae9c 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -18,8 +18,11 @@ <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdownSelection" /> -<!-- <click selector="{{RecaptchaFormSection.optionvalue}}" stepKey="clickDropdown"/>--> + + <waitForElementClickable selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="waitForElementClickable"/> <uncheckOption selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> + <waitForElementClickable selector="{{RecaptchaFormSection.optionvalue}}" stepKey="waitForElementClickable2"/> + <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setAttributeValue"/> <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> From f0ed5deec8e1896202acc2d6928d998598a04140 Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Wed, 17 Aug 2022 10:50:41 +0530 Subject: [PATCH 039/208] AC-3179: Fixing Mftf AdminLoginReCaptchaFunctionalityTest --- .../Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml index a9adae9c..3b4d4812 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -18,11 +18,9 @@ <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdownSelection" /> - - <waitForElementClickable selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="waitForElementClickable"/> + <wait time="3" stepKey="waitForColumnUpdateToSave"/> <uncheckOption selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> - <waitForElementClickable selector="{{RecaptchaFormSection.optionvalue}}" stepKey="waitForElementClickable2"/> - + <wait time="3" stepKey="waitForColumnUpdateToSave1"/> <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setAttributeValue"/> <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> From f2973789b82d5e1a98f2f9a0264e2d73cc0a1bf2 Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Wed, 17 Aug 2022 13:10:48 +0530 Subject: [PATCH 040/208] AC-3179: Fixing Mftf AdminLoginReCaptchaFunctionalityTest --- .../ActionGroup/RecaptchaDisabledActionGroup.xml | 14 ++++++++------ .../ActionGroup/RecaptchaEnabledActionGroup.xml | 7 ++++--- .../Test/Mftf/Section/RecaptchaFormSection.xml | 1 + .../Test/AdminLoginReCaptchaFunctionalityTest.xml | 6 +++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml index 6ec51133..bbf1a866 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml @@ -10,17 +10,19 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="RecaptchaDisabledActionGroup"> <annotations> - <description>Enable or disable admin login recaptcha</description> + <description>Disable admin login recaptcha</description> </annotations> <arguments> <argument name="optionValue" type="string" defaultValue="{{recaptchaFormDisabled.value}}"/> </arguments> - <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> - <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdown" /> - <click selector="{{RecaptchaFormSection.optionvalue}}" stepKey="clickedEnableForLogin"/> - <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setValue"/> - <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> + <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoresConfiguration"/> + <conditionalClick selector="{{RecaptchaFormSection.adminblock}}" dependentSelector="{{RecaptchaFormSection.label}}" visible="false" stepKey="expand_panel"/> + <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scroll_to_dropdown" /> + <wait time="2" stepKey="wait_for_Load"/> + <checkOption selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="check_config_setting"/> + <wait time="2" stepKey="wait_for_load1"/> + <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="click_save"/> </actionGroup> </actionGroups> diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml index 3b4d4812..c2dd9c9a 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -10,17 +10,18 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="RecaptchaEnabledActionGroup"> <annotations> - <description>Enable or disable admin login recaptcha</description> + <description>Enable admin login recaptcha</description> </annotations> <arguments> <argument name="optionValue" type="string" defaultValue="{{recaptchaForm.value}}"/> </arguments> <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoreConfiguration"/> + <conditionalClick selector="{{RecaptchaFormSection.adminblock}}" dependentSelector="{{RecaptchaFormSection.label}}" visible="false" stepKey="expand_panel"/> <scrollTo selector="{{RecaptchaFormSection.label}}" stepKey="scrollToDropdownSelection" /> - <wait time="3" stepKey="waitForColumnUpdateToSave"/> + <wait time="2" stepKey="waitForLoad"/> <uncheckOption selector="{{RecaptchaFormSection.useConfigSettings}}" stepKey="uncheckConfigSetting"/> - <wait time="3" stepKey="waitForColumnUpdateToSave1"/> + <wait time="2" stepKey="waitForLoad_1"/> <selectOption selector="{{RecaptchaFormSection.optionvalue}}" userInput="{{optionValue}}" stepKey="setAttributeValue"/> <click selector="{{RecaptchaFormSection.saveConfig}}" stepKey="clickSave"/> diff --git a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml index d4914c04..b9b99d39 100644 --- a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml +++ b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml @@ -13,5 +13,6 @@ <element name="saveConfig" type="button" selector="#save" timeout="30"/> <element name="label" type="input" selector="#row_recaptcha_backend_type_for_user_login"/> <element name="useConfigSettings" type="checkbox" selector="//input[@name='groups[type_for][fields][user_login][inherit]']"/> + <element name="adminblock" type="button" selector='a#recaptcha_backend_type_for-head'/> </section> </sections> diff --git a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml index a4c2ee47..42b41861 100644 --- a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml +++ b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml @@ -20,9 +20,9 @@ <before> <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="RecaptchaEnabledActionGroup" stepKey="recaptchaEnabled"/> -<!-- <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/>--> -<!-- <actionGroup ref="AdminLoginActionGroup" stepKey="loginAgain11"/>--> -<!-- <actionGroup ref="RecaptchaDisabledActionGroup" stepKey="recaptchaDisabled"/>--> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAgain11"/> + <actionGroup ref="RecaptchaDisabledActionGroup" stepKey="recaptchaDisabled"/> </before> <after> <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> From 12fafb735dfb943eb64845c59f15293784961b90 Mon Sep 17 00:00:00 2001 From: SaurabhKumar <glo17680@adobe.com> Date: Wed, 17 Aug 2022 14:47:09 +0530 Subject: [PATCH 041/208] AC-3179: Fixing Mftf for recaptcha --- .../Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml index bbf1a866..c8ed6a4b 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml @@ -12,9 +12,6 @@ <annotations> <description>Disable admin login recaptcha</description> </annotations> - <arguments> - <argument name="optionValue" type="string" defaultValue="{{recaptchaFormDisabled.value}}"/> - </arguments> <amOnPage url="{{AdminStoreConfigurationPage.url}}" stepKey="navigateToAdminStoresConfiguration"/> <conditionalClick selector="{{RecaptchaFormSection.adminblock}}" dependentSelector="{{RecaptchaFormSection.label}}" visible="false" stepKey="expand_panel"/> From 7e82e24338254754ad6f24cd9531c3ca23cfe7df Mon Sep 17 00:00:00 2001 From: Faizan Shaikh <glo88465@adobe.com> Date: Wed, 17 Aug 2022 17:30:03 +0530 Subject: [PATCH 042/208] AC-2841:PHP 7.4 compatibility removal from the codebase --- ReCaptchaAdminUi/composer.json | 2 +- ReCaptchaCheckout/composer.json | 2 +- ReCaptchaContact/composer.json | 2 +- ReCaptchaCustomer/composer.json | 2 +- ReCaptchaFrontendUi/composer.json | 2 +- ReCaptchaMigration/composer.json | 2 +- ReCaptchaNewsletter/composer.json | 2 +- ReCaptchaPaypal/composer.json | 2 +- ReCaptchaReview/composer.json | 2 +- ReCaptchaSendFriend/composer.json | 2 +- ReCaptchaStorePickup/composer.json | 2 +- ReCaptchaUi/composer.json | 2 +- ReCaptchaUser/composer.json | 2 +- ReCaptchaValidation/composer.json | 2 +- ReCaptchaValidationApi/composer.json | 2 +- ReCaptchaVersion2Checkbox/composer.json | 2 +- ReCaptchaVersion2Invisible/composer.json | 2 +- ReCaptchaVersion3Invisible/composer.json | 2 +- ReCaptchaWebapiApi/composer.json | 2 +- ReCaptchaWebapiGraphQl/composer.json | 2 +- ReCaptchaWebapiRest/composer.json | 2 +- ReCaptchaWebapiUi/composer.json | 2 +- Securitytxt/composer.json | 2 +- TwoFactorAuth/composer.json | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/ReCaptchaAdminUi/composer.json b/ReCaptchaAdminUi/composer.json index 602ce4b0..9dae429b 100644 --- a/ReCaptchaAdminUi/composer.json +++ b/ReCaptchaAdminUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-admin-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckout/composer.json b/ReCaptchaCheckout/composer.json index c2d67de0..031d76d2 100644 --- a/ReCaptchaCheckout/composer.json +++ b/ReCaptchaCheckout/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaContact/composer.json b/ReCaptchaContact/composer.json index 5146c8df..ba5a1695 100644 --- a/ReCaptchaContact/composer.json +++ b/ReCaptchaContact/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-contact", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*" }, diff --git a/ReCaptchaCustomer/composer.json b/ReCaptchaCustomer/composer.json index cdbed567..356b9db5 100644 --- a/ReCaptchaCustomer/composer.json +++ b/ReCaptchaCustomer/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-customer", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-customer": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaFrontendUi/composer.json b/ReCaptchaFrontendUi/composer.json index 42e28501..711a8696 100644 --- a/ReCaptchaFrontendUi/composer.json +++ b/ReCaptchaFrontendUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-frontend-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaMigration/composer.json b/ReCaptchaMigration/composer.json index 6d823f30..b1724e4d 100644 --- a/ReCaptchaMigration/composer.json +++ b/ReCaptchaMigration/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-migration", "description": "Google reCAPTCHA config migration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-config": "*" }, diff --git a/ReCaptchaNewsletter/composer.json b/ReCaptchaNewsletter/composer.json index 3507d1da..f7f7a8ee 100644 --- a/ReCaptchaNewsletter/composer.json +++ b/ReCaptchaNewsletter/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-newsletter", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index 983a5922..a6a591af 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-paypal", "description": "Google reCaptcha integration for Magento2 PayPal PayflowPro payment form", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaReview/composer.json b/ReCaptchaReview/composer.json index c4f0b517..2ae69365 100644 --- a/ReCaptchaReview/composer.json +++ b/ReCaptchaReview/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-review", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaSendFriend/composer.json b/ReCaptchaSendFriend/composer.json index 1d5ac164..b43d9e59 100644 --- a/ReCaptchaSendFriend/composer.json +++ b/ReCaptchaSendFriend/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-send-friend", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaStorePickup/composer.json b/ReCaptchaStorePickup/composer.json index 686dbfe1..1973627d 100644 --- a/ReCaptchaStorePickup/composer.json +++ b/ReCaptchaStorePickup/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-store-pickup", "description": "Google reCaptcha integration for Magento2 Inventory Store Pickup shipping form", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaUi/composer.json b/ReCaptchaUi/composer.json index ef7438b6..30695a8d 100644 --- a/ReCaptchaUi/composer.json +++ b/ReCaptchaUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaUser/composer.json b/ReCaptchaUser/composer.json index b2e0cc08..dbf0d014 100644 --- a/ReCaptchaUser/composer.json +++ b/ReCaptchaUser/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-user", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*" diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index b1542885..f2608f9f 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", "google/recaptcha": "^1.2" diff --git a/ReCaptchaValidationApi/composer.json b/ReCaptchaValidationApi/composer.json index 2a6cc9aa..c2f116cb 100644 --- a/ReCaptchaValidationApi/composer.json +++ b/ReCaptchaValidationApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*" }, "type": "magento2-module", diff --git a/ReCaptchaVersion2Checkbox/composer.json b/ReCaptchaVersion2Checkbox/composer.json index d856134d..7d215de4 100644 --- a/ReCaptchaVersion2Checkbox/composer.json +++ b/ReCaptchaVersion2Checkbox/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-checkbox", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion2Invisible/composer.json b/ReCaptchaVersion2Invisible/composer.json index cae5a5e8..df4e03b4 100644 --- a/ReCaptchaVersion2Invisible/composer.json +++ b/ReCaptchaVersion2Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion3Invisible/composer.json b/ReCaptchaVersion3Invisible/composer.json index f03262d4..f5f7805d 100644 --- a/ReCaptchaVersion3Invisible/composer.json +++ b/ReCaptchaVersion3Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-3-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaWebapiApi/composer.json b/ReCaptchaWebapiApi/composer.json index d2d3ae10..c3b50d6a 100644 --- a/ReCaptchaWebapiApi/composer.json +++ b/ReCaptchaWebapiApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaWebapiGraphQl/composer.json b/ReCaptchaWebapiGraphQl/composer.json index e857046e..3c5e5126 100644 --- a/ReCaptchaWebapiGraphQl/composer.json +++ b/ReCaptchaWebapiGraphQl/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-graph-ql", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiRest/composer.json b/ReCaptchaWebapiRest/composer.json index cf15d4c6..a544a963 100644 --- a/ReCaptchaWebapiRest/composer.json +++ b/ReCaptchaWebapiRest/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-rest", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiUi/composer.json b/ReCaptchaWebapiUi/composer.json index c17bbba6..67a76db1 100644 --- a/ReCaptchaWebapiUi/composer.json +++ b/ReCaptchaWebapiUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-re-captcha-frontend-ui": "*" }, diff --git a/Securitytxt/composer.json b/Securitytxt/composer.json index 8f00f67f..6487d1ba 100644 --- a/Securitytxt/composer.json +++ b/Securitytxt/composer.json @@ -3,7 +3,7 @@ "description": "Security.txt file for Magento 2 websites", "type": "magento2-module", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-store": "*" diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 0c95b23d..86c3f741 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-two-factor-auth", "description": "Two Factor Authentication module for Magento2", "require": { - "php": "~7.4.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/magento-composer-installer": "*", "magento/module-backend": "*", From 03bf6663591cb8977c08f57e757deea440812719 Mon Sep 17 00:00:00 2001 From: Karyna Tsymbal <k.tsymbal@atwix.com> Date: Mon, 15 Aug 2022 15:55:27 +0200 Subject: [PATCH 043/208] AC-5893: Replace `Zend_Acl` with `laminas/laminas-permissions-acl` --- .../UserConfigRequestManagerTest.php | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/TwoFactorAuth/Test/Integration/UserConfigRequestManagerTest.php b/TwoFactorAuth/Test/Integration/UserConfigRequestManagerTest.php index bc081fa0..e9c966b9 100644 --- a/TwoFactorAuth/Test/Integration/UserConfigRequestManagerTest.php +++ b/TwoFactorAuth/Test/Integration/UserConfigRequestManagerTest.php @@ -9,7 +9,9 @@ namespace Magento\TwoFactorAuth\Test\Integration; use Magento\Framework\Acl\Builder; -use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Exception\AuthorizationException; +use Magento\TestFramework\Bootstrap; +use Magento\TestFramework\Helper\Bootstrap as BootstrapHelper; use Magento\TestFramework\Mail\Template\TransportBuilderMock; use Magento\User\Model\User; use Magento\TwoFactorAuth\Api\TfaInterface; @@ -17,6 +19,7 @@ use Magento\TwoFactorAuth\Api\UserConfigTokenManagerInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\Google; use PHPUnit\Framework\TestCase; +use Throwable; /** * @magentoDbIsolation enabled @@ -58,15 +61,15 @@ class UserConfigRequestManagerTest extends TestCase protected function setUp(): void { /** @var User $user */ - $user = Bootstrap::getObjectManager()->create(User::class); - $user->loadByUsername(\Magento\TestFramework\Bootstrap::ADMIN_NAME); + $user = BootstrapHelper::getObjectManager()->create(User::class); + $user->loadByUsername(Bootstrap::ADMIN_NAME); $this->user = $user; - $this->tfa = Bootstrap::getObjectManager()->get(TfaInterface::class); - $this->transportBuilderMock = Bootstrap::getObjectManager()->get(TransportBuilderMock::class); - $this->tokenManager = Bootstrap::getObjectManager()->get(UserConfigTokenManagerInterface::class); - $this->aclBuilder = Bootstrap::getObjectManager()->get(Builder::class); + $this->tfa = BootstrapHelper::getObjectManager()->get(TfaInterface::class); + $this->transportBuilderMock = BootstrapHelper::getObjectManager()->get(TransportBuilderMock::class); + $this->tokenManager = BootstrapHelper::getObjectManager()->get(UserConfigTokenManagerInterface::class); + $this->aclBuilder = BootstrapHelper::getObjectManager()->get(Builder::class); - $this->manager = Bootstrap::getObjectManager()->get(UserConfigRequestManagerInterface::class); + $this->manager = BootstrapHelper::getObjectManager()->get(UserConfigRequestManagerInterface::class); } /** @@ -104,17 +107,20 @@ public function testIsRequiredWithConfig(): void } /** - * Check that app config request E-mail is NOT sent for a user that does not posses proper rights. + * Check that app config request E-mail is NOT sent for a user that does not possess proper rights. * * @return void - * @throws \Throwable + * @throws Throwable * @magentoAppArea adminhtml * @magentoAppIsolation enabled */ public function testFailAppConfigRequest(): void { - $this->expectException(\Magento\Framework\Exception\AuthorizationException::class); - $this->aclBuilder->getAcl()->deny(null, 'Magento_TwoFactorAuth::config'); + $this->expectException(AuthorizationException::class); + $this->aclBuilder->getAcl()->deny( + Bootstrap::ADMIN_ROLE_ID, + 'Magento_TwoFactorAuth::config' + ); $this->manager->sendConfigRequestTo($this->user); } @@ -122,7 +128,7 @@ public function testFailAppConfigRequest(): void * Check that app config request E-mail is sent for a user that posseses proper rights. * * @return void - * @throws \Throwable + * @throws Throwable * @magentoAppArea adminhtml */ public function testSendAppConfigRequest(): void @@ -151,7 +157,7 @@ public function testSendAppConfigRequest(): void * Check that personal 2FA config request E-mail is sent for users. * * @return void - * @throws \Throwable + * @throws Throwable * @magentoAppArea adminhtml * @magentoConfigFixture default/twofactorauth/general/force_providers google */ From d6abe9c9fc8a73851a74913405f104806d2a850e Mon Sep 17 00:00:00 2001 From: Faizan Shaikh <glo88465@adobe.com> Date: Mon, 12 Sep 2022 14:56:21 +0530 Subject: [PATCH 044/208] AC-2841:PHP 7.4 compatibility removal from the codebase --- ReCaptchaCheckoutSalesRule/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaCheckoutSalesRule/composer.json b/ReCaptchaCheckoutSalesRule/composer.json index fba933ad..9cc5b307 100644 --- a/ReCaptchaCheckoutSalesRule/composer.json +++ b/ReCaptchaCheckoutSalesRule/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout-sales-rule", "description": "Google ReCaptcha integration for Magento2 coupons", "require": { - "php": "~7.4.0||~8.0.0||~8.1.0", + "php": "~8.1.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-sales-rule": "*", From c947f7ff6221e4d9d0b5ddbc88975c3fa1f7adc4 Mon Sep 17 00:00:00 2001 From: Faizan Shaikh <glo88465@adobe.com> Date: Mon, 12 Sep 2022 15:46:37 +0530 Subject: [PATCH 045/208] AC-6646::Add PHP 8.2 Compatibility Support --- ReCaptchaAdminUi/composer.json | 2 +- ReCaptchaCheckout/composer.json | 2 +- ReCaptchaCheckoutSalesRule/composer.json | 2 +- ReCaptchaContact/composer.json | 2 +- ReCaptchaCustomer/composer.json | 2 +- ReCaptchaFrontendUi/composer.json | 2 +- ReCaptchaMigration/composer.json | 2 +- ReCaptchaNewsletter/composer.json | 2 +- ReCaptchaPaypal/composer.json | 2 +- ReCaptchaReview/composer.json | 2 +- ReCaptchaSendFriend/composer.json | 2 +- ReCaptchaStorePickup/composer.json | 2 +- ReCaptchaUi/composer.json | 2 +- ReCaptchaUser/composer.json | 2 +- ReCaptchaValidation/composer.json | 2 +- ReCaptchaValidationApi/composer.json | 2 +- ReCaptchaVersion2Checkbox/composer.json | 2 +- ReCaptchaVersion2Invisible/composer.json | 2 +- ReCaptchaVersion3Invisible/composer.json | 2 +- ReCaptchaWebapiApi/composer.json | 2 +- ReCaptchaWebapiGraphQl/composer.json | 2 +- ReCaptchaWebapiRest/composer.json | 2 +- ReCaptchaWebapiUi/composer.json | 2 +- Securitytxt/composer.json | 2 +- TwoFactorAuth/composer.json | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ReCaptchaAdminUi/composer.json b/ReCaptchaAdminUi/composer.json index 9dae429b..8ab7667a 100644 --- a/ReCaptchaAdminUi/composer.json +++ b/ReCaptchaAdminUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-admin-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckout/composer.json b/ReCaptchaCheckout/composer.json index 031d76d2..523b84b0 100644 --- a/ReCaptchaCheckout/composer.json +++ b/ReCaptchaCheckout/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckoutSalesRule/composer.json b/ReCaptchaCheckoutSalesRule/composer.json index 9cc5b307..69efca85 100644 --- a/ReCaptchaCheckoutSalesRule/composer.json +++ b/ReCaptchaCheckoutSalesRule/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout-sales-rule", "description": "Google ReCaptcha integration for Magento2 coupons", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-sales-rule": "*", diff --git a/ReCaptchaContact/composer.json b/ReCaptchaContact/composer.json index ba5a1695..d5e2ebfd 100644 --- a/ReCaptchaContact/composer.json +++ b/ReCaptchaContact/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-contact", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*" }, diff --git a/ReCaptchaCustomer/composer.json b/ReCaptchaCustomer/composer.json index 356b9db5..f88849d6 100644 --- a/ReCaptchaCustomer/composer.json +++ b/ReCaptchaCustomer/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-customer", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-customer": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaFrontendUi/composer.json b/ReCaptchaFrontendUi/composer.json index 711a8696..4f8a3e3b 100644 --- a/ReCaptchaFrontendUi/composer.json +++ b/ReCaptchaFrontendUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-frontend-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaMigration/composer.json b/ReCaptchaMigration/composer.json index b1724e4d..a03184aa 100644 --- a/ReCaptchaMigration/composer.json +++ b/ReCaptchaMigration/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-migration", "description": "Google reCAPTCHA config migration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-config": "*" }, diff --git a/ReCaptchaNewsletter/composer.json b/ReCaptchaNewsletter/composer.json index f7f7a8ee..fe6407bc 100644 --- a/ReCaptchaNewsletter/composer.json +++ b/ReCaptchaNewsletter/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-newsletter", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index a6a591af..ca2c4da5 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-paypal", "description": "Google reCaptcha integration for Magento2 PayPal PayflowPro payment form", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaReview/composer.json b/ReCaptchaReview/composer.json index 2ae69365..168f3e32 100644 --- a/ReCaptchaReview/composer.json +++ b/ReCaptchaReview/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-review", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaSendFriend/composer.json b/ReCaptchaSendFriend/composer.json index b43d9e59..9380756c 100644 --- a/ReCaptchaSendFriend/composer.json +++ b/ReCaptchaSendFriend/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-send-friend", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaStorePickup/composer.json b/ReCaptchaStorePickup/composer.json index 1973627d..d06bb6e5 100644 --- a/ReCaptchaStorePickup/composer.json +++ b/ReCaptchaStorePickup/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-store-pickup", "description": "Google reCaptcha integration for Magento2 Inventory Store Pickup shipping form", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaUi/composer.json b/ReCaptchaUi/composer.json index 30695a8d..377c3548 100644 --- a/ReCaptchaUi/composer.json +++ b/ReCaptchaUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaUser/composer.json b/ReCaptchaUser/composer.json index dbf0d014..f3868767 100644 --- a/ReCaptchaUser/composer.json +++ b/ReCaptchaUser/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-user", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*" diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index f2608f9f..24d29067 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", "google/recaptcha": "^1.2" diff --git a/ReCaptchaValidationApi/composer.json b/ReCaptchaValidationApi/composer.json index c2f116cb..4ab30430 100644 --- a/ReCaptchaValidationApi/composer.json +++ b/ReCaptchaValidationApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*" }, "type": "magento2-module", diff --git a/ReCaptchaVersion2Checkbox/composer.json b/ReCaptchaVersion2Checkbox/composer.json index 7d215de4..6b5dd7e7 100644 --- a/ReCaptchaVersion2Checkbox/composer.json +++ b/ReCaptchaVersion2Checkbox/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-checkbox", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion2Invisible/composer.json b/ReCaptchaVersion2Invisible/composer.json index df4e03b4..35901d54 100644 --- a/ReCaptchaVersion2Invisible/composer.json +++ b/ReCaptchaVersion2Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion3Invisible/composer.json b/ReCaptchaVersion3Invisible/composer.json index f5f7805d..d6f96f9e 100644 --- a/ReCaptchaVersion3Invisible/composer.json +++ b/ReCaptchaVersion3Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-3-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaWebapiApi/composer.json b/ReCaptchaWebapiApi/composer.json index c3b50d6a..1abd1d3c 100644 --- a/ReCaptchaWebapiApi/composer.json +++ b/ReCaptchaWebapiApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaWebapiGraphQl/composer.json b/ReCaptchaWebapiGraphQl/composer.json index 3c5e5126..a93b5b80 100644 --- a/ReCaptchaWebapiGraphQl/composer.json +++ b/ReCaptchaWebapiGraphQl/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-graph-ql", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiRest/composer.json b/ReCaptchaWebapiRest/composer.json index a544a963..1055ec24 100644 --- a/ReCaptchaWebapiRest/composer.json +++ b/ReCaptchaWebapiRest/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-rest", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiUi/composer.json b/ReCaptchaWebapiUi/composer.json index 67a76db1..f7943a1a 100644 --- a/ReCaptchaWebapiUi/composer.json +++ b/ReCaptchaWebapiUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-re-captcha-frontend-ui": "*" }, diff --git a/Securitytxt/composer.json b/Securitytxt/composer.json index 6487d1ba..df2d6339 100644 --- a/Securitytxt/composer.json +++ b/Securitytxt/composer.json @@ -3,7 +3,7 @@ "description": "Security.txt file for Magento 2 websites", "type": "magento2-module", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-store": "*" diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 86c3f741..e89c6b96 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-two-factor-auth", "description": "Two Factor Authentication module for Magento2", "require": { - "php": "~8.1.0", + "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/magento-composer-installer": "*", "magento/module-backend": "*", From a190f787bd1c2b04523e76dbab006bd8dc94b38a Mon Sep 17 00:00:00 2001 From: "Chhandak.Barua" <chhandak.barua@BLR1-LMC-N73490.local> Date: Thu, 17 Nov 2022 21:44:22 +0530 Subject: [PATCH 046/208] ACP2E-1338: Google reCaptcha in Incorrect position --- ReCaptchaReview/view/frontend/layout/catalog_product_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml b/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml index 95b33228..2892de64 100644 --- a/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml +++ b/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml @@ -7,7 +7,7 @@ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> - <referenceContainer name="product.review.form.fields.before"> + <referenceContainer name="form.additional.review.info"> <block class="Magento\ReCaptchaUi\Block\ReCaptcha" name="recaptcha" after="-" template="Magento_ReCaptchaFrontendUi::recaptcha.phtml" From 06ac0f3650dd73697d00e12047535a843cd02fc1 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Fri, 18 Nov 2022 17:50:23 -0600 Subject: [PATCH 047/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../LayoutProcessor/Checkout/Onepage.php | 6 +-- .../frontend/layout/checkout_index_index.xml | 12 ++--- .../web/js/model/place-order-mixin.js | 21 ++++++--- .../view/frontend/web/js/reCaptchaCheckout.js | 45 +++++++++++++++++++ .../view/frontend/web/template/reCaptcha.html | 27 +++++++++++ .../LayoutProcessor/Checkout/Onepage.php | 5 +++ 6 files changed, 100 insertions(+), 16 deletions(-) create mode 100644 ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js create mode 100644 ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html diff --git a/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php index fac0c3d4..00b76086 100644 --- a/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php @@ -75,14 +75,14 @@ public function process($jsLayout) $key = 'place_order'; if ($this->isCaptchaEnabled->isCaptchaEnabledFor($key)) { $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['beforeMethods']['children']['place-order-recaptcha-container']['children'] + ['payment']['children']['payments-list']['children']['before-place-order']['children'] ['place-order-recaptcha']['settings'] = $this->captchaUiConfigResolver->get($key); } else { if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['beforeMethods']['children']['place-order-recaptcha-container']['children'] + ['payment']['children']['payments-list']['children']['before-place-order']['children'] ['place-order-recaptcha'])) { unset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['beforeMethods']['children']['place-order-recaptcha-container'] + ['payment']['children']['payments-list']['children']['before-place-order'] ['children']['place-order-recaptcha']); } } diff --git a/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml b/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml index 0b2261ee..c4f64a3e 100644 --- a/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml +++ b/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml @@ -49,18 +49,18 @@ </item> </item> </item> - <item name="beforeMethods" xsi:type="array"> + <item name="payments-list" xsi:type="array"> <item name="children" xsi:type="array"> - <item name="place-order-recaptcha-container" xsi:type="array"> - <item name="component" xsi:type="string">uiComponent</item> - <item name="template" xsi:type="string">Magento_ReCaptchaCheckout/payment-recaptcha-container</item> - <item name="displayArea" xsi:type="string">beforeMethods</item> + <item name="before-place-order" xsi:type="array"> <item name="children" xsi:type="array"> <item name="place-order-recaptcha" xsi:type="array"> - <item name="component" xsi:type="string">Magento_ReCaptchaWebapiUi/js/webapiReCaptcha</item> + <item name="component" xsi:type="string">Magento_ReCaptchaCheckout/js/reCaptchaCheckout</item> <item name="displayArea" xsi:type="string">place-order-recaptcha</item> <item name="configSource" xsi:type="string">checkoutConfig</item> <item name="reCaptchaId" xsi:type="string">recaptcha-checkout-place-order</item> + <item name="skipPayments" xsi:type="array"> + + </item> </item> </item> </item> diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 9693ae7e..2cd102bd 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -4,22 +4,29 @@ */ /* eslint-disable max-nested-callbacks */ +/* eslint-disable max-depth */ define([ 'jquery', 'mage/utils/wrapper', - 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' -], function ($, wrapper, recaptchaRegistry) { + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry', + 'Magento_Checkout/js/model/quote' +], function ($, wrapper, recaptchaRegistry, quote) { 'use strict'; return function (placeOrder) { return wrapper.wrap(placeOrder, function (originalAction, serviceUrl, payload, messageContainer) { - var recaptchaDeferred; + var recaptchaDeferred, + reCaptchaId; - if (recaptchaRegistry.triggers.hasOwnProperty('recaptcha-checkout-place-order')) { + if (quote.paymentMethod()) { + reCaptchaId = 'recaptcha-checkout-place-order-' + quote.paymentMethod().method; + } + + if (reCaptchaId !== undefined && recaptchaRegistry.triggers.hasOwnProperty(reCaptchaId)) { //ReCaptcha is present for checkout recaptchaDeferred = $.Deferred(); - recaptchaRegistry.addListener('recaptcha-checkout-place-order', function (token) { + recaptchaRegistry.addListener(reCaptchaId, function (token) { //Add reCaptcha value to place-order request and resolve deferred with the API call results payload.xReCaptchaValue = token; originalAction(serviceUrl, payload, messageContainer).done(function () { @@ -29,9 +36,9 @@ define([ }); }); //Trigger ReCaptcha validation - recaptchaRegistry.triggers['recaptcha-checkout-place-order'](); + recaptchaRegistry.triggers[reCaptchaId](); //remove listener so that place order action is only triggered by the 'Place Order' button - recaptchaRegistry.removeListener('recaptcha-checkout-place-order'); + recaptchaRegistry.removeListener(reCaptchaId); return recaptchaDeferred; } diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js new file mode 100644 index 00000000..06239d26 --- /dev/null +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -0,0 +1,45 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +// jscs:disable jsDoc + +/* global grecaptcha */ +define( + [ + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptcha', + 'jquery' + ], + function (Component, $) { + 'use strict'; + + return Component.extend({ + defaults: { + template: 'Magento_ReCaptchaCheckout/reCaptcha', + skipPayments: [] + }, + + /** + * Render reCAPTCHA + */ + renderReCaptchaForPayment: function (method) { + var reCaptcha; + + if (!this.skipPayments || !this.skipPayments.hasOwnProperty(method.getCode())) { + reCaptcha = $.extend({}, this); + + reCaptcha.reCaptchaId = this.getPaymentReCaptchaId(method); + reCaptcha.renderReCaptcha(); + } + }, + + /** + * Render reCAPTCHA + */ + getPaymentReCaptchaId: function (method) { + return this.getReCaptchaId() + '-' + method.getCode(); + } + }); + } +); diff --git a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html new file mode 100644 index 00000000..9fee8ab2 --- /dev/null +++ b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html @@ -0,0 +1,27 @@ +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> + +<div data-bind="{ + attr: { + 'id': getPaymentReCaptchaId($parents[1]) + '-wrapper' + }, + 'afterRender': renderReCaptchaForPayment($parents[1]) +}"> + <div class="g-recaptcha"></div> + <!-- ko if: (!getIsInvisibleRecaptcha()) --> + <div class="field"> + <div class="control"> + <input type="checkbox" + value="" + class="required-captcha checkbox" + name="recaptcha-validate-" + data-validate="{required:true}" + tabindex="-1"> + </div> + </div> + <!-- /ko --> +</div> diff --git a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php index bd8027af..5522f36f 100644 --- a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php @@ -53,6 +53,11 @@ public function process($jsLayout) $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['payments-list']['children']['paypal-captcha']['children'] ['recaptcha']['settings'] = $this->captchaUiConfigResolver->get($key); + if ($this->isCaptchaEnabled->isCaptchaEnabledFor('place_order')) { + $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['payments-list']['children']['before-place-order']['children'] + ['place-order-recaptcha']['skipPayments']['payflowpro'] = true; + } } else { if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['payments-list']['children']['paypal-captcha']['children']['recaptcha'])) { From 0564dde26705f6b650a50dd91171239c92bc5180 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Sat, 19 Nov 2022 10:43:06 -0600 Subject: [PATCH 048/208] ACP2E-1338: Google reCaptcha in Incorrect position --- ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php index 5522f36f..026086a9 100644 --- a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php @@ -40,7 +40,7 @@ public function __construct( } /** - * {@inheritdoc} + * @inheritdoc * * @param array $jsLayout * @return array From b53fbedce3935fa1234741621aeef9085f481fce Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Sat, 19 Nov 2022 12:37:42 -0600 Subject: [PATCH 049/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../LayoutProcessor/Checkout/Onepage.php | 8 ++- .../SkipPlaceOrderRecaptchaValidation.php | 68 +++++++++++++++++++ ReCaptchaPaypal/composer.json | 4 +- ReCaptchaPaypal/etc/webapi_rest/di.xml | 13 ++++ 4 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php create mode 100644 ReCaptchaPaypal/etc/webapi_rest/di.xml diff --git a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php index 026086a9..7c279b82 100644 --- a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php @@ -9,6 +9,7 @@ use Magento\Checkout\Block\Checkout\LayoutProcessorInterface; use Magento\Framework\Exception\InputException; +use Magento\Paypal\Model\Config; use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\UiConfigResolverInterface; @@ -56,7 +57,12 @@ public function process($jsLayout) if ($this->isCaptchaEnabled->isCaptchaEnabledFor('place_order')) { $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['payments-list']['children']['before-place-order']['children'] - ['place-order-recaptcha']['skipPayments']['payflowpro'] = true; + ['place-order-recaptcha']['skipPayments'] += [ + Config::METHOD_EXPRESS => true, + Config::METHOD_PAYFLOWPRO => true, + Config::METHOD_WPP_PE_EXPRESS => true, + Config::METHOD_WPP_PE_BML => true, + ]; } } else { if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] diff --git a/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php b/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php new file mode 100644 index 00000000..c881214e --- /dev/null +++ b/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php @@ -0,0 +1,68 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaPaypal\Plugin; + +use Magento\Framework\Webapi\Rest\Request; +use Magento\Paypal\Model\Config; +use Magento\ReCaptchaCheckout\Model\WebapiConfigProvider; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; +use Magento\ReCaptchaWebapiApi\Api\Data\EndpointInterface; + +class SkipPlaceOrderRecaptchaValidation +{ + private const PAYPAL_PAYFLOWPRO_CAPTCHA_ID = 'paypal_payflowpro'; + + /** + * @var IsCaptchaEnabledInterface + */ + private IsCaptchaEnabledInterface $isCaptchaEnabled; + + /** + * @var Request + */ + private Request $request; + + /** + * @param IsCaptchaEnabledInterface $isCaptchaEnabled + * @param Request $request + */ + public function __construct( + IsCaptchaEnabledInterface $isCaptchaEnabled, + Request $request + ) { + $this->isCaptchaEnabled = $isCaptchaEnabled; + $this->request = $request; + } + + /** + * Skip captcha validation for "place order" button if captcha is enabled for payflow + * + * @param WebapiConfigProvider $subject + * @param ValidationConfigInterface $result + * @param EndpointInterface $endpoint + * @return ValidationConfigInterface + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterGetConfigFor( + WebapiConfigProvider $subject, + ?ValidationConfigInterface $result, + EndpointInterface $endpoint + ): ?ValidationConfigInterface { + + if ($result && $this->isCaptchaEnabled->isCaptchaEnabledFor(self::PAYPAL_PAYFLOWPRO_CAPTCHA_ID)) { + $bodyParams = $this->request->getBodyParams(); + $paymentMethod = $bodyParams['paymentMethod'] ?? $bodyParams['payment_method'] ?? []; + if (isset($paymentMethod['method']) && $paymentMethod['method'] === Config::METHOD_PAYFLOWPRO) { + return null; + } + } + + return $result; + } +} diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index ca2c4da5..a5f1a745 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -7,7 +7,9 @@ "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", "magento/module-checkout": "*", - "magento/module-re-captcha-webapi-api": "*" + "magento/module-re-captcha-webapi-api": "*", + "magento/module-paypal": "*", + "magento/module-re-captcha-checkout": "*" }, "type": "magento2-module", "license": "OSL-3.0", diff --git a/ReCaptchaPaypal/etc/webapi_rest/di.xml b/ReCaptchaPaypal/etc/webapi_rest/di.xml new file mode 100644 index 00000000..d01d6fb5 --- /dev/null +++ b/ReCaptchaPaypal/etc/webapi_rest/di.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + <type name="Magento\ReCaptchaCheckout\Model\WebapiConfigProvider"> + <plugin name="skip_place_order_recaptcha_validation" type="Magento\ReCaptchaPaypal\Plugin\SkipPlaceOrderRecaptchaValidation"/> + </type> +</config> From b5afaf4953eaad7b99d221a9ec3ee449fc5cf816 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Sat, 19 Nov 2022 15:08:49 -0600 Subject: [PATCH 050/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../view/frontend/web/js/reCaptchaCheckout.js | 30 ++++++++++++------- .../view/frontend/web/template/reCaptcha.html | 7 +++-- .../SkipPlaceOrderRecaptchaValidation.php | 2 +- 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js index 06239d26..46cca89a 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -3,9 +3,6 @@ * See COPYING.txt for license details. */ -// jscs:disable jsDoc - -/* global grecaptcha */ define( [ 'Magento_ReCaptchaWebapiUi/js/webapiReCaptcha', @@ -22,23 +19,36 @@ define( /** * Render reCAPTCHA + * + * @param {Object} method */ - renderReCaptchaForPayment: function (method) { + renderReCaptchaFor: function (method) { var reCaptcha; - if (!this.skipPayments || !this.skipPayments.hasOwnProperty(method.getCode())) { - reCaptcha = $.extend({}, this); - - reCaptcha.reCaptchaId = this.getPaymentReCaptchaId(method); + if (this.isCheckoutReCaptchaRequiredFor(method)) { + reCaptcha = $.extend(true, {}, this, {reCaptchaId: this.getReCaptchaIdFor(method)}); reCaptcha.renderReCaptcha(); } }, /** - * Render reCAPTCHA + * Get reCAPTCHA ID + * + * @param {Object} method + * @returns {String} */ - getPaymentReCaptchaId: function (method) { + getReCaptchaIdFor: function (method) { return this.getReCaptchaId() + '-' + method.getCode(); + }, + + /** + * Check whether checkout reCAPTCHA is required for payment method + * + * @param {Object} method + * @returns {Boolean} + */ + isCheckoutReCaptchaRequiredFor: function (method) { + return !this.skipPayments || !this.skipPayments.hasOwnProperty(method.getCode()); } }); } diff --git a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html index 9fee8ab2..4b0cc558 100644 --- a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html @@ -4,12 +4,12 @@ * See COPYING.txt for license details. */ --> - +<!-- ko if: (isCheckoutReCaptchaRequiredFor($parents[1]))--> <div data-bind="{ attr: { - 'id': getPaymentReCaptchaId($parents[1]) + '-wrapper' + 'id': getReCaptchaIdFor($parents[1]) + '-wrapper' }, - 'afterRender': renderReCaptchaForPayment($parents[1]) + 'afterRender': renderReCaptchaFor($parents[1]) }"> <div class="g-recaptcha"></div> <!-- ko if: (!getIsInvisibleRecaptcha()) --> @@ -25,3 +25,4 @@ </div> <!-- /ko --> </div> +<!-- /ko --> diff --git a/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php b/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php index c881214e..28cd5be0 100644 --- a/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php +++ b/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php @@ -41,7 +41,7 @@ public function __construct( } /** - * Skip captcha validation for "place order" button if captcha is enabled for payflow + * Skip captcha validation for "place order" button if captcha is enabled for payflowpro * * @param WebapiConfigProvider $subject * @param ValidationConfigInterface $result From f9b8bb70b7e9cc432e20703004400313c60ddbd6 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Sat, 19 Nov 2022 15:59:46 -0600 Subject: [PATCH 051/208] ACP2E-1338: Google reCaptcha in Incorrect position --- ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml b/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml index c4f64a3e..ffc3c6ef 100644 --- a/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml +++ b/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml @@ -55,7 +55,7 @@ <item name="children" xsi:type="array"> <item name="place-order-recaptcha" xsi:type="array"> <item name="component" xsi:type="string">Magento_ReCaptchaCheckout/js/reCaptchaCheckout</item> - <item name="displayArea" xsi:type="string">place-order-recaptcha</item> + <item name="displayArea" xsi:type="string">before-place-order</item> <item name="configSource" xsi:type="string">checkoutConfig</item> <item name="reCaptchaId" xsi:type="string">recaptcha-checkout-place-order</item> <item name="skipPayments" xsi:type="array"> From 3a855767741a78887246bde906c97a12046f822d Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Sat, 19 Nov 2022 20:29:49 -0600 Subject: [PATCH 052/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../view/frontend/web/js/reCaptchaCheckout.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js index 46cca89a..4fd47be3 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -49,6 +49,23 @@ define( */ isCheckoutReCaptchaRequiredFor: function (method) { return !this.skipPayments || !this.skipPayments.hasOwnProperty(method.getCode()); + }, + + /** + * @inheritdoc + */ + initCaptcha: function () { + var $wrapper, $recaptchaResponseInput; + + this._super(); + // Since there will be multiple recaptcha in the payment form, + // they may override each other if the form is submitted. + // The recaptcha response will be collected in the callback: reCaptchaCallback() + $wrapper = $('#' + this.getReCaptchaId() + '-wrapper'); + $recaptchaResponseInput = $wrapper.find('[name=g-recaptcha-response]'); + if ($recaptchaResponseInput.length) { + $recaptchaResponseInput.prop('disabled', true); + } } }); } From 06ccaac76b3b3c908af76f8973a1c84fcb07a669 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 21 Nov 2022 09:05:14 -0600 Subject: [PATCH 053/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../view/frontend/web/js/reCaptchaCheckout.js | 2 +- .../LayoutProcessor/Checkout/Onepage.php | 19 ++-- ReCaptchaPaypal/Model/ReCaptchaSession.php | 93 +++++++++++++++++++ ReCaptchaPaypal/Observer/PayPalObserver.php | 15 ++- ...> ReplayPayflowReCaptchaForPlaceOrder.php} | 20 +++- ReCaptchaPaypal/etc/frontend/di.xml | 6 ++ ReCaptchaPaypal/etc/webapi_rest/di.xml | 2 +- 7 files changed, 142 insertions(+), 15 deletions(-) create mode 100644 ReCaptchaPaypal/Model/ReCaptchaSession.php rename ReCaptchaPaypal/Plugin/{SkipPlaceOrderRecaptchaValidation.php => ReplayPayflowReCaptchaForPlaceOrder.php} (74%) diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js index 4fd47be3..0598448a 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -14,7 +14,7 @@ define( return Component.extend({ defaults: { template: 'Magento_ReCaptchaCheckout/reCaptcha', - skipPayments: [] + skipPayments: [] // List of payment methods that do not require this reCaptcha }, /** diff --git a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php index 7c279b82..16a6c528 100644 --- a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php @@ -50,19 +50,17 @@ public function __construct( public function process($jsLayout) { $key = 'paypal_payflowpro'; + $skipCheckoutRecaptchaForPayments = [ + Config::METHOD_EXPRESS => true, + Config::METHOD_WPP_PE_EXPRESS => true, + Config::METHOD_WPP_PE_BML => true, + ]; if ($this->isCaptchaEnabled->isCaptchaEnabledFor($key)) { $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] ['payment']['children']['payments-list']['children']['paypal-captcha']['children'] ['recaptcha']['settings'] = $this->captchaUiConfigResolver->get($key); if ($this->isCaptchaEnabled->isCaptchaEnabledFor('place_order')) { - $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] - ['payment']['children']['payments-list']['children']['before-place-order']['children'] - ['place-order-recaptcha']['skipPayments'] += [ - Config::METHOD_EXPRESS => true, - Config::METHOD_PAYFLOWPRO => true, - Config::METHOD_WPP_PE_EXPRESS => true, - Config::METHOD_WPP_PE_BML => true, - ]; + $skipCheckoutRecaptchaForPayments[Config::METHOD_PAYFLOWPRO] = true; } } else { if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] @@ -71,6 +69,11 @@ public function process($jsLayout) ['payment']['children']['payments-list']['children']['paypal-captcha']['children']['recaptcha']); } } + if ($this->isCaptchaEnabled->isCaptchaEnabledFor('place_order')) { + $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children'] + ['payment']['children']['payments-list']['children']['before-place-order']['children'] + ['place-order-recaptcha']['skipPayments'] += $skipCheckoutRecaptchaForPayments; + } return $jsLayout; } diff --git a/ReCaptchaPaypal/Model/ReCaptchaSession.php b/ReCaptchaPaypal/Model/ReCaptchaSession.php new file mode 100644 index 00000000..5fb4434d --- /dev/null +++ b/ReCaptchaPaypal/Model/ReCaptchaSession.php @@ -0,0 +1,93 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaPaypal\Model; + +use Magento\Framework\Session\SessionManager; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; + +/** + * Saves the date and time the reCaptcha was verified + * + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) + */ +class ReCaptchaSession +{ + private const PAYPAL_PAYFLOWPRO_RECAPTCHA = 'paypal_payflowpro_recaptcha'; + private const REPLAY_TIMEOUT = 120; + + /** + * @var TimezoneInterface + */ + private TimezoneInterface $timezone; + + /** + * @var SessionManager + */ + private SessionManager $transparentSession; + + /** + * @var SessionManager + */ + private SessionManager $checkoutSession; + + /** + * @param TimezoneInterface $timezone + * @param SessionManager $transparentSession + * @param SessionManager $checkoutSession + */ + public function __construct( + TimezoneInterface $timezone, + SessionManager $transparentSession, + SessionManager $checkoutSession, + ) { + $this->timezone = $timezone; + $this->transparentSession = $transparentSession; + $this->checkoutSession = $checkoutSession; + } + + /** + * Saves quote_id and datetime the reCaptcha was verified + * + * @return bool + */ + public function save(): bool + { + $result = false; + if ($this->checkoutSession->getQuote()) { + $this->transparentSession->setData( + self::PAYPAL_PAYFLOWPRO_RECAPTCHA, + [ + 'quote_id' => $this->checkoutSession->getQuote()->getId(), + 'verified_at' => $this->timezone->date()->getTimestamp(), + ] + ); + $result = true; + } + return $result; + } + + /** + * Checks whether the reCaptcha extended time has not expired + * + * @param int $quoteId + * @return bool + */ + public function isValid(int $quoteId): bool + { + $result = false; + $data = $this->transparentSession->getData(self::PAYPAL_PAYFLOWPRO_RECAPTCHA) ?? []; + if (isset($data['quote_id']) + && (int) $data['quote_id'] === $quoteId + && ($data['verified_at'] + self::REPLAY_TIMEOUT) >= $this->timezone->date()->getTimestamp() + ) { + $this->transparentSession->unsetData(self::PAYPAL_PAYFLOWPRO_RECAPTCHA); + $result = true; + } + return $result; + } +} diff --git a/ReCaptchaPaypal/Observer/PayPalObserver.php b/ReCaptchaPaypal/Observer/PayPalObserver.php index ec047819..75956b4b 100644 --- a/ReCaptchaPaypal/Observer/PayPalObserver.php +++ b/ReCaptchaPaypal/Observer/PayPalObserver.php @@ -16,6 +16,7 @@ use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Serialize\SerializerInterface; +use Magento\ReCaptchaPaypal\Model\ReCaptchaSession; use Magento\ReCaptchaUi\Model\CaptchaResponseResolverInterface; use Magento\ReCaptchaUi\Model\ErrorMessageConfigInterface; use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; @@ -76,6 +77,11 @@ class PayPalObserver implements ObserverInterface */ private $validationErrorMessagesProvider; + /** + * @var ReCaptchaSession + */ + private $reCaptchaSession; + /** * @param CaptchaResponseResolverInterface $captchaResponseResolver * @param ValidationConfigResolverInterface $validationConfigResolver @@ -86,6 +92,7 @@ class PayPalObserver implements ObserverInterface * @param LoggerInterface $logger * @param ErrorMessageConfigInterface|null $errorMessageConfig * @param ValidationErrorMessagesProvider|null $validationErrorMessagesProvider + * @param ReCaptchaSession|null $reCaptchaSession */ public function __construct( CaptchaResponseResolverInterface $captchaResponseResolver, @@ -96,7 +103,8 @@ public function __construct( IsCaptchaEnabledInterface $isCaptchaEnabled, LoggerInterface $logger, ?ErrorMessageConfigInterface $errorMessageConfig = null, - ?ValidationErrorMessagesProvider $validationErrorMessagesProvider = null + ?ValidationErrorMessagesProvider $validationErrorMessagesProvider = null, + ?ReCaptchaSession $reCaptchaSession = null ) { $this->captchaResponseResolver = $captchaResponseResolver; $this->validationConfigResolver = $validationConfigResolver; @@ -109,6 +117,8 @@ public function __construct( ?? ObjectManager::getInstance()->get(ErrorMessageConfigInterface::class); $this->validationErrorMessagesProvider = $validationErrorMessagesProvider ?? ObjectManager::getInstance()->get(ValidationErrorMessagesProvider::class); + $this->reCaptchaSession = $reCaptchaSession + ?? ObjectManager::getInstance()->get(ReCaptchaSession::class); } /** @@ -148,6 +158,9 @@ public function execute(Observer $observer): void $validationResult->getErrors(), $key ); + } elseif ($this->isCaptchaEnabled->isCaptchaEnabledFor('place_order')) { + // Extend reCaptcha verification to place order + $this->reCaptchaSession->save(); } } } diff --git a/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php similarity index 74% rename from ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php rename to ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php index 28cd5be0..400f450a 100644 --- a/ReCaptchaPaypal/Plugin/SkipPlaceOrderRecaptchaValidation.php +++ b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php @@ -10,11 +10,12 @@ use Magento\Framework\Webapi\Rest\Request; use Magento\Paypal\Model\Config; use Magento\ReCaptchaCheckout\Model\WebapiConfigProvider; +use Magento\ReCaptchaPaypal\Model\ReCaptchaSession; use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; use Magento\ReCaptchaWebapiApi\Api\Data\EndpointInterface; -class SkipPlaceOrderRecaptchaValidation +class ReplayPayflowReCaptchaForPlaceOrder { private const PAYPAL_PAYFLOWPRO_CAPTCHA_ID = 'paypal_payflowpro'; @@ -28,20 +29,28 @@ class SkipPlaceOrderRecaptchaValidation */ private Request $request; + /** + * @var ReCaptchaSession + */ + private ReCaptchaSession $reCaptchaSession; + /** * @param IsCaptchaEnabledInterface $isCaptchaEnabled * @param Request $request + * @param ReCaptchaSession $reCaptchaSession */ public function __construct( IsCaptchaEnabledInterface $isCaptchaEnabled, - Request $request + Request $request, + ReCaptchaSession $reCaptchaSession ) { $this->isCaptchaEnabled = $isCaptchaEnabled; $this->request = $request; + $this->reCaptchaSession = $reCaptchaSession; } /** - * Skip captcha validation for "place order" button if captcha is enabled for payflowpro + * Skip reCaptcha validation for "place order" button if captcha is enabled for payflowpro * * @param WebapiConfigProvider $subject * @param ValidationConfigInterface $result @@ -58,8 +67,11 @@ public function afterGetConfigFor( if ($result && $this->isCaptchaEnabled->isCaptchaEnabledFor(self::PAYPAL_PAYFLOWPRO_CAPTCHA_ID)) { $bodyParams = $this->request->getBodyParams(); $paymentMethod = $bodyParams['paymentMethod'] ?? $bodyParams['payment_method'] ?? []; + $cartId = $bodyParams['cartId'] ?? $bodyParams['cart_id'] ?? null; if (isset($paymentMethod['method']) && $paymentMethod['method'] === Config::METHOD_PAYFLOWPRO) { - return null; + if ($cartId && $this->reCaptchaSession->isValid((int) $cartId)) { + return null; + } } } diff --git a/ReCaptchaPaypal/etc/frontend/di.xml b/ReCaptchaPaypal/etc/frontend/di.xml index d63b8637..ed60ff78 100644 --- a/ReCaptchaPaypal/etc/frontend/di.xml +++ b/ReCaptchaPaypal/etc/frontend/di.xml @@ -21,4 +21,10 @@ </argument> </arguments> </type> + <type name="Magento\ReCaptchaPaypal\Model\ReCaptchaSession"> + <arguments> + <argument name="transparentSession" xsi:type="object">Magento\Framework\Session\Generic\Proxy</argument> + <argument name="checkoutSession" xsi:type="object">Magento\Checkout\Model\Session\Proxy</argument> + </arguments> + </type> </config> diff --git a/ReCaptchaPaypal/etc/webapi_rest/di.xml b/ReCaptchaPaypal/etc/webapi_rest/di.xml index d01d6fb5..67b665f2 100644 --- a/ReCaptchaPaypal/etc/webapi_rest/di.xml +++ b/ReCaptchaPaypal/etc/webapi_rest/di.xml @@ -8,6 +8,6 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaCheckout\Model\WebapiConfigProvider"> - <plugin name="skip_place_order_recaptcha_validation" type="Magento\ReCaptchaPaypal\Plugin\SkipPlaceOrderRecaptchaValidation"/> + <plugin name="skip_place_order_recaptcha_validation" type="Magento\ReCaptchaPaypal\Plugin\ReplayPayflowReCaptchaForPlaceOrder"/> </type> </config> From 30df77120bdbf9de55472958fc93ae829dc955e1 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 21 Nov 2022 09:17:34 -0600 Subject: [PATCH 054/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../view/frontend/web/js/reCaptchaCheckout.js | 14 ++++++++------ ReCaptchaPaypal/Model/ReCaptchaSession.php | 8 ++++---- .../Plugin/ReplayPayflowReCaptchaForPlaceOrder.php | 10 ++++++---- 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js index 0598448a..1b8007cd 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -18,7 +18,7 @@ define( }, /** - * Render reCAPTCHA + * Render reCAPTCHA for payment method * * @param {Object} method */ @@ -32,7 +32,7 @@ define( }, /** - * Get reCAPTCHA ID + * Get reCAPTCHA ID for payment method * * @param {Object} method * @returns {String} @@ -55,12 +55,14 @@ define( * @inheritdoc */ initCaptcha: function () { - var $wrapper, $recaptchaResponseInput; + var $wrapper, + $recaptchaResponseInput; this._super(); - // Since there will be multiple recaptcha in the payment form, - // they may override each other if the form is submitted. - // The recaptcha response will be collected in the callback: reCaptchaCallback() + // Since there will be multiple reCaptcha in the payment form, + // they may override each other if the form data is serialized and submitted. + // Instead, the reCaptcha response will be collected in the callback: reCaptchaCallback() + // and sent in the request header X-ReCaptcha $wrapper = $('#' + this.getReCaptchaId() + '-wrapper'); $recaptchaResponseInput = $wrapper.find('[name=g-recaptcha-response]'); if ($recaptchaResponseInput.length) { diff --git a/ReCaptchaPaypal/Model/ReCaptchaSession.php b/ReCaptchaPaypal/Model/ReCaptchaSession.php index 5fb4434d..2e805236 100644 --- a/ReCaptchaPaypal/Model/ReCaptchaSession.php +++ b/ReCaptchaPaypal/Model/ReCaptchaSession.php @@ -18,7 +18,7 @@ class ReCaptchaSession { private const PAYPAL_PAYFLOWPRO_RECAPTCHA = 'paypal_payflowpro_recaptcha'; - private const REPLAY_TIMEOUT = 120; + private const TIMEOUT = 120; /** * @var TimezoneInterface @@ -51,7 +51,7 @@ public function __construct( } /** - * Saves quote_id and datetime the reCaptcha was verified + * Saves quote_id and datetime the reCaptcha was verified in session * * @return bool */ @@ -72,7 +72,7 @@ public function save(): bool } /** - * Checks whether the reCaptcha extended time has not expired + * Checks whether the time since reCaptcha was verified is not more than the timeout * * @param int $quoteId * @return bool @@ -83,7 +83,7 @@ public function isValid(int $quoteId): bool $data = $this->transparentSession->getData(self::PAYPAL_PAYFLOWPRO_RECAPTCHA) ?? []; if (isset($data['quote_id']) && (int) $data['quote_id'] === $quoteId - && ($data['verified_at'] + self::REPLAY_TIMEOUT) >= $this->timezone->date()->getTimestamp() + && ($data['verified_at'] + self::TIMEOUT) >= $this->timezone->date()->getTimestamp() ) { $this->transparentSession->unsetData(self::PAYPAL_PAYFLOWPRO_RECAPTCHA); $result = true; diff --git a/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php index 400f450a..35849d79 100644 --- a/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php +++ b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php @@ -68,10 +68,12 @@ public function afterGetConfigFor( $bodyParams = $this->request->getBodyParams(); $paymentMethod = $bodyParams['paymentMethod'] ?? $bodyParams['payment_method'] ?? []; $cartId = $bodyParams['cartId'] ?? $bodyParams['cart_id'] ?? null; - if (isset($paymentMethod['method']) && $paymentMethod['method'] === Config::METHOD_PAYFLOWPRO) { - if ($cartId && $this->reCaptchaSession->isValid((int) $cartId)) { - return null; - } + if (isset($paymentMethod['method']) + && $paymentMethod['method'] === Config::METHOD_PAYFLOWPRO + && $cartId + && $this->reCaptchaSession->isValid((int) $cartId) + ) { + return null; } } From 618900f512f1e5fc9f165bc0e323f0ec5f28a05b Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 21 Nov 2022 10:05:21 -0600 Subject: [PATCH 055/208] ACP2E-1338: Google reCaptcha in Incorrect position --- ReCaptchaPaypal/Observer/PayPalObserver.php | 1 + 1 file changed, 1 insertion(+) diff --git a/ReCaptchaPaypal/Observer/PayPalObserver.php b/ReCaptchaPaypal/Observer/PayPalObserver.php index 75956b4b..ba4e0e25 100644 --- a/ReCaptchaPaypal/Observer/PayPalObserver.php +++ b/ReCaptchaPaypal/Observer/PayPalObserver.php @@ -93,6 +93,7 @@ class PayPalObserver implements ObserverInterface * @param ErrorMessageConfigInterface|null $errorMessageConfig * @param ValidationErrorMessagesProvider|null $validationErrorMessagesProvider * @param ReCaptchaSession|null $reCaptchaSession + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( CaptchaResponseResolverInterface $captchaResponseResolver, From 9b65c30a2b417a5321d7a31697c622ea3cfcaf71 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 21 Nov 2022 11:51:45 -0600 Subject: [PATCH 056/208] ACP2E-1338: Google reCaptcha in Incorrect position --- ReCaptchaPaypal/etc/di.xml | 6 ++++++ ReCaptchaPaypal/etc/frontend/di.xml | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ReCaptchaPaypal/etc/di.xml b/ReCaptchaPaypal/etc/di.xml index 44caf936..d52a6d06 100644 --- a/ReCaptchaPaypal/etc/di.xml +++ b/ReCaptchaPaypal/etc/di.xml @@ -14,4 +14,10 @@ </argument> </arguments> </type> + <type name="Magento\ReCaptchaPaypal\Model\ReCaptchaSession"> + <arguments> + <argument name="transparentSession" xsi:type="object">Magento\Framework\Session\Generic\Proxy</argument> + <argument name="checkoutSession" xsi:type="object">Magento\Checkout\Model\Session\Proxy</argument> + </arguments> + </type> </config> diff --git a/ReCaptchaPaypal/etc/frontend/di.xml b/ReCaptchaPaypal/etc/frontend/di.xml index ed60ff78..d63b8637 100644 --- a/ReCaptchaPaypal/etc/frontend/di.xml +++ b/ReCaptchaPaypal/etc/frontend/di.xml @@ -21,10 +21,4 @@ </argument> </arguments> </type> - <type name="Magento\ReCaptchaPaypal\Model\ReCaptchaSession"> - <arguments> - <argument name="transparentSession" xsi:type="object">Magento\Framework\Session\Generic\Proxy</argument> - <argument name="checkoutSession" xsi:type="object">Magento\Checkout\Model\Session\Proxy</argument> - </arguments> - </type> </config> From 0e537a52876fcf76e5f049f060ee94e7ff3eb314 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 21 Nov 2022 13:12:48 -0600 Subject: [PATCH 057/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../ReplayPayflowReCaptchaForPlaceOrder.php | 20 ++++++++++++++++--- ReCaptchaPaypal/composer.json | 1 + 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php index 35849d79..d648246d 100644 --- a/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php +++ b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php @@ -9,6 +9,7 @@ use Magento\Framework\Webapi\Rest\Request; use Magento\Paypal\Model\Config; +use Magento\Quote\Model\QuoteIdMaskFactory; use Magento\ReCaptchaCheckout\Model\WebapiConfigProvider; use Magento\ReCaptchaPaypal\Model\ReCaptchaSession; use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; @@ -34,19 +35,27 @@ class ReplayPayflowReCaptchaForPlaceOrder */ private ReCaptchaSession $reCaptchaSession; + /** + * @var QuoteIdMaskFactory + */ + private QuoteIdMaskFactory $quoteIdMaskFactory; + /** * @param IsCaptchaEnabledInterface $isCaptchaEnabled * @param Request $request * @param ReCaptchaSession $reCaptchaSession + * @param QuoteIdMaskFactory $quoteIdMaskFactory */ public function __construct( IsCaptchaEnabledInterface $isCaptchaEnabled, Request $request, - ReCaptchaSession $reCaptchaSession + ReCaptchaSession $reCaptchaSession, + QuoteIdMaskFactory $quoteIdMaskFactory ) { $this->isCaptchaEnabled = $isCaptchaEnabled; $this->request = $request; $this->reCaptchaSession = $reCaptchaSession; + $this->quoteIdMaskFactory = $quoteIdMaskFactory; } /** @@ -71,9 +80,14 @@ public function afterGetConfigFor( if (isset($paymentMethod['method']) && $paymentMethod['method'] === Config::METHOD_PAYFLOWPRO && $cartId - && $this->reCaptchaSession->isValid((int) $cartId) ) { - return null; + // check if it is guest cart, then resolve cart id by mask ID + if (!is_numeric($cartId)) { + $cartId = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id')->getQuoteId(); + } + if ($this->reCaptchaSession->isValid((int) $cartId)) { + return null; + } } } diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index a5f1a745..0410e45c 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -8,6 +8,7 @@ "magento/module-re-captcha-validation-api": "*", "magento/module-checkout": "*", "magento/module-re-captcha-webapi-api": "*", + "magento/module-quote": "*", "magento/module-paypal": "*", "magento/module-re-captcha-checkout": "*" }, From 584a4928e7ace08b3ade7369bc83ab632dd1b6b0 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Tue, 22 Nov 2022 07:38:43 -0600 Subject: [PATCH 058/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../frontend/web/js/model/place-order-mixin.js | 15 ++++++++------- .../view/frontend/web/js/reCaptchaCheckout.js | 8 +++++++- .../view/frontend/web/template/reCaptcha.html | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 2cd102bd..d78b2e3d 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -4,23 +4,24 @@ */ /* eslint-disable max-nested-callbacks */ -/* eslint-disable max-depth */ define([ 'jquery', 'mage/utils/wrapper', - 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry', - 'Magento_Checkout/js/model/quote' -], function ($, wrapper, recaptchaRegistry, quote) { + 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' +], function ($, wrapper, recaptchaRegistry) { 'use strict'; return function (placeOrder) { return wrapper.wrap(placeOrder, function (originalAction, serviceUrl, payload, messageContainer) { var recaptchaDeferred, - reCaptchaId; + reCaptchaId, + $activeReCaptcha; - if (quote.paymentMethod()) { - reCaptchaId = 'recaptcha-checkout-place-order-' + quote.paymentMethod().method; + $activeReCaptcha = $('.recaptcha-checkout-place-order:visible .g-recaptcha'); + + if ($activeReCaptcha.length > 0) { + reCaptchaId = $activeReCaptcha.last().attr('id'); } if (reCaptchaId !== undefined && recaptchaRegistry.triggers.hasOwnProperty(reCaptchaId)) { diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js index 1b8007cd..cbc51637 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -11,6 +11,9 @@ define( function (Component, $) { 'use strict'; + var reCaptchaIds = new WeakMap(), + uuid = 0; + return Component.extend({ defaults: { template: 'Magento_ReCaptchaCheckout/reCaptcha', @@ -38,7 +41,10 @@ define( * @returns {String} */ getReCaptchaIdFor: function (method) { - return this.getReCaptchaId() + '-' + method.getCode(); + if (!reCaptchaIds.has(method)) { + reCaptchaIds.set(method, this.getReCaptchaId() + '-' + uuid++); + } + return reCaptchaIds.get(method); }, /** diff --git a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html index 4b0cc558..9ea1c08c 100644 --- a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html @@ -5,7 +5,7 @@ */ --> <!-- ko if: (isCheckoutReCaptchaRequiredFor($parents[1]))--> -<div data-bind="{ +<div class="recaptcha-checkout-place-order" data-bind="{ attr: { 'id': getReCaptchaIdFor($parents[1]) + '-wrapper' }, From 220533a741605a8b1557d0e08ba4f89db452553f Mon Sep 17 00:00:00 2001 From: Anna Bukatar <abukatar@magento.com> Date: Tue, 29 Nov 2022 16:12:13 -0800 Subject: [PATCH 059/208] ACP2E-1311: Magento forms can be submitted before the Google Recaptcha appears in the form --- ReCaptchaContact/etc/frontend/di.xml | 25 ++++++++ .../Customer/DisableCreateAccountButton.php | 46 -------------- .../Customer/DisableForgotPasswordButton.php | 46 -------------- .../Plugin/Customer/DisableLoginButton.php | 47 -------------- .../DisableCreateAccountButtonTest.php | 55 ----------------- .../DisableForgotPasswordButtonTest.php | 55 ----------------- .../Customer/DisableLoginButtonTest.php | 61 ------------------- ReCaptchaCustomer/etc/frontend/di.xml | 44 +++++++++---- .../view/frontend/web/js/reCaptcha.js | 6 +- ReCaptchaNewsletter/etc/frontend/di.xml | 24 ++++++++ ReCaptchaReview/etc/frontend/di.xml | 24 ++++++++ ReCaptchaSendFriend/etc/frontend/di.xml | 24 ++++++++ ReCaptchaUi/Model/ButtonLock.php | 59 ++++++++++++++++++ 13 files changed, 194 insertions(+), 322 deletions(-) create mode 100644 ReCaptchaContact/etc/frontend/di.xml delete mode 100644 ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php delete mode 100644 ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php delete mode 100644 ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php delete mode 100644 ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php delete mode 100644 ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php delete mode 100644 ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php create mode 100644 ReCaptchaNewsletter/etc/frontend/di.xml create mode 100644 ReCaptchaReview/etc/frontend/di.xml create mode 100644 ReCaptchaSendFriend/etc/frontend/di.xml create mode 100644 ReCaptchaUi/Model/ButtonLock.php diff --git a/ReCaptchaContact/etc/frontend/di.xml b/ReCaptchaContact/etc/frontend/di.xml new file mode 100644 index 00000000..ee228c25 --- /dev/null +++ b/ReCaptchaContact/etc/frontend/di.xml @@ -0,0 +1,25 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + + <type name="Magento\Framework\View\Element\ButtonLockManager"> + <arguments> + <argument name="buttonLockPool" xsi:type="array"> + <item name="contact_us_form_submit" xsi:type="object">Magento\ReCaptchaContact\Model\ButtonLock\ContactUsFormSubmit</item> + </argument> + </arguments> + </type> + + <virtualType name="Magento\ReCaptchaContact\Model\ButtonLock\ContactUsFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">contact_us_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">contact</argument> + </arguments> + </virtualType> +</config> diff --git a/ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php b/ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php deleted file mode 100644 index ea6e3ebc..00000000 --- a/ReCaptchaCustomer/Plugin/Customer/DisableCreateAccountButton.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\ReCaptchaCustomer\Plugin\Customer; - -use Magento\Framework\Exception\InputException; -use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; -use Magento\Customer\ViewModel\CreateAccountButton; - -/** - * Disable button Create Account while captcha is loading - */ -class DisableCreateAccountButton -{ - /** - * @var IsCaptchaEnabledInterface - */ - private $isCaptchaEnabled; - - /** - * @param IsCaptchaEnabledInterface $isCaptchaEnabled - */ - public function __construct( - IsCaptchaEnabledInterface $isCaptchaEnabled - ) { - $this->isCaptchaEnabled = $isCaptchaEnabled; - } - - /** - * Temporally disable button Create Account while captcha is loading - * - * @param CreateAccountButton $subject - * @return bool - * @throws InputException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function afterDisabled(CreateAccountButton $subject): bool - { - $key = 'customer_create'; - return $this->isCaptchaEnabled->isCaptchaEnabledFor($key); - } -} diff --git a/ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php b/ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php deleted file mode 100644 index 6c3d7df6..00000000 --- a/ReCaptchaCustomer/Plugin/Customer/DisableForgotPasswordButton.php +++ /dev/null @@ -1,46 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\ReCaptchaCustomer\Plugin\Customer; - -use Magento\Framework\Exception\InputException; -use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; -use Magento\Customer\ViewModel\ForgotPasswordButton; - -/** - * Disable Forgot password button while captcha is loading - */ -class DisableForgotPasswordButton -{ - /** - * @var IsCaptchaEnabledInterface - */ - private $isCaptchaEnabled; - - /** - * @param IsCaptchaEnabledInterface $isCaptchaEnabled - */ - public function __construct( - IsCaptchaEnabledInterface $isCaptchaEnabled - ) { - $this->isCaptchaEnabled = $isCaptchaEnabled; - } - - /** - * Temporally disable Forgot password button while captcha is loading - * - * @param ForgotPasswordButton $subject - * @return bool - * @throws InputException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function afterDisabled(ForgotPasswordButton $subject): bool - { - $key = 'customer_forgot_password'; - return $this->isCaptchaEnabled->isCaptchaEnabledFor($key); - } -} diff --git a/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php b/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php deleted file mode 100644 index b0713fa3..00000000 --- a/ReCaptchaCustomer/Plugin/Customer/DisableLoginButton.php +++ /dev/null @@ -1,47 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\ReCaptchaCustomer\Plugin\Customer; - -use Magento\Framework\Exception\InputException; -use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; -use Magento\ReCaptchaUi\Model\UiConfigResolverInterface; -use Magento\Customer\ViewModel\LoginButton; - -/** - * Disable Login button while captcha is loading - */ -class DisableLoginButton -{ - /** - * @var IsCaptchaEnabledInterface - */ - private $isCaptchaEnabled; - - /** - * @param IsCaptchaEnabledInterface $isCaptchaEnabled - */ - public function __construct( - IsCaptchaEnabledInterface $isCaptchaEnabled - ) { - $this->isCaptchaEnabled = $isCaptchaEnabled; - } - - /** - * Temporally disable Login button while captcha is loading - * - * @param LoginButton $subject - * @return bool - * @throws InputException - * @SuppressWarnings(PHPMD.UnusedFormalParameter) - */ - public function afterDisabled(LoginButton $subject): bool - { - $key = 'customer_login'; - return $this->isCaptchaEnabled->isCaptchaEnabledFor($key); - } -} diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php deleted file mode 100644 index bc4b4239..00000000 --- a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableCreateAccountButtonTest.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\ReCaptchaCustomer\Test\Unit\Plugin\Customer; - -use Magento\Customer\ViewModel\CreateAccountButton; -use Magento\ReCaptchaCustomer\Plugin\Customer\DisableCreateAccountButton; -use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; - -/** - * Test disable Login button while captcha is loading - */ -class DisableCreateAccountButtonTest extends TestCase -{ - /** - * @var IsCaptchaEnabledInterface|MockObject - */ - protected $isCaptchaEnabled; - - /** - * @var CreateAccountButton|MockObject - */ - protected $subject; - - /** - * @var DisableCreateAccountButton - */ - protected $plugin; - - protected function setUp(): void - { - $this->isCaptchaEnabled = $this->getMockForAbstractClass( - IsCaptchaEnabledInterface::class - ); - $this->subject = $this->createMock(CreateAccountButton::class); - - $this->plugin = new DisableCreateAccountButton( - $this->isCaptchaEnabled - ); - } - - public function testAfterEnabled() - { - $key = 'customer_create'; - $this->isCaptchaEnabled->expects($this->once()) - ->method('isCaptchaEnabledFor')->with($key)->willReturn(true); - $this->assertEquals(true, $this->plugin->afterDisabled($this->subject)); - } -} diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php deleted file mode 100644 index 489a5136..00000000 --- a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableForgotPasswordButtonTest.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\ReCaptchaCustomer\Test\Unit\Plugin\Customer; - -use Magento\Customer\ViewModel\ForgotPasswordButton; -use Magento\ReCaptchaCustomer\Plugin\Customer\DisableForgotPasswordButton; -use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; - -/** - * Test disable Forgot password button while captcha is loading - */ -class DisableForgotPasswordButtonTest extends TestCase -{ - /** - * @var IsCaptchaEnabledInterface|MockObject - */ - protected $isCaptchaEnabled; - - /** - * @var ForgotPasswordButton|MockObject - */ - protected $subject; - - /** - * @var DisableForgotPasswordButton - */ - protected $plugin; - - protected function setUp(): void - { - $this->isCaptchaEnabled = $this->getMockForAbstractClass( - IsCaptchaEnabledInterface::class - ); - $this->subject = $this->createMock(ForgotPasswordButton::class); - - $this->plugin = new DisableForgotPasswordButton( - $this->isCaptchaEnabled - ); - } - - public function testAfterEnabled() - { - $key = 'customer_forgot_password'; - $this->isCaptchaEnabled->expects($this->once()) - ->method('isCaptchaEnabledFor')->with($key)->willReturn(true); - $this->assertEquals(true, $this->plugin->afterDisabled($this->subject)); - } -} diff --git a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php b/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php deleted file mode 100644 index 3ef369b5..00000000 --- a/ReCaptchaCustomer/Test/Unit/Plugin/Customer/DisableLoginButtonTest.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\ReCaptchaCustomer\Test\Unit\Plugin\Customer; - -use Magento\Customer\ViewModel\LoginButton; -use Magento\ReCaptchaCustomer\Plugin\Customer\DisableLoginButton; -use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; -use PHPUnit\Framework\MockObject\MockObject; -use PHPUnit\Framework\TestCase; - -/** - * Test disable Login button while captcha is loading - */ -class DisableLoginButtonTest extends TestCase -{ - /** - * IsCaptcha Enabled mock - * - * @var IsCaptchaEnabledInterface|MockObject - */ - protected $isCaptchaEnabled; - - /** - * Subject LoginButton - * - * @var LoginButton|MockObject - */ - protected $subject; - - /** - * Tested plugin - * - * @var DisableLoginButtonTest - */ - protected $plugin; - - protected function setUp(): void - { - $this->isCaptchaEnabled = $this->getMockForAbstractClass( - IsCaptchaEnabledInterface::class - ); - $this->subject = $this->createMock(LoginButton::class); - - $this->plugin = new DisableLoginButton( - $this->isCaptchaEnabled - ); - } - - public function testAfterEnabled() - { - $key = 'customer_login'; - $this->isCaptchaEnabled->expects($this->once()) - ->method('isCaptchaEnabledFor')->with($key)->willReturn(true); - $this->assertEquals(true, $this->plugin->afterDisabled($this->subject)); - } -} diff --git a/ReCaptchaCustomer/etc/frontend/di.xml b/ReCaptchaCustomer/etc/frontend/di.xml index 73640968..e32489da 100644 --- a/ReCaptchaCustomer/etc/frontend/di.xml +++ b/ReCaptchaCustomer/etc/frontend/di.xml @@ -20,16 +20,38 @@ <plugin sortOrder="1" name="inject_recaptcha_in_authentication_popup" type="Magento\ReCaptchaCustomer\Plugin\Block\Account\InjectRecaptchaInAuthenticationPopup"/> </type> - <type name="Magento\Customer\ViewModel\LoginButton"> - <plugin sortOrder="1" name="recaptcha_disable_login_button" - type="Magento\ReCaptchaCustomer\Plugin\Customer\DisableLoginButton"/> - </type> - <type name="Magento\Customer\ViewModel\CreateAccountButton"> - <plugin sortOrder="1" name="recaptcha_disable_create_account_button" - type="Magento\ReCaptchaCustomer\Plugin\Customer\DisableCreateAccountButton"/> - </type> - <type name="Magento\Customer\ViewModel\ForgotPasswordButton"> - <plugin sortOrder="1" name="recaptcha_disable_forgot_password_button" - type="Magento\ReCaptchaCustomer\Plugin\Customer\DisableForgotPasswordButton"/> + <type name="Magento\Framework\View\Element\ButtonLockManager"> + <arguments> + <argument name="buttonLockPool" xsi:type="array"> + <item name="customer_create_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerCreateFormSubmit</item> + <item name="customer_edit_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerEditFormSubmit</item> + <item name="customer_forgot_password_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerForgotPasswordFormSubmit</item> + <item name="customer_login_form_submit" xsi:type="object">Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerLoginFormSubmit</item> + </argument> + </arguments> </type> + <virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerCreateFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">customer_create_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">customer_create</argument> + </arguments> + </virtualType> + <virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerEditFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">customer_edit_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">customer_edit</argument> + </arguments> + </virtualType> + <virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerForgotPasswordFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">customer_forgot_password_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">customer_forgot_password</argument> + </arguments> + </virtualType> + <virtualType name="Magento\ReCaptchaCustomer\Model\ButtonLock\CustomerLoginFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">customer_login_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">customer_login</argument> + </arguments> + </virtualType> </config> diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index 14f2af32..43c476ec 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -174,7 +174,11 @@ define( } else { this.tokenField = null; } - if ($('#send2').length > 0) {$('#send2').prop('disabled', false);} + let submitButton = parentForm.find('button:not([type]), [type=submit]'); + + if (submitButton.length) { + submitButton.prop('disabled', false); + } }, /** diff --git a/ReCaptchaNewsletter/etc/frontend/di.xml b/ReCaptchaNewsletter/etc/frontend/di.xml new file mode 100644 index 00000000..4622e4c3 --- /dev/null +++ b/ReCaptchaNewsletter/etc/frontend/di.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + + <type name="Magento\Framework\View\Element\ButtonLockManager"> + <arguments> + <argument name="buttonLockPool" xsi:type="array"> + <item name="newsletter_form_submit" xsi:type="object">Magento\ReCaptchaNewsletter\Model\ButtonLock\NewsletterFormSubmit</item> + </argument> + </arguments> + </type> + <virtualType name="Magento\ReCaptchaNewsletter\Model\ButtonLock\NewsletterFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">newsletter_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">newsletter</argument> + </arguments> + </virtualType> +</config> diff --git a/ReCaptchaReview/etc/frontend/di.xml b/ReCaptchaReview/etc/frontend/di.xml new file mode 100644 index 00000000..509158d4 --- /dev/null +++ b/ReCaptchaReview/etc/frontend/di.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + + <type name="Magento\Framework\View\Element\ButtonLockManager"> + <arguments> + <argument name="buttonLockPool" xsi:type="array"> + <item name="review_form_submit" xsi:type="object">Magento\ReCaptchaReview\Model\ButtonLock\ReviewFormSubmit</item> + </argument> + </arguments> + </type> + <virtualType name="Magento\ReCaptchaReview\Model\ButtonLock\ReviewFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">review_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">product_review</argument> + </arguments> + </virtualType> +</config> diff --git a/ReCaptchaSendFriend/etc/frontend/di.xml b/ReCaptchaSendFriend/etc/frontend/di.xml new file mode 100644 index 00000000..b48b3cb7 --- /dev/null +++ b/ReCaptchaSendFriend/etc/frontend/di.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + + <type name="Magento\Framework\View\Element\ButtonLockManager"> + <arguments> + <argument name="buttonLockPool" xsi:type="array"> + <item name="sendfriend_form_submit" xsi:type="object">Magento\ReCaptchaSendFriend\Model\ButtonLock\SendFriendFormSubmit</item> + </argument> + </arguments> + </type> + <virtualType name="Magento\ReCaptchaSendFriend\Model\ButtonLock\SendFriendFormSubmit" type="Magento\ReCaptchaUi\Model\ButtonLock"> + <arguments> + <argument name="buttonCode" xsi:type="string">sendfriend_form_submit</argument> + <argument name="reCaptchaId" xsi:type="string">sendfriend</argument> + </arguments> + </virtualType> +</config> diff --git a/ReCaptchaUi/Model/ButtonLock.php b/ReCaptchaUi/Model/ButtonLock.php new file mode 100644 index 00000000..8b349ee5 --- /dev/null +++ b/ReCaptchaUi/Model/ButtonLock.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaUi\Model; + +use Magento\Framework\View\Element\ButtonLockInterface; + +class ButtonLock implements ButtonLockInterface +{ + /** + * @var string + */ + private $reCaptchaId; + + /** + * @var string + */ + private $buttonCode; + + /** + * @var IsCaptchaEnabledInterface + */ + private $isCaptchaEnabled; + + /** + * @param IsCaptchaEnabledInterface $isCaptchaEnabled + * @param string $reCaptchaId + * @param string $buttonCode + */ + public function __construct( + IsCaptchaEnabledInterface $isCaptchaEnabled, + string $reCaptchaId, + string $buttonCode + ) { + $this->isCaptchaEnabled = $isCaptchaEnabled; + $this->reCaptchaId = $reCaptchaId; + $this->buttonCode = $buttonCode; + } + + /** + * @inheritDoc + */ + public function getCode(): string + { + return $this->buttonCode; + } + + /** + * @inheritDoc + */ + public function isDisabled(): bool + { + return $this->isCaptchaEnabled->isCaptchaEnabledFor($this->reCaptchaId); + } +} From cb41adc5cf434957c8b6c4f68d0685fcd801f02b Mon Sep 17 00:00:00 2001 From: Rimple Saini <glo62131@adobe.com> Date: Thu, 8 Dec 2022 22:15:53 +0530 Subject: [PATCH 060/208] CABPI-540::Remove hard dependency from security-package(TwoFactorAuth module) to AdminAdobeIms module for 2.4.6 - Removed IMS Module dependency --- .../Observer/ControllerActionPredispatch.php | 14 +------------- TwoFactorAuth/composer.json | 1 - 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/TwoFactorAuth/Observer/ControllerActionPredispatch.php b/TwoFactorAuth/Observer/ControllerActionPredispatch.php index d27d84d2..5028abd6 100644 --- a/TwoFactorAuth/Observer/ControllerActionPredispatch.php +++ b/TwoFactorAuth/Observer/ControllerActionPredispatch.php @@ -22,7 +22,6 @@ use Magento\TwoFactorAuth\Api\UserConfigRequestManagerInterface; use Magento\TwoFactorAuth\Controller\Adminhtml\Tfa\Requestconfig; use Magento\TwoFactorAuth\Model\UserConfig\HtmlAreaTokenVerifier; -use Magento\AdminAdobeIms\Service\ImsConfig; /** * Handle redirection to 2FA page if required @@ -76,11 +75,6 @@ class ControllerActionPredispatch implements ObserverInterface */ private $userContext; - /** - * @var ImsConfig - */ - private ImsConfig $adminAdobeImsConfig; - /** * @param TfaInterface $tfa * @param TfaSessionInterface $tfaSession @@ -90,7 +84,6 @@ class ControllerActionPredispatch implements ObserverInterface * @param UrlInterface $url * @param AuthorizationInterface $authorization * @param UserContextInterface $userContext - * @param ImsConfig $adminAdobeImsConfig */ public function __construct( TfaInterface $tfa, @@ -100,8 +93,7 @@ public function __construct( ActionFlag $actionFlag, UrlInterface $url, AuthorizationInterface $authorization, - UserContextInterface $userContext, - ImsConfig $adminAdobeImsConfig + UserContextInterface $userContext ) { $this->tfa = $tfa; $this->tfaSession = $tfaSession; @@ -111,7 +103,6 @@ public function __construct( $this->url = $url; $this->authorization = $authorization; $this->userContext = $userContext; - $this->adminAdobeImsConfig = $adminAdobeImsConfig; } /** @@ -132,9 +123,6 @@ private function redirect(string $url): void */ public function execute(Observer $observer) { - if ($this->adminAdobeImsConfig->enabled()) { - return; - } /** @var $controllerAction AbstractAction */ $controllerAction = $observer->getEvent()->getData('controller_action'); $this->action = $controllerAction; diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index e89c6b96..42b7339a 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -12,7 +12,6 @@ "magento/module-ui": "*", "magento/module-user": "*", "magento/module-integration": "*", - "magento/module-admin-adobe-ims": "*", "christian-riesen/base32": "^1.3", "spomky-labs/otphp": "^10.0", "endroid/qr-code": "^4.3.5", From 3798cb1c33ac4bb863b2efe234d4bdd3ace5d721 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Thu, 8 Dec 2022 17:12:54 -0600 Subject: [PATCH 061/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../LayoutProcessor/Checkout/OnepageTest.php | 167 ++++++++++++++ .../LayoutProcessor/Checkout/OnepageTest.php | 209 ++++++++++++++++++ 2 files changed, 376 insertions(+) create mode 100644 ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php create mode 100644 ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php diff --git a/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php new file mode 100644 index 00000000..8cf57413 --- /dev/null +++ b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -0,0 +1,167 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaCheckout\Test\Unit\Block\LayoutProcessor\Checkout; + +use Magento\Framework\DataObject; +use Magento\ReCaptchaCheckout\Block\LayoutProcessor\Checkout\Onepage; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaUi\Model\UiConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class OnepageTest extends TestCase +{ + /** + * @var UiConfigResolverInterface|MockObject + */ + private $uiConfigResolver; + + /** + * @var IsCaptchaEnabledInterface|MockObject + */ + private $isCaptchEnabled; + + /** + * @var Onepage + */ + private $model; + + /** + * @var array + */ + private $jsLayout = [ + 'components' => [ + 'checkout' => [ + 'children' => [ + 'steps' => [ + 'children' => [ + 'shipping-step' => [ + 'children' => [ + 'shippingAddress' => [ + 'children' => [ + 'customer-email' => [ + 'children' => [ + 'recaptcha' => [] + ] + ] + ] + ] + ] + ], + 'billing-step' => [ + 'children' => [ + 'payment' => [ + 'children' => [ + 'customer-email' => [ + 'children' => [ + 'recaptcha' => [] + ] + ], + 'payments-list' => [ + 'children' => [ + 'before-place-order' => [ + 'children' => [ + 'place-order-recaptcha' => [] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ], + 'authentication' => [ + 'children' => [ + 'recaptcha' => [] + ] + ] + ] + ] + ] + ]; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + $this->uiConfigResolver = $this->getMockForAbstractClass(UiConfigResolverInterface::class); + $this->isCaptchEnabled = $this->getMockForAbstractClass(IsCaptchaEnabledInterface::class); + $this->model = new Onepage( + $this->uiConfigResolver, + $this->isCaptchEnabled + ); + } + + /** + * @dataProvider processDataProvider + */ + public function testProcess(array $mocks, array $expected): void + { + $this->uiConfigResolver->method('get') + ->willReturnMap($mocks['uiConfigResolver']); + $this->isCaptchEnabled->method('isCaptchaEnabledFor') + ->willReturnMap($mocks['isCaptchaEnabled']); + $prefix = 'components/checkout/children/'; + $config = new DataObject($this->model->process($this->jsLayout)); + $actual = []; + foreach (array_keys($expected) as $path) { + $actual[$path] = $config->getDataByPath($prefix.$path); + } + $this->assertSame($expected, $actual); + } + + public function processDataProvider(): array + { + return [ + [ + [ + 'isCaptchaEnabled' => [ + ['customer_login', false], + ['place_order', false], + ], + 'uiConfigResolver' => [ + ['customer_login', ['type' => 'invisible']], + ['place_order', ['type' => 'robot']], + ], + ], + [ + 'steps/children/shipping-step/children/shippingAddress/children/customer-email/children' => [], + 'steps/children/billing-step/children/payment/children/customer-email/children' => [], + 'authentication/children' => [], + 'steps/children/billing-step/children/payment/children/payments-list/children/before-place-order/' . + 'children' => [], + ] + ], + [ + [ + 'isCaptchaEnabled' => [ + ['customer_login', true], + ['place_order', true], + ], + 'uiConfigResolver' => [ + ['customer_login', ['type' => 'invisible']], + ['place_order', ['type' => 'robot']], + ], + ], + [ + 'steps/children/shipping-step/children/shippingAddress/children/' . + 'customer-email/children' => ['recaptcha' => ['settings' => ['type' => 'invisible']]], + 'steps/children/billing-step/children/payment/children/' . + 'customer-email/children' => ['recaptcha' => ['settings' => ['type' => 'invisible']]], + 'authentication/children' => ['recaptcha' => ['settings' => ['type' => 'invisible']]], + 'steps/children/billing-step/children/payment/children/payments-list/children/before-place-order/' . + 'children' => ['place-order-recaptcha' => ['settings' => ['type' => 'robot']]], + ] + ] + ]; + } +} diff --git a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php new file mode 100644 index 00000000..ac2382eb --- /dev/null +++ b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -0,0 +1,209 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaPaypal\Test\Unit\Block\LayoutProcessor\Checkout; + +use Magento\Framework\DataObject; +use Magento\Paypal\Model\Config; +use Magento\ReCaptchaPaypal\Block\LayoutProcessor\Checkout\Onepage; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaUi\Model\UiConfigResolverInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class OnepageTest extends TestCase +{ + /** + * @var UiConfigResolverInterface|MockObject + */ + private $uiConfigResolver; + + /** + * @var IsCaptchaEnabledInterface|MockObject + */ + private $isCaptchEnabled; + + /** + * @var Onepage + */ + private $model; + + /** + * @var array + */ + private $jsLayout = [ + 'components' => [ + 'checkout' => [ + 'children' => [ + 'steps' => [ + 'children' => [ + 'billing-step' => [ + 'children' => [ + 'payment' => [ + 'children' => [ + 'payments-list' => [ + 'children' => [ + 'before-place-order' => [ + 'children' => [ + 'place-order-recaptcha' => [ + 'skipPayments' => [] + ] + ] + ], + 'paypal-captcha' => [ + 'children' => [ + 'recaptcha' => [] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ] + ]; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + $this->uiConfigResolver = $this->getMockForAbstractClass(UiConfigResolverInterface::class); + $this->isCaptchEnabled = $this->getMockForAbstractClass(IsCaptchaEnabledInterface::class); + $this->model = new Onepage( + $this->uiConfigResolver, + $this->isCaptchEnabled + ); + } + + /** + * @dataProvider processDataProvider + */ + public function testProcess(array $mocks, array $expected): void + { + $this->uiConfigResolver->method('get') + ->willReturnMap($mocks['uiConfigResolver']); + $this->isCaptchEnabled->method('isCaptchaEnabledFor') + ->willReturnMap($mocks['isCaptchaEnabled']); + $prefix = 'components/checkout/children/'; + $config = new DataObject($this->model->process($this->jsLayout)); + $actual = []; + foreach (array_keys($expected) as $path) { + $actual[$path] = $config->getDataByPath($prefix . $path); + } + $this->assertSame($expected, $actual); + } + + public function processDataProvider(): array + { + return [ + [ + [ + 'isCaptchaEnabled' => [ + ['paypal_payflowpro', false], + ['place_order', false], + ], + 'uiConfigResolver' => [ + ['paypal_payflowpro', ['type' => 'invisible']], + ['place_order', ['type' => 'robot']], + ], + ], + [ + 'steps/children/billing-step/children/payment/children/payments-list/children/paypal-captcha/' . + 'children' => [], + 'steps/children/billing-step/children/payment/children/payments-list/children/before-place-order/' . + 'children' => [ + 'place-order-recaptcha' => [ + 'skipPayments' => [] + ] + ], + ] + ], + [ + [ + 'isCaptchaEnabled' => [ + ['paypal_payflowpro', false], + ['place_order', true], + ], + 'uiConfigResolver' => [ + ['paypal_payflowpro', ['type' => 'invisible']], + ['place_order', ['type' => 'robot']], + ], + ], + [ + 'steps/children/billing-step/children/payment/children/payments-list/children/paypal-captcha/' . + 'children' => [], + 'steps/children/billing-step/children/payment/children/payments-list/children/before-place-order/' . + 'children' => [ + 'place-order-recaptcha' => [ + 'skipPayments' => [ + Config::METHOD_EXPRESS => true, + Config::METHOD_WPP_PE_EXPRESS => true, + Config::METHOD_WPP_PE_BML => true, + ] + ] + ], + ] + ], + [ + [ + 'isCaptchaEnabled' => [ + ['paypal_payflowpro', true], + ['place_order', false], + ], + 'uiConfigResolver' => [ + ['paypal_payflowpro', ['type' => 'invisible']], + ['place_order', ['type' => 'robot']], + ], + ], + [ + 'steps/children/billing-step/children/payment/children/payments-list/children/paypal-captcha/' . + 'children' => ['recaptcha' => ['settings' => ['type' => 'invisible']]], + 'steps/children/billing-step/children/payment/children/payments-list/children/before-place-order/' . + 'children' => [ + 'place-order-recaptcha' => [ + 'skipPayments' => [] + ] + ], + ] + ], + [ + [ + 'isCaptchaEnabled' => [ + ['paypal_payflowpro', true], + ['place_order', true], + ], + 'uiConfigResolver' => [ + ['paypal_payflowpro', ['type' => 'invisible']], + ['place_order', ['type' => 'robot']], + ], + ], + [ + 'steps/children/billing-step/children/payment/children/payments-list/children/paypal-captcha/' . + 'children' => ['recaptcha' => ['settings' => ['type' => 'invisible']]], + 'steps/children/billing-step/children/payment/children/payments-list/children/before-place-order/' . + 'children' => [ + 'place-order-recaptcha' => [ + 'skipPayments' => [ + Config::METHOD_EXPRESS => true, + Config::METHOD_WPP_PE_EXPRESS => true, + Config::METHOD_WPP_PE_BML => true, + Config::METHOD_PAYFLOWPRO => true + ] + ] + ], + ] + ] + ]; + } +} From 7b6fc3ce093a18ebd4e68f6d440e3583e60e5a33 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Fri, 9 Dec 2022 13:48:08 -0600 Subject: [PATCH 062/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../Test/Unit/Model/ReCaptchaSessionTest.php | 132 +++++++++++ .../Test/Unit/Observer/PayPalObserverTest.php | 216 ++++++++++++++++++ 2 files changed, 348 insertions(+) create mode 100644 ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php create mode 100644 ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php diff --git a/ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php b/ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php new file mode 100644 index 00000000..58112e20 --- /dev/null +++ b/ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php @@ -0,0 +1,132 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaPaypal\Test\Unit\Model; + +use Magento\Framework\Session\SessionManager; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Quote\Api\Data\CartInterface; +use Magento\ReCaptchaPaypal\Model\ReCaptchaSession; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class ReCaptchaSessionTest extends TestCase +{ + /** + * @var TimezoneInterface|MockObject + */ + private $timezone; + + /** + * @var SessionManager|MockObject + */ + private $transparentSession; + + /** + * @var SessionManager|MockObject + */ + private $checkoutSession; + + /** + * @var ReCaptchaSession + */ + private $model; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + $this->timezone = $this->getMockForAbstractClass(TimezoneInterface::class); + $this->transparentSession = $this->getMockBuilder(SessionManager::class) + ->disableOriginalConstructor() + ->onlyMethods(['getData']) + ->addMethods(['setData', 'unsetData']) + ->getMock(); + $this->checkoutSession = $this->getMockBuilder(SessionManager::class) + ->disableOriginalConstructor() + ->addMethods(['getQuote']) + ->getMock(); + $this->model = new ReCaptchaSession( + $this->timezone, + $this->transparentSession, + $this->checkoutSession + ); + } + + public function testSaveIfThereIsNoActiveQuote(): void + { + $this->checkoutSession->expects($this->once()) + ->method('getQuote') + ->willReturn(null); + $this->assertFalse($this->model->save()); + } + + public function testSaveIfThereIsActiveQuote(): void + { + $quote = $this->getMockForAbstractClass(CartInterface::class); + $quote->expects($this->once()) + ->method('getId') + ->willReturn(1); + $this->checkoutSession->expects($this->exactly(2)) + ->method('getQuote') + ->willReturn($quote); + $this->timezone->expects($this->once()) + ->method('date') + ->willReturn(new \Datetime('@1670607221')); + $this->transparentSession->expects($this->once()) + ->method('setData') + ->with('paypal_payflowpro_recaptcha', ['quote_id' => 1, 'verified_at' => 1670607221]); + $this->assertTrue($this->model->save()); + } + + public function testIsInvalidIfQuoteIdIsMissing(): void + { + $this->transparentSession->expects($this->once()) + ->method('getData') + ->with('paypal_payflowpro_recaptcha') + ->willReturn(null); + $this->assertFalse($this->model->isValid(1)); + } + + public function testIsInvalidIfQuoteIdDoesNotMatch(): void + { + $this->transparentSession->expects($this->once()) + ->method('getData') + ->with('paypal_payflowpro_recaptcha') + ->willReturn(['quote_id' => 2, 'verified_at' => 1670607221]); + $this->assertFalse($this->model->isValid(1)); + } + + public function testIsInvalidIfExpired(): void + { + $this->timezone->expects($this->once()) + ->method('date') + ->willReturn(new \Datetime('@1670607342')); + $this->transparentSession->expects($this->once()) + ->method('getData') + ->with('paypal_payflowpro_recaptcha') + ->willReturn(['quote_id' => 1, 'verified_at' => 1670607221]); + $this->assertFalse($this->model->isValid(1)); + } + + public function testIsInvalidIfNotExpired(): void + { + $this->timezone->expects($this->once()) + ->method('date') + ->willReturn(new \Datetime('@1670607340')); + $this->transparentSession->expects($this->once()) + ->method('getData') + ->with('paypal_payflowpro_recaptcha') + ->willReturn(['quote_id' => 1, 'verified_at' => 1670607221]); + $this->transparentSession->expects($this->once()) + ->method('unsetData') + ->with('paypal_payflowpro_recaptcha'); + $this->assertTrue($this->model->isValid(1)); + } +} diff --git a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php new file mode 100644 index 00000000..2f8efe8d --- /dev/null +++ b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php @@ -0,0 +1,216 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaPaypal\Test\Unit\Observer; + +use Magento\Framework\App\Action\AbstractAction; +use Magento\Framework\App\ActionFlag; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Event\Observer; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\Framework\Validation\ValidationResult; +use Magento\ReCaptchaPaypal\Model\ReCaptchaSession; +use Magento\ReCaptchaPaypal\Observer\PayPalObserver; +use Magento\ReCaptchaUi\Model\CaptchaResponseResolverInterface; +use Magento\ReCaptchaUi\Model\ErrorMessageConfigInterface; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaUi\Model\ValidationConfigResolverInterface; +use Magento\ReCaptchaValidationApi\Api\ValidatorInterface; +use Magento\ReCaptchaValidationApi\Model\ValidationErrorMessagesProvider; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; + +class PayPalObserverTest extends TestCase +{ + /** + * @var ValidatorInterface|MockObject + */ + private $captchaValidator; + + /** + * @var IsCaptchaEnabledInterface|MockObject + */ + private $isCaptchaEnabled; + + /** + * @var ReCaptchaSession|MockObject + */ + private $reCaptchaSession; + + /** + * @var PayPalObserver + */ + private $model; + + /** + * @var Observer + */ + private $observer; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + $captchaResponseResolver = $this->getMockForAbstractClass(CaptchaResponseResolverInterface::class); + $validationConfigResolver = $this->getMockForAbstractClass(ValidationConfigResolverInterface::class); + $this->captchaValidator = $this->getMockForAbstractClass(ValidatorInterface::class); + $actionFlag = $this->createMock(ActionFlag::class); + $serializer = $this->getMockForAbstractClass(SerializerInterface::class); + $this->isCaptchaEnabled = $this->getMockForAbstractClass(IsCaptchaEnabledInterface::class); + $logger = $this->getMockForAbstractClass(LoggerInterface::class); + $errorMessageConfig = $this->getMockForAbstractClass(ErrorMessageConfigInterface::class); + $validationErrorMessagesProvider = $this->createMock(ValidationErrorMessagesProvider::class); + $this->reCaptchaSession = $this->createMock(ReCaptchaSession::class); + $this->model = new PayPalObserver( + $captchaResponseResolver, + $validationConfigResolver, + $this->captchaValidator, + $actionFlag, + $serializer, + $this->isCaptchaEnabled, + $logger, + $errorMessageConfig, + $validationErrorMessagesProvider, + $this->reCaptchaSession + ); + $controller = $this->getMockBuilder(AbstractAction::class) + ->disableOriginalConstructor() + ->onlyMethods(['getRequest', 'getResponse']) + ->getMockForAbstractClass(); + $request = $this->getMockForAbstractClass(RequestInterface::class); + $response = $this->getMockBuilder(ResponseInterface::class) + ->disableOriginalConstructor() + ->addMethods(['representJson']) + ->getMockForAbstractClass(); + $controller->method('getRequest')->willReturn($request); + $controller->method('getResponse')->willReturn($response); + $this->observer = new Observer(['controller_action' => $controller]); + } + + /** + * @param array $mocks + * @dataProvider executeDataProvider + */ + public function testExecute(array $mocks): void + { + $validationResult = $this->createMock(ValidationResult::class); + $validationResult->expects($mocks['validationResult'][0]['expects'] ?? $this->never()) + ->method('isValid')->willReturn($mocks['validationResult'][0]['willReturn'] ?? false); + $this->captchaValidator->expects($mocks['captchaValidator'][0]['expects'] ?? $this->never()) + ->method('isValid') + ->willReturn($validationResult); + unset($mocks['validationResult'], $mocks['captchaValidator']); + $this->configureMock($mocks); + $this->model->execute($this->observer); + } + + public function executeDataProvider(): array + { + return [ + [ + [ + 'isCaptchaEnabled' => [ + [ + 'method' => 'isCaptchaEnabledFor', + 'willReturnMap' => [ + ['paypal_payflowpro', false], + ['place_order', false], + ] + ] + ], + 'reCaptchaSession' => [ + [ + 'method' => 'save', + 'expects' => $this->never(), + ] + ] + ] + ], + [ + [ + 'isCaptchaEnabled' => [ + [ + 'method' => 'isCaptchaEnabledFor', + 'willReturnMap' => [ + ['paypal_payflowpro', true], + ['place_order', false], + ] + ] + ], + 'reCaptchaSession' => [ + [ + 'method' => 'save', + 'expects' => $this->never(), + ] + ], + 'captchaValidator' => [ + [ + 'method' => 'isValid', + 'expects' => $this->once(), + ] + ], + 'validationResult' => [ + [ + 'method' => 'isValid', + 'expects' => $this->once(), + 'willReturn' => true, + ] + ] + ] + ], + [ + [ + 'isCaptchaEnabled' => [ + [ + 'method' => 'isCaptchaEnabledFor', + 'willReturnMap' => [ + ['paypal_payflowpro', true], + ['place_order', true], + ] + ] + ], + 'reCaptchaSession' => [ + [ + 'method' => 'save', + 'expects' => $this->once(), + ] + ], + 'captchaValidator' => [ + [ + 'method' => 'isValid', + 'expects' => $this->once(), + ] + ], + 'validationResult' => [ + [ + 'method' => 'isValid', + 'expects' => $this->once(), + 'willReturn' => true, + ] + ] + ] + ] + ]; + } + + private function configureMock(array $mocks): void + { + foreach ($mocks as $prop => $propMocks) { + foreach ($propMocks as $mock) { + $builder = $this->$prop->expects($mock['expects'] ?? $this->any()); + unset($mock['expects']); + foreach ($mock as $method => $args) { + $builder->$method(...[$args]); + } + } + } + } +} From 0ecdf3101779151fcef597e381139c5779779813 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Fri, 9 Dec 2022 18:21:26 -0600 Subject: [PATCH 063/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../Test/Unit/Observer/PayPalObserverTest.php | 19 +- ...eplayPayflowReCaptchaForPlaceOrderTest.php | 277 ++++++++++++++++++ 2 files changed, 289 insertions(+), 7 deletions(-) create mode 100644 ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php diff --git a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php index 2f8efe8d..a02ae439 100644 --- a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php +++ b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php @@ -53,6 +53,11 @@ class PayPalObserverTest extends TestCase */ private $observer; + /** + * @var ValidationResult|MockObject + */ + private $validationResult; + /** * @inheritdoc */ @@ -93,6 +98,7 @@ protected function setUp(): void $controller->method('getRequest')->willReturn($request); $controller->method('getResponse')->willReturn($response); $this->observer = new Observer(['controller_action' => $controller]); + $this->validationResult = $this->createMock(ValidationResult::class); } /** @@ -101,13 +107,6 @@ protected function setUp(): void */ public function testExecute(array $mocks): void { - $validationResult = $this->createMock(ValidationResult::class); - $validationResult->expects($mocks['validationResult'][0]['expects'] ?? $this->never()) - ->method('isValid')->willReturn($mocks['validationResult'][0]['willReturn'] ?? false); - $this->captchaValidator->expects($mocks['captchaValidator'][0]['expects'] ?? $this->never()) - ->method('isValid') - ->willReturn($validationResult); - unset($mocks['validationResult'], $mocks['captchaValidator']); $this->configureMock($mocks); $this->model->execute($this->observer); } @@ -155,6 +154,7 @@ public function executeDataProvider(): array [ 'method' => 'isValid', 'expects' => $this->once(), + 'willReturnProperty' => 'validationResult' ] ], 'validationResult' => [ @@ -187,6 +187,7 @@ public function executeDataProvider(): array [ 'method' => 'isValid', 'expects' => $this->once(), + 'willReturnProperty' => 'validationResult' ] ], 'validationResult' => [ @@ -208,6 +209,10 @@ private function configureMock(array $mocks): void $builder = $this->$prop->expects($mock['expects'] ?? $this->any()); unset($mock['expects']); foreach ($mock as $method => $args) { + if ($method === 'willReturnProperty') { + $method = 'willReturn'; + $args = $this->$args; + } $builder->$method(...[$args]); } } diff --git a/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php new file mode 100644 index 00000000..6a6e884d --- /dev/null +++ b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php @@ -0,0 +1,277 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaPaypal\Test\Unit\Plugin; + +use Magento\Framework\Webapi\Rest\Request; +use Magento\Paypal\Model\Config; +use Magento\Quote\Model\QuoteIdMask; +use Magento\Quote\Model\QuoteIdMaskFactory; +use Magento\ReCaptchaCheckout\Model\WebapiConfigProvider; +use Magento\ReCaptchaPaypal\Model\ReCaptchaSession; +use Magento\ReCaptchaPaypal\Plugin\ReplayPayflowReCaptchaForPlaceOrder; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; +use Magento\ReCaptchaWebapiApi\Api\Data\EndpointInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class ReplayPayflowReCaptchaForPlaceOrderTest extends TestCase +{ + /** + * @var IsCaptchaEnabledInterface|MockObject + */ + private $isCaptchaEnabled; + + /** + * @var Request|MockObject + */ + private $request; + + /** + * @var ReCaptchaSession|MockObject + */ + private $reCaptchaSession; + + /** + * @var QuoteIdMaskFactory|MockObject + */ + private $quoteIdMaskFactory; + + /** + * @var QuoteIdMask|MockObject + */ + private $quoteIdMask; + + /** + * @var ReplayPayflowReCaptchaForPlaceOrder + */ + private $model; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + $this->isCaptchaEnabled = $this->getMockForAbstractClass(IsCaptchaEnabledInterface::class); + $this->request = $this->createMock(Request::class); + $this->reCaptchaSession = $this->createMock(ReCaptchaSession::class); + $this->quoteIdMaskFactory = $this->createMock(QuoteIdMaskFactory::class); + $this->quoteIdMask = $this->getMockBuilder(QuoteIdMask::class) + ->onlyMethods(['load']) + ->addMethods(['getQuoteId']) + ->disableOriginalConstructor() + ->getMock(); + $this->model = new ReplayPayflowReCaptchaForPlaceOrder( + $this->isCaptchaEnabled, + $this->request, + $this->reCaptchaSession, + $this->quoteIdMaskFactory + ); + } + + /** + * @param array $mocks + * @param bool $isResultNull + * @param bool $isReturnNull + * @dataProvider afterGetConfigForDataProvider + */ + public function testAfterGetConfigFor(array $mocks, bool $isResultNull, bool $isReturnNull): void + { + $this->configureMock($mocks); + $subject = $this->createMock(WebapiConfigProvider::class); + $result = $this->getMockForAbstractClass(ValidationConfigInterface::class); + $endpoint = $this->getMockForAbstractClass(EndpointInterface::class); + $this->assertSame( + $isReturnNull ? null : $result, + $this->model->afterGetConfigFor($subject, $isResultNull ? null : $result, $endpoint) + ); + } + + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + public function afterGetConfigForDataProvider(): array + { + return [ + [ + [ + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->never()] + ] + ], + true, + true + ], + [ + [ + 'isCaptchaEnabled' => [ + ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => false] + ], + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->never(),] + ] + ], + false, + false + ], + [ + [ + 'isCaptchaEnabled' => [ + ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true] + ], + 'request' => [ + ['method' => 'getBodyParams', 'expects' => $this->once(), 'willReturn' => []] + ], + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->never(),] + ] + ], + false, + false + ], + [ + [ + 'isCaptchaEnabled' => [ + ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true] + ], + 'request' => [ + [ + 'method' => 'getBodyParams', + 'expects' => $this->once(), + 'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => 'checkmo']] + ] + ], + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->never(), 'willReturn' => false] + ] + ], + false, + false + ], + [ + [ + 'isCaptchaEnabled' => [ + ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true] + ], + 'request' => [ + [ + 'method' => 'getBodyParams', + 'expects' => $this->once(), + 'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO]] + ] + ], + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => false] + ] + ], + false, + false + ], + [ + [ + 'isCaptchaEnabled' => [ + ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true] + ], + 'request' => [ + [ + 'method' => 'getBodyParams', + 'expects' => $this->once(), + 'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO]] + ] + ], + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => true] + ] + ], + false, + true + ], + [ + [ + 'isCaptchaEnabled' => [ + ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true] + ], + 'request' => [ + [ + 'method' => 'getBodyParams', + 'expects' => $this->once(), + 'willReturn' => [ + 'cart_id' => 1, + 'payment_method' => ['method' => Config::METHOD_PAYFLOWPRO] + ] + ] + ], + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => true] + ] + ], + false, + true + ], + [ + [ + 'isCaptchaEnabled' => [ + ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true] + ], + 'request' => [ + [ + 'method' => 'getBodyParams', + 'expects' => $this->once(), + 'willReturn' => [ + 'cartId' => '17uc43rge98nc92', + 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO] + ] + ] + ], + 'quoteIdMaskFactory' => [ + [ + 'method' => 'create', + 'expects' => $this->once(), + 'willReturnProperty' => 'quoteIdMask' + ] + ], + 'quoteIdMask' => [ + [ + 'method' => 'load', + 'expects' => $this->once(), + 'willReturnSelf' => null + ], + [ + 'method' => 'getQuoteId', + 'expects' => $this->once(), + 'willReturn' => 2 + ] + ], + 'reCaptchaSession' => [ + ['method' => 'isValid', 'expects' => $this->once(), 'with' => 2, 'willReturn' => true] + ] + ], + false, + true + ], + ]; + } + + private function configureMock(array $mocks): void + { + foreach ($mocks as $prop => $propMocks) { + foreach ($propMocks as $mock) { + $builder = $this->$prop->expects($mock['expects'] ?? $this->any()); + unset($mock['expects']); + foreach ($mock as $method => $args) { + if ($method === 'willReturnProperty') { + $method = 'willReturn'; + $args = $this->$args; + } + $builder->$method(...[$args]); + } + } + } + } +} From 92d9a7ec19ded09458401e6ce040b1930e0ae657 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 12 Dec 2022 08:42:11 -0600 Subject: [PATCH 064/208] ACP2E-1338: Google reCaptcha in Incorrect position --- .../Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php index ac2382eb..2a01a10b 100644 --- a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php +++ b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -104,6 +104,9 @@ public function testProcess(array $mocks, array $expected): void $this->assertSame($expected, $actual); } + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ public function processDataProvider(): array { return [ From c4e6e1f370f0f54102b4f2aa6a4491fb9f455358 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 12 Dec 2022 09:32:24 -0600 Subject: [PATCH 065/208] ACP2E-1338: Google reCaptcha in Incorrect position --- ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php index a02ae439..66f4eead 100644 --- a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php +++ b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php @@ -26,6 +26,9 @@ use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class PayPalObserverTest extends TestCase { /** From a46ef5426ec9f289b971e390c512cef813eb88ba Mon Sep 17 00:00:00 2001 From: Dmytro Shevtsov <shevtsov@adobe.com> Date: Tue, 20 Dec 2022 10:24:12 -0600 Subject: [PATCH 066/208] Update docs links --- .github/CONTRIBUTING.md | 6 +++--- README.md | 6 +++--- TwoFactorAuth/README.md | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 9718d21c..066375e5 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -2,7 +2,7 @@ Contributions to the Magento 2 codebase are done using the fork & pull model. This contribution model has contributors maintaining their own fork of the Magento 2 repository. -The forked repository is then used to submit a request to the base repository to “pull” a set of changes. +The forked repository is then used to submit a request to the base repository to "pull" a set of changes. For more information on pull requests please refer to [GitHub Help](https://help.github.com/articles/about-pull-requests/). Contributions can take the form of new components or features, changes to existing features, tests, documentation (such as developer guides, user guides, examples, or specifications), bug fixes or optimizations. @@ -15,7 +15,7 @@ For more detailed information on contribution please read our [beginners guide]( ## Contribution requirements -1. Contributions must adhere to the [Magento coding standards](https://devdocs.magento.com/guides/v2.3/coding-standards/bk-coding-standards.html). +1. Contributions must adhere to the [Magento coding standards](https://developer.adobe.com/commerce/php/coding-standards/). 2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests. 3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/2.3-develop/.github/PULL_REQUEST_TEMPLATE.md) for more information. 4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug. @@ -33,7 +33,7 @@ This will allow you to collaborate with the Magento 2 development team, fork the 1. Search current [listed issues](https://github.com/magento/magento2/issues) (open or closed) for similar proposals of intended contribution before starting work on a new contribution. 2. Sign the [Adobe Contributor License Agreement](https://opensource.adobe.com/cla.html) if you have not signed it before. 3. Create and test your work. -4. Fork the Magento 2 repository according to the [Fork A Repository instructions](https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#fork) and when you are ready to send us a pull request – follow the [Create A Pull Request instructions](https://devdocs.magento.com/guides/v2.3/contributor-guide/contributing.html#pull_request). +4. Fork the Magento 2 repository according to the [Fork A Repository instructions](https://developer.adobe.com/commerce/contributor/guides/code-contributions/) and when you are ready to send us a pull request – follow the [Create A Pull Request instructions](https://developer.adobe.com/commerce/contributor/guides/code-contributions/). 5. Once your contribution is received the Magento 2 development team will review the contribution and collaborate with you as needed. ## Code of Conduct diff --git a/README.md b/README.md index d63f6b68..48c6df95 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ disclosure practices. - Complete documentation located on the project [wiki pages](https://github.com/magento/security-package/wiki): - How to start local development described in the [installation guide](https://github.com/magento/security-package/wiki/Metapackage-Installation-Guide) - - Two-factor authentication [user guide](https://docs.magento.com/user-guide/stores/security-two-factor-authentication.html) and [technical guide](https://devdocs.magento.com/guides/v2.4/security/two-factor-authentication.html). - - Google ReCAPTCHA [user guide](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html) and [technical guide](https://devdocs.magento.com/guides/v2.4/security/google-recaptcha.html). - - Security.txt [user guide](https://docs.magento.com/user-guide/configuration/security/security-txt.html) and [technical guide](https://devdocs.magento.com/guides/v2.4/security/security-txt.html). + - Two-factor authentication [user guide](https://docs.magento.com/user-guide/stores/security-two-factor-authentication.html) and [technical guide](https://developer.adobe.com/commerce/testing/functional-testing-framework/two-factor-authentication/). + - Google ReCAPTCHA [user guide](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html) and [technical guide](https://experienceleague.adobe.com/docs/commerce-admin/systems/security/captcha/security-google-recaptcha.html). + - Security.txt [user guide](https://docs.magento.com/user-guide/configuration/security/security-txt.html) and [technical guide](https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/security/security-txt.html). ## Community Engineering Slack diff --git a/TwoFactorAuth/README.md b/TwoFactorAuth/README.md index b9ba60c4..0ec6f9a0 100644 --- a/TwoFactorAuth/README.md +++ b/TwoFactorAuth/README.md @@ -2,4 +2,4 @@ The Magento Admin provides all access to your store, orders, and customer data. To prevent unauthorized access to your data, all users who attempt to sign in to the Admin of your Magento installation must complete a second step to verify their identity. -For more information please view the Magento documentation for [a general guide on 2fa](https://docs.magento.com/user-guide/stores/security-two-factor-authentication.html) as well as a [a more technical guide](https://devdocs.magento.com/guides/v2.4/security/two-factor-authentication.html). +For more information please view the Magento documentation for [a general guide on 2fa](https://docs.magento.com/user-guide/stores/security-two-factor-authentication.html) as well as a [a more technical guide](https://developer.adobe.com/commerce/testing/functional-testing-framework/two-factor-authentication/). From 9366431d42772d073649418c10f094e8f1b02ff8 Mon Sep 17 00:00:00 2001 From: Anna Bukatar <abukatar@magento.com> Date: Fri, 20 Jan 2023 18:21:02 -0800 Subject: [PATCH 067/208] ACP2E-1539: Google reCAPTCHA v3 on Checkout not working for Check/Money order or custom payment methods --- .../web/js/model/place-order-mixin.js | 11 ++- .../view/frontend/web/js/webapiReCaptcha.js | 10 ++- .../web/js/webapiReCaptchaRegistry.js | 5 ++ .../js/model/place-order-mixin.test.js | 90 +++++++++++++------ 4 files changed, 81 insertions(+), 35 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 9693ae7e..c376b915 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -30,8 +30,15 @@ define([ }); //Trigger ReCaptcha validation recaptchaRegistry.triggers['recaptcha-checkout-place-order'](); - //remove listener so that place order action is only triggered by the 'Place Order' button - recaptchaRegistry.removeListener('recaptcha-checkout-place-order'); + + if ( + !recaptchaRegistry._isInvisibleType.hasOwnProperty('recaptcha-checkout-place-order') || + recaptchaRegistry._isInvisibleType['recaptcha-checkout-place-order'] === false + ) { + //remove listener so that place order action is only triggered by the 'Place Order' button + recaptchaRegistry.removeListener('recaptcha-checkout-place-order'); + } + return recaptchaDeferred; } diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js index c7c7c15d..312a68b5 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js @@ -43,14 +43,16 @@ define( var self = this, trigger; + trigger = function () { + self.reCaptchaCallback(grecaptcha.getResponse(widgetId)); + }; + registry._isInvisibleType[this.getReCaptchaId()] = false; + if (this.getIsInvisibleRecaptcha()) { trigger = function () { grecaptcha.execute(widgetId); }; - } else { - trigger = function () { - self.reCaptchaCallback(grecaptcha.getResponse(widgetId)); - }; + registry._isInvisibleType[this.getReCaptchaId()] = true; } if (this.autoTrigger) { diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js index 633f092c..3d504c14 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js @@ -26,6 +26,11 @@ define([], function () { */ _listeners: {}, + /** + * recaptchaId: bool map + */ + _isInvisibleType: {}, + /** * Add a listener to when the ReCaptcha finishes verification * @param {String} id - ReCaptchaId diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js index 499dca35..70229ccd 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js @@ -41,38 +41,40 @@ define(['squire' expect(placeOrderMixins['Magento_ReCaptchaCheckout/js/model/place-order-mixin']).toBe(true); }); + }); + + describe('Magento_Checkout/js/action/redirect-on-success is called', function () { + var recaptchaId = 'recaptcha-checkout-place-order', + messageContainer = jasmine.createSpy('messageContainer'), + payload = {}, + serviceUrl = 'test', - it('Magento_Checkout/js/action/redirect-on-success is called', function () { - let recaptchaId = 'recaptcha-checkout-place-order', - messageContainer = jasmine.createSpy('messageContainer'), - payload = {}, - serviceUrl = 'test', - - /** - * Order place action mock - * - * @returns {{fail: fail, done: (function(Function): *)}} - */ - action = function () { - return { - /** - * Success result for request - * - * @param {Function} handler - * @returns {*} - */ - done: function (handler) { - handler(); - return this; - }, - - /** - * Fail result for request - */ - fail: function () {} - }; + /** + * Order place action mock + * + * @returns {{fail: fail, done: (function(Function): *)}} + */ + action = function () { + return { + /** + * Success result for request + * + * @param {Function} handler + * @returns {*} + */ + done: function (handler) { + handler(); + return this; + }, + + /** + * Fail result for request + */ + fail: function () {} }; + }; + it('Only PlaceOrder button triggers place order action', function () { /** * Triggers declared listener * @@ -93,9 +95,39 @@ define(['squire' registry.addListener = function (id, func) { registry._listeners[id] = func; }; + registry.removeListener = jasmine.createSpy(); mixin()(action, serviceUrl, payload, messageContainer); expect(registry.removeListener).toHaveBeenCalledWith(recaptchaId); }); + + it('PlaceOrder Listener is called for invisible google recaptcha', function () { + /** + * Triggers declared listener + * + * @returns {*} + */ + registry.triggers[recaptchaId] = function () { + if (registry._listeners[recaptchaId] !== undefined) { + return registry._listeners[recaptchaId]('token'); + } + }; + + /** + * Registers a listener + * + * @param id + * @param func + */ + registry.addListener = function (id, func) { + registry._listeners[id] = func; + }; + + registry._isInvisibleType[recaptchaId] = true; + registry.removeListener = jasmine.createSpy(); + mixin()(action, serviceUrl, payload, messageContainer); + + expect(registry.removeListener).not.toHaveBeenCalled(); + }); }); }); From dc3c0cca64ba77c957107c4c41d277c602476c83 Mon Sep 17 00:00:00 2001 From: Sachin Admane <sadmane@adobe.com> Date: Wed, 25 Jan 2023 15:38:38 -0600 Subject: [PATCH 068/208] AC-7715: Recaptcha exception fixes. --- ReCaptchaValidation/Model/ReCaptchaProxy.php | 58 ++++++++++++++++++++ ReCaptchaValidation/Model/Validator.php | 8 +-- 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 ReCaptchaValidation/Model/ReCaptchaProxy.php diff --git a/ReCaptchaValidation/Model/ReCaptchaProxy.php b/ReCaptchaValidation/Model/ReCaptchaProxy.php new file mode 100644 index 00000000..7e103c11 --- /dev/null +++ b/ReCaptchaValidation/Model/ReCaptchaProxy.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaValidation\Model; + +use ReCaptcha\ReCaptcha; + +/** + * Wrapper Class for Google Recaptcha + */ +class ReCaptchaProxy extends ReCaptcha +{ + + /** + * @var float + */ + protected float $threshold = 0.0; + + /** + * @var string + */ + protected string $action; + + /** + * @var string + */ + protected string $apkPackageName; + + /** + * @var string + */ + protected string $hostname; + + /** + * @var int + */ + protected int $timeoutSeconds; + + /** + * @inheritDoc + */ + public function setScoreThreshold($threshold): ReCaptcha + { + return parent::setScoreThreshold($threshold); + } + + /** + * @inheritDoc + */ + public function verify($response, $remoteIp = null): \ReCaptcha\Response + { + return parent::verify($response, $remoteIp); + } +} diff --git a/ReCaptchaValidation/Model/Validator.php b/ReCaptchaValidation/Model/Validator.php index a8f544d9..7b8037ce 100644 --- a/ReCaptchaValidation/Model/Validator.php +++ b/ReCaptchaValidation/Model/Validator.php @@ -13,7 +13,7 @@ use Magento\ReCaptchaValidationApi\Api\ValidatorInterface; use Magento\ReCaptchaValidationApi\Model\ErrorMessagesProvider; use ReCaptcha\ReCaptcha; -use ReCaptcha\ReCaptchaFactory; +use Magento\ReCaptchaValidation\Model\ReCaptchaProxyFactory; /** * @inheritdoc @@ -31,19 +31,19 @@ class Validator implements ValidatorInterface private $errorMessagesProvider; /** - * @var ReCaptchaFactory + * @var ReCaptchaProxyFactory\ */ private $reCaptchaFactory; /** * @param ValidationResultFactory $validationResultFactory * @param ErrorMessagesProvider $errorMessagesProvider - * @param ReCaptchaFactory $reCaptchaFactory + * @param ReCaptchaProxyFactory $reCaptchaFactory */ public function __construct( ValidationResultFactory $validationResultFactory, ErrorMessagesProvider $errorMessagesProvider, - ReCaptchaFactory $reCaptchaFactory + ReCaptchaProxyFactory $reCaptchaFactory ) { $this->validationResultFactory = $validationResultFactory; $this->errorMessagesProvider = $errorMessagesProvider; From a18e2315ca660ed5aeebb759db32b782ab6ab919 Mon Sep 17 00:00:00 2001 From: Sachin Admane <sadmane@adobe.com> Date: Fri, 27 Jan 2023 13:05:36 -0600 Subject: [PATCH 069/208] AC-7715: Refactoring wrapper class and removing redundant functions. --- ReCaptchaValidation/Model/ReCaptcha.php | 23 ++++++++ ReCaptchaValidation/Model/ReCaptchaProxy.php | 58 -------------------- ReCaptchaValidation/Model/Validator.php | 8 +-- 3 files changed, 27 insertions(+), 62 deletions(-) create mode 100644 ReCaptchaValidation/Model/ReCaptcha.php delete mode 100644 ReCaptchaValidation/Model/ReCaptchaProxy.php diff --git a/ReCaptchaValidation/Model/ReCaptcha.php b/ReCaptchaValidation/Model/ReCaptcha.php new file mode 100644 index 00000000..b02a41de --- /dev/null +++ b/ReCaptchaValidation/Model/ReCaptcha.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaValidation\Model; + +use ReCaptcha\ReCaptcha as GoogleReCaptcha; + +/** + * Wrapper Class for Google Recaptcha + * Used to fix dynamic property deprecation error + */ +class ReCaptcha extends GoogleReCaptcha +{ + + /** + * @var float + */ + protected float $threshold = 0.0; +} diff --git a/ReCaptchaValidation/Model/ReCaptchaProxy.php b/ReCaptchaValidation/Model/ReCaptchaProxy.php deleted file mode 100644 index 7e103c11..00000000 --- a/ReCaptchaValidation/Model/ReCaptchaProxy.php +++ /dev/null @@ -1,58 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\ReCaptchaValidation\Model; - -use ReCaptcha\ReCaptcha; - -/** - * Wrapper Class for Google Recaptcha - */ -class ReCaptchaProxy extends ReCaptcha -{ - - /** - * @var float - */ - protected float $threshold = 0.0; - - /** - * @var string - */ - protected string $action; - - /** - * @var string - */ - protected string $apkPackageName; - - /** - * @var string - */ - protected string $hostname; - - /** - * @var int - */ - protected int $timeoutSeconds; - - /** - * @inheritDoc - */ - public function setScoreThreshold($threshold): ReCaptcha - { - return parent::setScoreThreshold($threshold); - } - - /** - * @inheritDoc - */ - public function verify($response, $remoteIp = null): \ReCaptcha\Response - { - return parent::verify($response, $remoteIp); - } -} diff --git a/ReCaptchaValidation/Model/Validator.php b/ReCaptchaValidation/Model/Validator.php index 7b8037ce..16907b1c 100644 --- a/ReCaptchaValidation/Model/Validator.php +++ b/ReCaptchaValidation/Model/Validator.php @@ -13,7 +13,7 @@ use Magento\ReCaptchaValidationApi\Api\ValidatorInterface; use Magento\ReCaptchaValidationApi\Model\ErrorMessagesProvider; use ReCaptcha\ReCaptcha; -use Magento\ReCaptchaValidation\Model\ReCaptchaProxyFactory; +use Magento\ReCaptchaValidation\Model\ReCaptchaFactory; /** * @inheritdoc @@ -31,19 +31,19 @@ class Validator implements ValidatorInterface private $errorMessagesProvider; /** - * @var ReCaptchaProxyFactory\ + * @var ReCaptchaFactory\ */ private $reCaptchaFactory; /** * @param ValidationResultFactory $validationResultFactory * @param ErrorMessagesProvider $errorMessagesProvider - * @param ReCaptchaProxyFactory $reCaptchaFactory + * @param ReCaptchaFactory $reCaptchaFactory */ public function __construct( ValidationResultFactory $validationResultFactory, ErrorMessagesProvider $errorMessagesProvider, - ReCaptchaProxyFactory $reCaptchaFactory + ReCaptchaFactory $reCaptchaFactory ) { $this->validationResultFactory = $validationResultFactory; $this->errorMessagesProvider = $errorMessagesProvider; From 222cf2e27ed39598765d587ba5bdb20089042b2c Mon Sep 17 00:00:00 2001 From: Sachin Admane <sadmane@adobe.com> Date: Fri, 27 Jan 2023 16:06:18 -0600 Subject: [PATCH 070/208] AC-7836: Google ReCaptcha not working on checkout page. --- .../web/js/model/place-order-mixin.js | 11 ++- .../view/frontend/web/js/webapiReCaptcha.js | 10 ++- .../web/js/webapiReCaptchaRegistry.js | 5 ++ .../js/model/place-order-mixin.test.js | 90 +++++++++++++------ 4 files changed, 81 insertions(+), 35 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 9693ae7e..c376b915 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -30,8 +30,15 @@ define([ }); //Trigger ReCaptcha validation recaptchaRegistry.triggers['recaptcha-checkout-place-order'](); - //remove listener so that place order action is only triggered by the 'Place Order' button - recaptchaRegistry.removeListener('recaptcha-checkout-place-order'); + + if ( + !recaptchaRegistry._isInvisibleType.hasOwnProperty('recaptcha-checkout-place-order') || + recaptchaRegistry._isInvisibleType['recaptcha-checkout-place-order'] === false + ) { + //remove listener so that place order action is only triggered by the 'Place Order' button + recaptchaRegistry.removeListener('recaptcha-checkout-place-order'); + } + return recaptchaDeferred; } diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js index c7c7c15d..312a68b5 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js @@ -43,14 +43,16 @@ define( var self = this, trigger; + trigger = function () { + self.reCaptchaCallback(grecaptcha.getResponse(widgetId)); + }; + registry._isInvisibleType[this.getReCaptchaId()] = false; + if (this.getIsInvisibleRecaptcha()) { trigger = function () { grecaptcha.execute(widgetId); }; - } else { - trigger = function () { - self.reCaptchaCallback(grecaptcha.getResponse(widgetId)); - }; + registry._isInvisibleType[this.getReCaptchaId()] = true; } if (this.autoTrigger) { diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js index 633f092c..3d504c14 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js @@ -26,6 +26,11 @@ define([], function () { */ _listeners: {}, + /** + * recaptchaId: bool map + */ + _isInvisibleType: {}, + /** * Add a listener to when the ReCaptcha finishes verification * @param {String} id - ReCaptchaId diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js index 499dca35..70229ccd 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js @@ -41,38 +41,40 @@ define(['squire' expect(placeOrderMixins['Magento_ReCaptchaCheckout/js/model/place-order-mixin']).toBe(true); }); + }); + + describe('Magento_Checkout/js/action/redirect-on-success is called', function () { + var recaptchaId = 'recaptcha-checkout-place-order', + messageContainer = jasmine.createSpy('messageContainer'), + payload = {}, + serviceUrl = 'test', - it('Magento_Checkout/js/action/redirect-on-success is called', function () { - let recaptchaId = 'recaptcha-checkout-place-order', - messageContainer = jasmine.createSpy('messageContainer'), - payload = {}, - serviceUrl = 'test', - - /** - * Order place action mock - * - * @returns {{fail: fail, done: (function(Function): *)}} - */ - action = function () { - return { - /** - * Success result for request - * - * @param {Function} handler - * @returns {*} - */ - done: function (handler) { - handler(); - return this; - }, - - /** - * Fail result for request - */ - fail: function () {} - }; + /** + * Order place action mock + * + * @returns {{fail: fail, done: (function(Function): *)}} + */ + action = function () { + return { + /** + * Success result for request + * + * @param {Function} handler + * @returns {*} + */ + done: function (handler) { + handler(); + return this; + }, + + /** + * Fail result for request + */ + fail: function () {} }; + }; + it('Only PlaceOrder button triggers place order action', function () { /** * Triggers declared listener * @@ -93,9 +95,39 @@ define(['squire' registry.addListener = function (id, func) { registry._listeners[id] = func; }; + registry.removeListener = jasmine.createSpy(); mixin()(action, serviceUrl, payload, messageContainer); expect(registry.removeListener).toHaveBeenCalledWith(recaptchaId); }); + + it('PlaceOrder Listener is called for invisible google recaptcha', function () { + /** + * Triggers declared listener + * + * @returns {*} + */ + registry.triggers[recaptchaId] = function () { + if (registry._listeners[recaptchaId] !== undefined) { + return registry._listeners[recaptchaId]('token'); + } + }; + + /** + * Registers a listener + * + * @param id + * @param func + */ + registry.addListener = function (id, func) { + registry._listeners[id] = func; + }; + + registry._isInvisibleType[recaptchaId] = true; + registry.removeListener = jasmine.createSpy(); + mixin()(action, serviceUrl, payload, messageContainer); + + expect(registry.removeListener).not.toHaveBeenCalled(); + }); }); }); From c767587b0b4ab63f77b92c25d3aa610606830bc1 Mon Sep 17 00:00:00 2001 From: Sergio Vera <sergio.vera@gmail.com> Date: Tue, 7 Mar 2023 14:03:53 +0100 Subject: [PATCH 071/208] LYNX-85: Ported recaptchaV3Config query from ReCaptchaGraphQlPwa --- ReCaptchaVersion3Invisible/Model/Config.php | 164 ++++++++++++++++++ ReCaptchaVersion3Invisible/etc/di.xml | 16 ++ .../Model/Resolver/ReCaptchaV3.php | 131 ++++++++++++++ .../Test/Api/ReCaptchaV3ConfigTest.php | 153 ++++++++++++++++ ReCaptchaWebapiGraphQl/composer.json | 2 + ReCaptchaWebapiGraphQl/etc/schema.graphqls | 29 ++++ 6 files changed, 495 insertions(+) create mode 100644 ReCaptchaVersion3Invisible/Model/Config.php create mode 100644 ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php create mode 100644 ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php create mode 100644 ReCaptchaWebapiGraphQl/etc/schema.graphqls diff --git a/ReCaptchaVersion3Invisible/Model/Config.php b/ReCaptchaVersion3Invisible/Model/Config.php new file mode 100644 index 00000000..a394f5b1 --- /dev/null +++ b/ReCaptchaVersion3Invisible/Model/Config.php @@ -0,0 +1,164 @@ +<?php + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaVersion3Invisible\Model; + +use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; +use Magento\ReCaptchaVersion3Invisible\Model\Frontend\UiConfigProvider; +use Magento\ReCaptchaVersion3Invisible\Model\Frontend\ValidationConfigProvider; + +class Config +{ + /** + * @var string|null + */ + private ?string $websiteKey = null; + + /** + * @var float|null + */ + private ?float $minimumScore = null; + + /** + * @var string|null + */ + private ?string $badgePosition = null; + + /** + * @var string|null + */ + private ?string $languageCode = null; + + /** + * @var UiConfigProvider + */ + private UiConfigProvider $uiConfigProvider; + + /** + * @var array + */ + private array $uiConfig; + + /** + * @var ValidationConfigProvider + */ + private ValidationConfigProvider $validationConfigProvider; + + /** + * @var ValidationConfigInterface|null + */ + private ?ValidationConfigInterface $validationConfig = null; + + /** + * @var array + */ + private array $formTypes; + + /** + * @param UiConfigProvider $uiConfigProvider + * @param ValidationConfigProvider $validationConfigProvider + * @param array $formTypes + */ + public function __construct( + UiConfigProvider $uiConfigProvider, + ValidationConfigProvider $validationConfigProvider, + array $formTypes = [] + ) { + $this->formTypes = $formTypes; + $this->uiConfigProvider = $uiConfigProvider; + $this->validationConfigProvider = $validationConfigProvider; + } + + /** + * Get website's Google API public key + * + * @return string + */ + public function getWebsiteKey(): string + { + if (!$this->websiteKey) { + $this->websiteKey = $this->getUiConfig()['rendering']['sitekey']; + } + return $this->websiteKey; + } + + /** + * Get configured minimum score value + * + * @return float + */ + public function getMinimumScore(): float + { + if (!$this->minimumScore) { + $this->minimumScore = $this->validationConfig->getExtensionAttributes()->getScoreThreshold(); + } + return $this->minimumScore; + } + + /** + * Get configured captcha's badge position + * + * @return string + */ + public function getBadgePosition(): string + { + if (!$this->badgePosition) { + $this->badgePosition = $this->getUiConfig()['rendering']['badge']; + } + return $this->badgePosition; + } + + /** + * Get code of language to send notifications + * + * @return string + */ + public function getLanguageCode(): string + { + if (!$this->languageCode) { + $this->languageCode = $this->getUiConfig()['rendering']['hl']; + } + return $this->languageCode; + } + + /** + * Get ReCaptchaV3's available form types + * + * @return array + */ + public function getFormTypes(): array + { + return $this->formTypes; + } + + /** + * Get front-end's validation configurations + * + * @return ValidationConfigInterface + */ + public function getValidationConfig(): ValidationConfigInterface + { + if (!$this->validationConfig) { + $this->validationConfig = $this->validationConfigProvider->get(); + } + return $this->validationConfig; + } + + /** + * Get front-end's UI configurations + * + * @return array + */ + private function getUiConfig(): array + { + if (empty($this->uiConfig)) { + $this->uiConfig = $this->uiConfigProvider->get(); + } + return $this->uiConfig; + } +} diff --git a/ReCaptchaVersion3Invisible/etc/di.xml b/ReCaptchaVersion3Invisible/etc/di.xml index d63385c4..7549b73e 100644 --- a/ReCaptchaVersion3Invisible/etc/di.xml +++ b/ReCaptchaVersion3Invisible/etc/di.xml @@ -84,4 +84,20 @@ </argument> </arguments> </type> + <type name="Magento\ReCaptchaVersion3Invisible\Model\Config"> + <arguments> + <argument name="formTypes" xsi:type="array"> + <item name="place_order" xsi:type="string">place_order</item> + <item name="contact" xsi:type="string">contact</item> + <item name="customer_forgot_password" xsi:type="string">customer_forgot_password</item> + <item name="customer_edit" xsi:type="string">customer_edit</item> + <item name="customer_login" xsi:type="string">customer_login</item> + <item name="customer_create" xsi:type="string">customer_create</item> + <item name="newsletter" xsi:type="string">newsletter</item> + <item name="product_review" xsi:type="string">product_review</item> + <item name="sendfriend" xsi:type="string">sendfriend</item> + <item name="braintree" xsi:type="string">braintree</item> + </argument> + </arguments> + </type> </config> diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php new file mode 100644 index 00000000..5abc02bc --- /dev/null +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -0,0 +1,131 @@ +<?php + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaWebapiGraphQl\Model\Resolver; + +use Magento\Framework\Exception\InputException; +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Query\ResolverInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\ReCaptchaFrontendUi\Model\CaptchaTypeResolver; +use Magento\ReCaptchaFrontendUi\Model\ErrorMessageConfig; +use Magento\ReCaptchaVersion3Invisible\Model\Config; + +class ReCaptchaV3 implements ResolverInterface +{ + private const RECAPTCHA_TYPE = 'recaptcha_v3'; + + /** + * @var bool|null + */ + private ?bool $isEnabled = null; + + /** + * @var Config + */ + private Config $reCaptchaV3Config; + + /** + * @var CaptchaTypeResolver + */ + private CaptchaTypeResolver $captchaTypeResolver; + + /** + * @var string|null + */ + private ?string $failureMessage = null; + + /** + * @var ErrorMessageConfig $errorMessageConfig + */ + private ErrorMessageConfig $errorMessageConfig; + + /** + * @param Config $reCaptchaV3Config + * @param CaptchaTypeResolver $captchaTypeResolver + * @param ErrorMessageConfig $errorMessageConfig + */ + public function __construct( + Config $reCaptchaV3Config, + CaptchaTypeResolver $captchaTypeResolver, + ErrorMessageConfig $errorMessageConfig + ) { + $this->reCaptchaV3Config = $reCaptchaV3Config; + $this->captchaTypeResolver = $captchaTypeResolver; + $this->errorMessageConfig = $errorMessageConfig; + } + + /** + * @inheritDoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null + ) { + return [ + 'is_enabled' => $this->isEnabled(), + 'website_key' => $this->reCaptchaV3Config->getWebsiteKey(), + 'minimum_score' => $this->reCaptchaV3Config->getMinimumScore(), + 'badge_position' => $this->reCaptchaV3Config->getBadgePosition(), + 'language_code' => $this->reCaptchaV3Config->getLanguageCode(), + 'failure_message' => $this->getFailureMessage(), + 'forms' => $this->getEnumFormTypes() + ]; + } + + /** + * Get whether service has all the required settings set up to be enabled or not + * + * @return bool + * @throws InputException + */ + public function isEnabled(): bool + { + if ($this->isEnabled === null) { + $this->isEnabled = $this->reCaptchaV3Config->getValidationConfig()->getPrivateKey() && + !empty($this->reCaptchaV3Config->getWebsiteKey()) && + !empty($this->getEnumFormTypes()); + } + return $this->isEnabled; + } + + /** + * Get form keys that are configured to ReCaptcha V3 + * + * @return array + * @throws InputException + */ + private function getEnumFormTypes(): array + { + $forms = []; + if (empty($this->forms)) { + foreach ($this->reCaptchaV3Config->getFormTypes() as $formType) { + if ($this->captchaTypeResolver->getCaptchaTypeFor($formType) === self::RECAPTCHA_TYPE) { + $forms[] = $formType; + } + } + } + return array_map('strtoupper', $forms); + } + + /** + * Get configured message sent in case of failure + * + * @return string + */ + public function getFailureMessage(): string + { + if (!$this->failureMessage) { + $this->failureMessage = $this->errorMessageConfig->getValidationFailureMessage(); + } + return $this->failureMessage; + } +} diff --git a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php new file mode 100644 index 00000000..c0978cae --- /dev/null +++ b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php @@ -0,0 +1,153 @@ +<?php + +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaWebapiGraphQl\Test\Api; + +use Magento\Framework\Encryption\EncryptorInterface; +use Magento\TestFramework\Fixture\Config; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * Test recaptcha config query + */ +class ReCaptchaV3ConfigTest extends GraphQlAbstract +{ + private const QUERY = <<<QUERY +query { + recaptchaV3Config { + is_enabled + website_key + minimum_score + badge_position + language_code + failure_message + forms + } +} +QUERY; + + /** @var EncryptorInterface $encryptor */ + private $encryptor; + + /** @var \Magento\Config\Model\Config $config */ + private $config; + + public function setUp(): void + { + $this->encryptor = Bootstrap::getObjectManager()->get(EncryptorInterface::class); + $this->config = Bootstrap::getObjectManager()->get(\Magento\Config\Model\Config::class); + } + + #[ + Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75), + Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), + Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), + Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), + Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3'), + ] + public function testQueryRecaptchaNoPublicKeyConfigured(): void + { + $this->assertEquals( + [ + 'recaptchaV3Config' => [ + 'is_enabled' => false, + 'website_key' => '', + 'minimum_score' => 0.75, + 'badge_position' => 'bottomright', + 'language_code' => 'en', + 'failure_message' => 'Test failure message', + 'forms' => [ + 'CUSTOMER_LOGIN' + ] + ] + ], + $this->graphQlQuery(self::QUERY) + ); + } + + #[ + Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75), + Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), + Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), + Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), + ] + public function testQueryRecaptchaNoFormsConfigured(): void + { + $this->config->setDataByPath( + 'recaptcha_frontend/type_recaptcha_v3/public_key', + $this->encryptor->encrypt('test_public_key') + ); + $this->config->setDataByPath( + 'recaptcha_frontend/type_recaptcha_v3/private_key', + $this->encryptor->encrypt('test_private_key') + ); + + $this->config->save(); + + $this->assertEquals( + [ + 'recaptchaV3Config' => [ + 'is_enabled' => false, + 'website_key' => 'test_public_key', + 'minimum_score' => 0.75, + 'badge_position' => 'bottomright', + 'language_code' => 'en', + 'failure_message' => 'Test failure message', + 'forms' => [] + ] + ], + $this->graphQlQuery(self::QUERY) + ); + } + + #[ + Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75), + Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), + Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), + Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), + Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3'), + ] + public function testQueryRecaptchaConfigured(): void + { + $this->config->setDataByPath( + 'recaptcha_frontend/type_recaptcha_v3/public_key', + $this->encryptor->encrypt('test_public_key') + ); + $this->config->setDataByPath( + 'recaptcha_frontend/type_recaptcha_v3/private_key', + $this->encryptor->encrypt('test_private_key') + ); + + $this->config->save(); + + $this->assertEquals( + [ + 'recaptchaV3Config' => [ + 'is_enabled' => true, + 'website_key' => 'test_public_key', + 'minimum_score' => 0.75, + 'badge_position' => 'bottomright', + 'language_code' => 'en', + 'failure_message' => 'Test failure message', + 'forms' => [ + 'CUSTOMER_LOGIN' + ] + ] + ], + $this->graphQlQuery(self::QUERY) + ); + } + + public function tearDown(): void + { + $this->config->unsetData('recaptcha_frontend/type_recaptcha_v3/public_key'); + $this->config->unsetData('recaptcha_frontend/type_recaptcha_v3/private_key'); + $this->config->save(); + } +} diff --git a/ReCaptchaWebapiGraphQl/composer.json b/ReCaptchaWebapiGraphQl/composer.json index a93b5b80..67f04e53 100644 --- a/ReCaptchaWebapiGraphQl/composer.json +++ b/ReCaptchaWebapiGraphQl/composer.json @@ -5,6 +5,8 @@ "php": "~8.1.0||~8.2.0", "magento/framework": "*", "magento/module-authorization": "*", + "magento/module-re-captcha-frontend-ui": "*", + "magento/module-re-captcha-version-3-invisible": "*", "magento/module-re-captcha-validation-api": "*", "magento/module-re-captcha-webapi-api": "*" }, diff --git a/ReCaptchaWebapiGraphQl/etc/schema.graphqls b/ReCaptchaWebapiGraphQl/etc/schema.graphqls new file mode 100644 index 00000000..63e152fa --- /dev/null +++ b/ReCaptchaWebapiGraphQl/etc/schema.graphqls @@ -0,0 +1,29 @@ +# Copyright © Magento, Inc. All rights reserved. +# See COPYING.txt for license details. + +type Query { + recaptchaV3Config: ReCaptchaConfigurationV3 @resolver(class: "Magento\\ReCaptchaWebapiGraphQl\\Model\\Resolver\\ReCaptchaV3") @doc(description: "Returns details about Google reCAPTCHA V3-Invisible configuration.") +} + +enum ReCaptchaFormEnum { + PLACE_ORDER + CONTACT + CUSTOMER_LOGIN + CUSTOMER_FORGOT_PASSWORD + CUSTOMER_CREATE + CUSTOMER_EDIT + NEWSLETTER + PRODUCT_REVIEW + SENDFRIEND + BRAINTREE +} + +type ReCaptchaConfigurationV3 @doc(description: "Contains reCAPTCHA V3-Invisible configuration details.") { + is_enabled: Boolean! @doc(description: "Return whether recaptcha is enabled or not") + website_key: String! @doc(description: "The website key generated when the Google reCAPTCHA account was registered.") + minimum_score: Float! @doc(description: "The minimum score that identifies a user interaction as a potential risk.") + badge_position: String! @doc(description: "The position of the invisible reCAPTCHA badge on each page.") + language_code: String @doc(description: "A two-character code that specifies the language that is used for Google reCAPTCHA text and messaging.") + failure_message: String! @doc(description: "The message that appears to the user if validation fails.") + forms: [ReCaptchaFormEnum!]! @doc(description: "A list of forms on the storefront that have been configured to use reCAPTCHA V3.") +} From 5ba2c8ef153d3579164e23cbd004943681ebb59b Mon Sep 17 00:00:00 2001 From: Dmytro Shevtsov <shevtsov@adobe.com> Date: Wed, 15 Mar 2023 17:34:49 -0500 Subject: [PATCH 072/208] Fix Markdown formatting in docs --- README.md | 2 +- ReCaptchaCheckoutSalesRule/README.md | 2 +- ReCaptchaUser/README.md | 1 - Securitytxt/README.md | 9 ++++++--- _metapackage/README.md | 1 - 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 48c6df95..1832a33c 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Welcome to the Magento Security Package community project! ## Overview Magento security package provides a set of security-related features including two-factor authentication for admins, Google ReCAPTCHA support for various forms, and Security.txt to support vulnerability -disclosure practices. +disclosure practices. ## Documentation diff --git a/ReCaptchaCheckoutSalesRule/README.md b/ReCaptchaCheckoutSalesRule/README.md index 3898b6fd..469f5ec6 100644 --- a/ReCaptchaCheckoutSalesRule/README.md +++ b/ReCaptchaCheckoutSalesRule/README.md @@ -3,4 +3,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to coupon code apply action on checkout cart & payment. -For more information please visit the Magento document for reCAPTCHA. \ No newline at end of file +For more information please visit the Magento document for reCAPTCHA. diff --git a/ReCaptchaUser/README.md b/ReCaptchaUser/README.md index f3319e7b..5bf8739b 100644 --- a/ReCaptchaUser/README.md +++ b/ReCaptchaUser/README.md @@ -6,7 +6,6 @@ This module provides the reCAPTCHA implementations related to user actions. For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). - ## Emergency commandline disable for Admin panel Login page: Can disable Google reCAPTCHA for Admin Panel Login page from command-line: diff --git a/Securitytxt/README.md b/Securitytxt/README.md index c4fd8c2d..9564eaf1 100644 --- a/Securitytxt/README.md +++ b/Securitytxt/README.md @@ -1,18 +1,20 @@ # Security.txt ### Summary +> > When security vulnerabilities are discovered by researchers, proper reporting channels are often lacking. As a result, vulnerabilities may be left unreported. This document defines a format ("security.txt") to help organizations describe their vulnerability disclosure practices to make it easier for researchers to report vulnerabilities. Source: https://tools.ietf.org/html/draft-foudil-securitytxt-09 -The Magento_Securitytxt module provides the following functionality: +The Magento_Securitytxt module provides the following functionality: + * allows to save the security configurations in the admin panel * contains a router to match application action class for requests to the `.well-known/security.txt` and `.well-known/security.txt.sig` files. * serves the content of the `.well-known/security.txt` and `.well-known/security.txt.sig` files. A valid security.txt file could look like the following example: -``` +```txt Contact: mailto:security@example.com Contact: tel:+1-201-555-0123 Encryption: https://example.com/pgp.asc @@ -20,6 +22,7 @@ Acknowledgement: https://example.com/security/hall-of-fame Policy: https://example.com/security-policy.html Signature: https://example.com/.well-known/security.txt.sig ``` + Security.txt can be accessed at below location: `https://example.com/.well-known/security.txt` @@ -29,4 +32,4 @@ To create security.txt signature (security.txt.sig) file: To verify the security.txt file's signature: -`gpg --verify security.txt.sig security.txt` \ No newline at end of file +`gpg --verify security.txt.sig security.txt` diff --git a/_metapackage/README.md b/_metapackage/README.md index 23b0bbfe..0b4fb3bd 100644 --- a/_metapackage/README.md +++ b/_metapackage/README.md @@ -1,2 +1 @@ # Magento_SecurityPackage - From 41060e9f72b9ec94ff5e051682b84a91f78b896f Mon Sep 17 00:00:00 2001 From: Andrii Dimov <andimov@gmail.com> Date: Mon, 29 May 2023 14:23:04 -0500 Subject: [PATCH 073/208] ACPT-1344: Fix ReCaptcha WebApi GraphQL tests on Application Server --- ReCaptchaVersion3Invisible/Model/Config.php | 12 +++++++++++- .../Model/Resolver/ReCaptchaV3.php | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ReCaptchaVersion3Invisible/Model/Config.php b/ReCaptchaVersion3Invisible/Model/Config.php index a394f5b1..07285a6b 100644 --- a/ReCaptchaVersion3Invisible/Model/Config.php +++ b/ReCaptchaVersion3Invisible/Model/Config.php @@ -8,11 +8,12 @@ namespace Magento\ReCaptchaVersion3Invisible\Model; +use Magento\Framework\ObjectManager\ResetAfterRequestInterface; use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; use Magento\ReCaptchaVersion3Invisible\Model\Frontend\UiConfigProvider; use Magento\ReCaptchaVersion3Invisible\Model\Frontend\ValidationConfigProvider; -class Config +class Config implements ResetAfterRequestInterface { /** * @var string|null @@ -161,4 +162,13 @@ private function getUiConfig(): array } return $this->uiConfig; } + + /** + * @inheritDoc + */ + public function _resetState(): void + { + $this->websiteKey = null; + $this->uiConfig = []; + } } diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php index 5abc02bc..a014f0fc 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -12,11 +12,12 @@ use Magento\Framework\GraphQl\Config\Element\Field; use Magento\Framework\GraphQl\Query\ResolverInterface; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Framework\ObjectManager\ResetAfterRequestInterface; use Magento\ReCaptchaFrontendUi\Model\CaptchaTypeResolver; use Magento\ReCaptchaFrontendUi\Model\ErrorMessageConfig; use Magento\ReCaptchaVersion3Invisible\Model\Config; -class ReCaptchaV3 implements ResolverInterface +class ReCaptchaV3 implements ResolverInterface, ResetAfterRequestInterface { private const RECAPTCHA_TYPE = 'recaptcha_v3'; @@ -128,4 +129,12 @@ public function getFailureMessage(): string } return $this->failureMessage; } + + /** + * @inheritDoc + */ + public function _resetState(): void + { + $this->isEnabled = null; + } } From bd8ef8ec3162aeb5c4150177774084c5479052e7 Mon Sep 17 00:00:00 2001 From: Andrii Dimov <andimov@gmail.com> Date: Mon, 29 May 2023 16:26:11 -0500 Subject: [PATCH 074/208] ACPT-1344: Fix ReCaptcha WebApi GraphQL tests on Application Server --- ReCaptchaVersion3Invisible/Model/Config.php | 1 + 1 file changed, 1 insertion(+) diff --git a/ReCaptchaVersion3Invisible/Model/Config.php b/ReCaptchaVersion3Invisible/Model/Config.php index 07285a6b..71b99327 100644 --- a/ReCaptchaVersion3Invisible/Model/Config.php +++ b/ReCaptchaVersion3Invisible/Model/Config.php @@ -170,5 +170,6 @@ public function _resetState(): void { $this->websiteKey = null; $this->uiConfig = []; + $this->validationConfig = null; } } From cceea8e28d7e5bc601618156a2e95856b56f36e7 Mon Sep 17 00:00:00 2001 From: Jacob Brown <jacob@gnu.org> Date: Thu, 8 Jun 2023 15:54:14 -0500 Subject: [PATCH 075/208] ACPT-1360 Fixing resetState methods so that the object's state is the same as it was when first constructed --- ReCaptchaVersion3Invisible/Model/Config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaVersion3Invisible/Model/Config.php b/ReCaptchaVersion3Invisible/Model/Config.php index 71b99327..8a517506 100644 --- a/ReCaptchaVersion3Invisible/Model/Config.php +++ b/ReCaptchaVersion3Invisible/Model/Config.php @@ -43,7 +43,7 @@ class Config implements ResetAfterRequestInterface /** * @var array */ - private array $uiConfig; + private array $uiConfig = []; /** * @var ValidationConfigProvider From 330a07119c5b075921677a654fa41c2ac6b2bfc5 Mon Sep 17 00:00:00 2001 From: Oleksandr Dubovyk <odubovyk@adobe.com> Date: Wed, 21 Jun 2023 12:34:33 -0500 Subject: [PATCH 076/208] ACP2E-1998: [Cloud] Suspicious Reviews Submitted via a Bot with Recaptcha v3 Invisible enabled - fix --- ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index 43c476ec..1f4bf90e 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -160,6 +160,13 @@ define( grecaptcha.execute(widgetId); event.preventDefault(event); event.stopImmediatePropagation(); + if (this.$parentForm.valid()) { + let formSubmitButton = this.$parentForm.find('button:not([type]), [type=submit]'); + + if (formSubmitButton.length) { //eslint-disable-line max-depth + formSubmitButton.attr('disabled', true); + } + } } }.bind(this)); From aebe930b8d457f4ab71f7045de74d2f423493ebe Mon Sep 17 00:00:00 2001 From: Nathan Smith <nathsmit@adobe.com> Date: Thu, 31 Aug 2023 09:53:16 -0500 Subject: [PATCH 077/208] AC-9437: 2FA U2F screens need error handling when not available --- TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js | 4 ++++ TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js | 4 ++++ TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html | 4 ++++ .../view/adminhtml/web/template/u2fkey/configure.html | 4 ++++ 4 files changed, 16 insertions(+) diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js index 6707c2dd..3c0a9285 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js @@ -84,6 +84,10 @@ define([ */ waitForTouch: function () { this.idle(false); + if (!navigator.credentials) { + this.currentStep("no-webauthn"); + return; + } navigator.credentials.get({ publicKey: this.authenticateData.credentialRequestOptions }) diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js index c5b7cc1e..db12c9a5 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js @@ -78,6 +78,10 @@ define([ */ waitForTouch: function () { this.idle(false); + if (!navigator.credentials) { + this.currentStep("no-webauthn"); + return; + } navigator.credentials.create({ publicKey: this.registerData.publicKey }) diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html index c43ea6a7..adbd59af 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html @@ -27,6 +27,10 @@ <h3 translate="'Plug in your U2F key and follow instructions'"></h3> </div> <div translate="'Redirecting to Magento Admin Panel...'"></div> </div> + <div visible='currentStep() === "no-webauthn"' + translate="'Error! Your browser does not support WebAuthn or you are not using a secure connection'" + > + </div> <div visible='$data.loading' class="tfa-waitbox"> <div data-role="spinner"> <div class="spinner"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html index d5edcdd5..7e80f044 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html @@ -27,6 +27,10 @@ <h3 translate="'Plug in your U2F key and follow instructions'"></h3> </div> <div translate="'Redirecting to Magento Admin Panel...'"></div> </div> + <div visible='currentStep() === "no-webauthn"' + translate="'Error! Your browser does not support WebAuthn or you are not using a secure connection'" + > + </div> <div visible='$data.loading' class="tfa-waitbox"> <div data-role="spinner"> <div class="spinner"> From 34754251b9bef41b350f8aacb7f9be5790515dc9 Mon Sep 17 00:00:00 2001 From: Nathan Smith <nathsmit@adobe.com> Date: Thu, 31 Aug 2023 12:40:59 -0500 Subject: [PATCH 078/208] AC-9437: 2FA U2F screens need error handling when not available Static test fixes --- TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js | 2 +- TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js | 2 +- TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html | 2 +- TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js index 3c0a9285..4eba1c3f 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js @@ -85,7 +85,7 @@ define([ waitForTouch: function () { this.idle(false); if (!navigator.credentials) { - this.currentStep("no-webauthn"); + this.currentStep('no-webauthn'); return; } navigator.credentials.get({ diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js index db12c9a5..f94d8310 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js @@ -79,7 +79,7 @@ define([ waitForTouch: function () { this.idle(false); if (!navigator.credentials) { - this.currentStep("no-webauthn"); + this.currentStep('no-webauthn'); return; } navigator.credentials.create({ diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html index adbd59af..621d3f9c 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html @@ -9,7 +9,7 @@ <fieldset class="admin__fieldset"> <legend class="admin__legend"> <span translate="'2FA - U2F key verification'"></span> - </legend><br/> + </legend><br> <div class="tfa-u2f-touch-key"> <h3 translate="'Plug in your U2F key and follow instructions'"></h3> <div visible="$data.idle" class="tfa-u2f-try-again"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html index 7e80f044..be297a64 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html @@ -9,7 +9,7 @@ <fieldset class="admin__fieldset"> <legend class="admin__legend"> <span translate="'2FA - U2F key device registration'"></span> - </legend><br/> + </legend><br> <div id="u2f-touch-key"> <h3 translate="'Plug in your U2F key and follow instructions'"></h3> <div visible="$data.idle" class="tfa-u2f-try-again"> From 7211dc9525b0753c4f07aa98664d5b00cb26a19a Mon Sep 17 00:00:00 2001 From: Nathan Smith <nathsmit@adobe.com> Date: Thu, 14 Sep 2023 10:39:27 -0500 Subject: [PATCH 079/208] AC-9437: 2FA U2F screens need error handling when not available Changed error handling to show the raw WebAuthn message because the browser does not provide a consistent mechanism to differentiate between NotAllowError types. These errors can range from auth timeout to TLS errors or even just user declining the browser prompts. --- TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js | 4 ++-- TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js index 4eba1c3f..fe96e0f9 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js @@ -162,8 +162,8 @@ define([ _onCredentialError: function (u2fError) { this.idle(true); - if (['AbortError', 'NS_ERROR_ABORT', 'NotAllowedError'].indexOf(u2fError.name) === -1) { - error.display($t('Unable to register your device')); + if (['AbortError', 'NS_ERROR_ABORT'].indexOf(u2fError.name) === -1) { + error.display($t(u2fError.message)); } } }); diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js index f94d8310..81838d1f 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js @@ -154,8 +154,8 @@ define([ _onCredentialError: function (u2fError) { this.idle(true); - if (['AbortError', 'NS_ERROR_ABORT', 'NotAllowedError'].indexOf(u2fError.name) === -1) { - error.display($t('Unable to register your device')); + if (['AbortError', 'NS_ERROR_ABORT'].indexOf(u2fError.name) === -1) { + error.display($t(u2fError.message)); } } }); From b7c84c7500b7e55e356a4699ee980b89e640fa94 Mon Sep 17 00:00:00 2001 From: Kevin Kozan <kkozan@magento.com> Date: Fri, 15 Sep 2023 11:17:50 -0500 Subject: [PATCH 080/208] ACQE-5379: Create Allow-List for MFTF module-dependency failures - Create files --- ReCaptchaUser/Test/Mftf/test-dependency-allowlist | 2 ++ ReCaptchaUser/Test/Mftf/test-dependency-errors-detailed | 6 ++++++ 2 files changed, 8 insertions(+) create mode 100644 ReCaptchaUser/Test/Mftf/test-dependency-allowlist create mode 100644 ReCaptchaUser/Test/Mftf/test-dependency-errors-detailed diff --git a/ReCaptchaUser/Test/Mftf/test-dependency-allowlist b/ReCaptchaUser/Test/Mftf/test-dependency-allowlist new file mode 100644 index 00000000..22d50ad2 --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/test-dependency-allowlist @@ -0,0 +1,2 @@ +AdminLoginActionGroup +AdminLogoutActionGroup diff --git a/ReCaptchaUser/Test/Mftf/test-dependency-errors-detailed b/ReCaptchaUser/Test/Mftf/test-dependency-errors-detailed new file mode 100644 index 00000000..e078c2bc --- /dev/null +++ b/ReCaptchaUser/Test/Mftf/test-dependency-errors-detailed @@ -0,0 +1,6 @@ + +File "/var/www/html/app/code/Magento/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml" +contains entity references that violate dependency constraints: + + AdminLoginActionGroup from module(s): magento/module-admin-analytics, magento/module-backend, magento/module-two-factor-auth + AdminLogoutActionGroup from module(s): magento/module-backend From 173737c733757c9e1ba5732bb23e7c0be34098cd Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@adobe.com> Date: Mon, 2 Oct 2023 10:07:45 -0500 Subject: [PATCH 081/208] [B2B-3098]: MFTF - Adding 2FA merge test --- .../Test/AdminACLRuleManageCompaniesTest.xml | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml new file mode 100644 index 00000000..eed783c2 --- /dev/null +++ b/TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminACLRuleManageCompaniesTest"> + <annotations> + <stories value="ACL"/> + <title value="Verify Admin Users Cannot Perform Actions without Manage Companies ACL Rule"/> + <description value="This test verifies that admin users without the Manage Companies ACL rule cannot create + a company, cannot perform any of the bulk grid actions from the Companies index page, and cannot save, + reset, or delete a company from the Company Edit Page."/> + <severity value="BLOCKER"/> + <testCaseId value="B2B-3141"/> + </annotations> + <before> + <actionGroup ref="AdminChooseUserRoleResourceActionGroup" before="saveRole" stepKey="enableTfa"> + <argument name="resourceId" value="Magento_TwoFactorAuth::tfa"/> + <argument name="resourceName" value="Two Factor Auth"/> + </actionGroup> + </before> + </test> +</tests> From a66c4387262439d539d36622a7ec1b13a1dc39ae Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@adobe.com> Date: Mon, 2 Oct 2023 10:42:06 -0500 Subject: [PATCH 082/208] [B2B-3098]: MFTF - Adding copyrights - Adding steps to AdminSaveUserRoleActionGroup in 2FA --- .../AdminSaveUserRoleActionGroup.xml | 30 +++++++++++++++++++ .../Test/AdminACLRuleManageCompaniesTest.xml | 27 ----------------- 2 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml delete mode 100644 TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml new file mode 100644 index 00000000..4987883c --- /dev/null +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** +* ADOBE CONFIDENTIAL +* +* Copyright 2023 Adobe +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains +* the property of Adobe and its suppliers, if any. The intellectual +* and technical concepts contained herein are proprietary to Adobe +* and its suppliers and are protected by all applicable intellectual +* property laws, including trade secret and copyright laws. +* Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained +* from Adobe. +*/ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSaveUserRoleActionGroup"> + <annotations> + <description>Merges with CE actionGroup. Adds steps to enable the 2FA ACL rule when creating a User Role.</description> + </annotations> + <waitForElementVisible selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink('Magento_TwoFactorAuth::tfa', 'Two Factor Auth')}}" stepKey="waitForResourceCheckboxVisible" before="checkResource"/> + <click selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink('Magento_TwoFactorAuth::tfa', 'Two Factor Auth')}}" stepKey="checkResource" before="seeCheckedResource"/> + <seeElement selector="{{AdminEditRoleResourcesSection.resourceCheckbox('Magento_TwoFactorAuth::tfa')}}" stepKey="seeCheckedResource" before="clickSaveRoleButton"/> + </actionGroup> +</actionGroups> diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml deleted file mode 100644 index eed783c2..00000000 --- a/TwoFactorAuth/Test/Mftf/Test/AdminACLRuleManageCompaniesTest.xml +++ /dev/null @@ -1,27 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ ---> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> - <test name="AdminACLRuleManageCompaniesTest"> - <annotations> - <stories value="ACL"/> - <title value="Verify Admin Users Cannot Perform Actions without Manage Companies ACL Rule"/> - <description value="This test verifies that admin users without the Manage Companies ACL rule cannot create - a company, cannot perform any of the bulk grid actions from the Companies index page, and cannot save, - reset, or delete a company from the Company Edit Page."/> - <severity value="BLOCKER"/> - <testCaseId value="B2B-3141"/> - </annotations> - <before> - <actionGroup ref="AdminChooseUserRoleResourceActionGroup" before="saveRole" stepKey="enableTfa"> - <argument name="resourceId" value="Magento_TwoFactorAuth::tfa"/> - <argument name="resourceName" value="Two Factor Auth"/> - </actionGroup> - </before> - </test> -</tests> From cde1785b19f217aabf9847c1a7eed2f9bdb63d60 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@adobe.com> Date: Mon, 2 Oct 2023 12:05:38 -0500 Subject: [PATCH 083/208] [B2B-3098]: MFTF - Fixing 2FA failures --- .../Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml | 5 +---- TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml index 0b1740d0..b7d31a8d 100644 --- a/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml @@ -8,10 +8,7 @@ <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminReviewOrderWithReportsPermissionTest"> <before> - <actionGroup ref="AdminChooseUserRoleResourceActionGroup" before="saveRole" stepKey="enableTfa"> - <argument name="resourceId" value="Magento_TwoFactorAuth::tfa"/> - <argument name="resourceName" value="Two Factor Auth"/> - </actionGroup> + <comment userInput="BIC workaround" before="saveRole" stepKey="enableTfa"/> </before> </test> </tests> diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml index d07e2b46..8404b4d0 100644 --- a/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml @@ -15,10 +15,7 @@ <severity value="AVERAGE"/> </annotations> <before> - <actionGroup ref="AdminChooseUserRoleResourceActionGroup" before="saveNewRole" stepKey="enableTfa"> - <argument name="resourceId" value="Magento_TwoFactorAuth::tfa"/> - <argument name="resourceName" value="Two Factor Auth"/> - </actionGroup> + <comment userInput="BIC workaround" before="saveNewRole" stepKey="enableTfa"/> </before> </test> </tests> From 02c13f0772ca933f1f227289daa2cdaa29aadc61 Mon Sep 17 00:00:00 2001 From: David Haecker <dhaecker@adobe.com> Date: Mon, 2 Oct 2023 12:23:26 -0500 Subject: [PATCH 084/208] [B2B-3098]: MFTF - Changing AdminSaveUserRoleActionGroup for 2FA to use conditionalClick --- .../Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml index 4987883c..1d78e661 100644 --- a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml @@ -23,8 +23,8 @@ <annotations> <description>Merges with CE actionGroup. Adds steps to enable the 2FA ACL rule when creating a User Role.</description> </annotations> - <waitForElementVisible selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink('Magento_TwoFactorAuth::tfa', 'Two Factor Auth')}}" stepKey="waitForResourceCheckboxVisible" before="checkResource"/> - <click selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink('Magento_TwoFactorAuth::tfa', 'Two Factor Auth')}}" stepKey="checkResource" before="seeCheckedResource"/> - <seeElement selector="{{AdminEditRoleResourcesSection.resourceCheckbox('Magento_TwoFactorAuth::tfa')}}" stepKey="seeCheckedResource" before="clickSaveRoleButton"/> + <waitForElementVisible selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink('Magento_TwoFactorAuth::tfa', 'Two Factor Auth')}}" stepKey="waitFor2FACheckboxVisible" before="check2FAIfNotAlreadyChecked"/> + <conditionalClick selector="{{AdminEditRoleResourcesSection.resourceCheckboxLink('Magento_TwoFactorAuth::tfa', 'Two Factor Auth')}}" dependentSelector="{{AdminEditRoleResourcesSection.resourceCheckbox('Magento_TwoFactorAuth::tfa')}}" visible="false" stepKey="check2FAIfNotAlreadyChecked" before="see2FAChecked"/> + <seeElement selector="{{AdminEditRoleResourcesSection.resourceCheckbox('Magento_TwoFactorAuth::tfa')}}" stepKey="see2FAChecked" before="clickSaveRoleButton"/> </actionGroup> </actionGroups> From 9bca32650345ffa5c9edf30ea5da6c7d10b5fb3c Mon Sep 17 00:00:00 2001 From: Dmytro Shevtsov <shevtsov@adobe.com> Date: Thu, 12 Oct 2023 14:52:30 -0500 Subject: [PATCH 085/208] Minor docs fixes Replacing old devdocs links. Fixing Markdown formatting. --- .github/CONTRIBUTING.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 066375e5..9bf275de 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -19,11 +19,11 @@ For more detailed information on contribution please read our [beginners guide]( 2. Pull requests (PRs) must be accompanied by a meaningful description of their purpose. Comprehensive descriptions increase the chances of a pull request being merged quickly and without additional clarification requests. 3. Commits must be accompanied by meaningful commit messages. Please see the [Magento Pull Request Template](https://github.com/magento/magento2/blob/2.3-develop/.github/PULL_REQUEST_TEMPLATE.md) for more information. 4. PRs which include bug fixes must be accompanied with a step-by-step description of how to reproduce the bug. -3. PRs which include new logic or new features must be submitted along with: -* Unit/integration test coverage -* Proposed [documentation](https://devdocs.magento.com) updates. Documentation contributions can be submitted via the [devdocs GitHub](https://github.com/magento/devdocs). -4. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input. -5. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green). +5. PRs which include new logic or new features must be submitted along with: + * Unit/integration test coverage + * Proposed [documentation](https://developer.adobe.com/commerce) updates. Use feedback buttons __Edit in GitHub__ and __Log an issue__ at the top of a relevant topic. +6. For larger features or changes, please [open an issue](https://github.com/magento/magento2/issues) to discuss the proposed changes prior to development. This may prevent duplicate or unnecessary effort and allow other contributors to provide input. +7. All automated tests must pass (all builds on [Travis CI](https://travis-ci.org/magento/magento2) must be green). ## Contribution process From 38a6fd04b4a8769cae558fb897505dfa10b9968e Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 30 Oct 2023 13:26:40 -0500 Subject: [PATCH 086/208] ACP2E-2509: JS errors on login form when re-captcha enabled --- .../view/frontend/web/js/reCaptcha.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index 1f4bf90e..4fdca404 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -73,8 +73,14 @@ define( * @param {String} token */ reCaptchaCallback: function (token) { + var submitButton; + if (this.getIsInvisibleRecaptcha()) { this.tokenField.value = token; + submitButton = this.$parentForm.find('button:not([type]), [type=submit]'); + if (submitButton.length) { //eslint-disable-line max-depth + submitButton.attr('disabled', false); + } this.$parentForm.submit(); } }, @@ -155,18 +161,17 @@ define( if (this.getIsInvisibleRecaptcha() && parentForm.length > 0) { parentForm.submit(function (event) { + var submitButton; + if (!this.tokenField.value) { + submitButton = this.$parentForm.find('button:not([type]), [type=submit]'); + if (submitButton.length) { //eslint-disable-line max-depth + submitButton.attr('disabled', true); + } // eslint-disable-next-line no-undef grecaptcha.execute(widgetId); event.preventDefault(event); event.stopImmediatePropagation(); - if (this.$parentForm.valid()) { - let formSubmitButton = this.$parentForm.find('button:not([type]), [type=submit]'); - - if (formSubmitButton.length) { //eslint-disable-line max-depth - formSubmitButton.attr('disabled', true); - } - } } }.bind(this)); From 285d829622d3bacb08c24a660ebc89696e701383 Mon Sep 17 00:00:00 2001 From: soumah <soumah@adobe.com> Date: Mon, 30 Oct 2023 17:32:54 -0500 Subject: [PATCH 087/208] ACP2E-2509: JS errors on login form when re-captcha enabled - Added test coverage --- .../frontend/js/reCaptcha.test.js | 134 ++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js new file mode 100644 index 00000000..63a51622 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js @@ -0,0 +1,134 @@ +/************************************************************************ + * + * Copyright 2023 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + * ************************************************************************ + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'squire' +], function (Squire) { + 'use strict'; + + var injector = new Squire(), + mocks = { + 'Magento_ReCaptchaFrontendUi/js/registry': { + ds: [], + captchaList: [], + tokenFields: [] + }, + 'Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader': { + addReCaptchaScriptTag: jasmine.createSpy('reCaptchaScriptLoader.addReCaptchaScriptTag') + }, + 'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer': { + add: jasmine.createSpy('nonInlineReCaptchaRenderer.add') + } + }, + reCaptchaModel, + formElement, + submitButtonElement, + $; + + beforeEach(function (done) { + injector.mock(mocks); + injector.require(['jquery', 'Magento_ReCaptchaFrontendUi/js/reCaptcha'], function (jq, reCaptchaUiComponent) { + reCaptchaModel = new reCaptchaUiComponent(); + $ = jq; + done(); + }); + formElement = document.createElement('form'); + submitButtonElement = document.createElement('button'); + formElement.appendChild(submitButtonElement); + window.document.body.appendChild(formElement); + window.grecaptcha = { + render: jasmine.createSpy('window.grecaptcha.render'), + execute: jasmine.createSpy('window.grecaptcha.execute') + }; + }); + + afterEach(function () { + try { + injector.clean(); + injector.remove(); + } catch (e) { + } + formElement.remove(); + formElement = undefined; + submitButtonElement = undefined; + }); + + describe('Magento_ReCaptchaFrontendUi/js/reCaptcha', function () { + describe('Invisible ReCaptcha', function () { + beforeEach(function () { + reCaptchaModel.getIsInvisibleRecaptcha = jasmine.createSpy().and.returnValue(true); + }); + + describe('"initParentForm" method', function () { + it( + 'should disable submit button, prevent submit handlers from executing and execute recaptcha' + + ' on submit', + function () { + var request = { + send: jasmine.createSpy('request.send') + }; + + // check that submit button is enabled + expect(submitButtonElement.disabled).toBeFalse(); + $(formElement).on('submit', function (event) { + event.preventDefault(); + request.send(); + }); + reCaptchaModel.initParentForm($(formElement), 'test'); + $(formElement).submit(); + // check that submit button is disabled + expect(submitButtonElement.disabled).toBeTrue(); + // check that grecaptcha is executed + expect(window.grecaptcha.execute).toHaveBeenCalledOnceWith('test'); + // check that other submit handlers are not executed + expect(request.send).not.toHaveBeenCalled(); + }); + + it('should add a token input field to the form', function () { + submitButtonElement.disabled = true; + reCaptchaModel.initParentForm($(formElement), 'test'); + expect(submitButtonElement.disabled).toBeFalse(); + expect(reCaptchaModel.tokenField).not.toBeNull(); + expect($(reCaptchaModel.tokenField).parents('form').is($(formElement))).toBeTrue(); + }); + }); + describe('"reCaptchaCallback" method', function () { + it('should enable submit button, set token input value and submit the form', function () { + var request = { + send: jasmine.createSpy('request.send') + }; + + submitButtonElement.disabled = true; + reCaptchaModel.$parentForm = $(formElement); + reCaptchaModel.tokenField = $('<input type="text" name="token" style="display: none" />')[0]; + + $(formElement).on('submit', function (event) { + event.preventDefault(); + request.send(); + }); + reCaptchaModel.reCaptchaCallback('testtoken'); + // check that submit button is enabled + expect(submitButtonElement.disabled).toBeFalse(); + // check that token input value is set + expect(reCaptchaModel.tokenField.value).toEqual('testtoken'); + // check that form is submitted + expect(request.send).toHaveBeenCalled(); + }); + }); + }); + }); +}); From 9871478b1ea85fca7ae3bde6a7eeea01a4beecad Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Thu, 16 Nov 2023 12:04:58 +0530 Subject: [PATCH 088/208] AC-10570::Adobe Commerce 2.4.7 core code is compatible with PHP 8.3 --- ReCaptchaAdminUi/composer.json | 2 +- ReCaptchaCheckout/composer.json | 2 +- ReCaptchaCheckoutSalesRule/composer.json | 2 +- ReCaptchaContact/composer.json | 2 +- ReCaptchaCustomer/composer.json | 2 +- ReCaptchaFrontendUi/composer.json | 2 +- ReCaptchaMigration/composer.json | 2 +- ReCaptchaNewsletter/composer.json | 2 +- ReCaptchaPaypal/composer.json | 2 +- ReCaptchaReview/composer.json | 2 +- ReCaptchaSendFriend/composer.json | 2 +- ReCaptchaStorePickup/composer.json | 2 +- ReCaptchaUi/composer.json | 2 +- ReCaptchaUser/composer.json | 2 +- ReCaptchaValidation/composer.json | 2 +- ReCaptchaValidationApi/composer.json | 2 +- ReCaptchaVersion2Checkbox/composer.json | 2 +- ReCaptchaVersion2Invisible/composer.json | 2 +- ReCaptchaVersion3Invisible/composer.json | 2 +- ReCaptchaWebapiApi/composer.json | 2 +- ReCaptchaWebapiGraphQl/composer.json | 2 +- ReCaptchaWebapiRest/composer.json | 2 +- ReCaptchaWebapiUi/composer.json | 2 +- Securitytxt/composer.json | 2 +- TwoFactorAuth/composer.json | 2 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ReCaptchaAdminUi/composer.json b/ReCaptchaAdminUi/composer.json index 8ab7667a..d37ce494 100644 --- a/ReCaptchaAdminUi/composer.json +++ b/ReCaptchaAdminUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-admin-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckout/composer.json b/ReCaptchaCheckout/composer.json index 523b84b0..fd5d1240 100644 --- a/ReCaptchaCheckout/composer.json +++ b/ReCaptchaCheckout/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckoutSalesRule/composer.json b/ReCaptchaCheckoutSalesRule/composer.json index 69efca85..3d66f93c 100644 --- a/ReCaptchaCheckoutSalesRule/composer.json +++ b/ReCaptchaCheckoutSalesRule/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout-sales-rule", "description": "Google ReCaptcha integration for Magento2 coupons", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-sales-rule": "*", diff --git a/ReCaptchaContact/composer.json b/ReCaptchaContact/composer.json index d5e2ebfd..6c8f9ae9 100644 --- a/ReCaptchaContact/composer.json +++ b/ReCaptchaContact/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-contact", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*" }, diff --git a/ReCaptchaCustomer/composer.json b/ReCaptchaCustomer/composer.json index f88849d6..065d3183 100644 --- a/ReCaptchaCustomer/composer.json +++ b/ReCaptchaCustomer/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-customer", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-customer": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaFrontendUi/composer.json b/ReCaptchaFrontendUi/composer.json index 4f8a3e3b..78cdd6a9 100644 --- a/ReCaptchaFrontendUi/composer.json +++ b/ReCaptchaFrontendUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-frontend-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaMigration/composer.json b/ReCaptchaMigration/composer.json index a03184aa..81504bcb 100644 --- a/ReCaptchaMigration/composer.json +++ b/ReCaptchaMigration/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-migration", "description": "Google reCAPTCHA config migration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-config": "*" }, diff --git a/ReCaptchaNewsletter/composer.json b/ReCaptchaNewsletter/composer.json index fe6407bc..687a9cef 100644 --- a/ReCaptchaNewsletter/composer.json +++ b/ReCaptchaNewsletter/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-newsletter", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index 0410e45c..e6373715 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-paypal", "description": "Google reCaptcha integration for Magento2 PayPal PayflowPro payment form", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaReview/composer.json b/ReCaptchaReview/composer.json index 168f3e32..628da4f6 100644 --- a/ReCaptchaReview/composer.json +++ b/ReCaptchaReview/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-review", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaSendFriend/composer.json b/ReCaptchaSendFriend/composer.json index 9380756c..10845103 100644 --- a/ReCaptchaSendFriend/composer.json +++ b/ReCaptchaSendFriend/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-send-friend", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaStorePickup/composer.json b/ReCaptchaStorePickup/composer.json index d06bb6e5..9858c213 100644 --- a/ReCaptchaStorePickup/composer.json +++ b/ReCaptchaStorePickup/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-store-pickup", "description": "Google reCaptcha integration for Magento2 Inventory Store Pickup shipping form", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaUi/composer.json b/ReCaptchaUi/composer.json index 377c3548..e49c14bc 100644 --- a/ReCaptchaUi/composer.json +++ b/ReCaptchaUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaUser/composer.json b/ReCaptchaUser/composer.json index f3868767..8d71f56f 100644 --- a/ReCaptchaUser/composer.json +++ b/ReCaptchaUser/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-user", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*" diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index 24d29067..cf1422d6 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", "google/recaptcha": "^1.2" diff --git a/ReCaptchaValidationApi/composer.json b/ReCaptchaValidationApi/composer.json index 4ab30430..46bce41c 100644 --- a/ReCaptchaValidationApi/composer.json +++ b/ReCaptchaValidationApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*" }, "type": "magento2-module", diff --git a/ReCaptchaVersion2Checkbox/composer.json b/ReCaptchaVersion2Checkbox/composer.json index 6b5dd7e7..5ef3ef87 100644 --- a/ReCaptchaVersion2Checkbox/composer.json +++ b/ReCaptchaVersion2Checkbox/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-checkbox", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion2Invisible/composer.json b/ReCaptchaVersion2Invisible/composer.json index 35901d54..afff926e 100644 --- a/ReCaptchaVersion2Invisible/composer.json +++ b/ReCaptchaVersion2Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion3Invisible/composer.json b/ReCaptchaVersion3Invisible/composer.json index d6f96f9e..f0da1871 100644 --- a/ReCaptchaVersion3Invisible/composer.json +++ b/ReCaptchaVersion3Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-3-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaWebapiApi/composer.json b/ReCaptchaWebapiApi/composer.json index 1abd1d3c..e9933c44 100644 --- a/ReCaptchaWebapiApi/composer.json +++ b/ReCaptchaWebapiApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaWebapiGraphQl/composer.json b/ReCaptchaWebapiGraphQl/composer.json index 67f04e53..d32a4c6d 100644 --- a/ReCaptchaWebapiGraphQl/composer.json +++ b/ReCaptchaWebapiGraphQl/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-graph-ql", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-frontend-ui": "*", diff --git a/ReCaptchaWebapiRest/composer.json b/ReCaptchaWebapiRest/composer.json index 1055ec24..42d2b752 100644 --- a/ReCaptchaWebapiRest/composer.json +++ b/ReCaptchaWebapiRest/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-rest", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiUi/composer.json b/ReCaptchaWebapiUi/composer.json index f7943a1a..e55a03a3 100644 --- a/ReCaptchaWebapiUi/composer.json +++ b/ReCaptchaWebapiUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-frontend-ui": "*" }, diff --git a/Securitytxt/composer.json b/Securitytxt/composer.json index df2d6339..7fdc5633 100644 --- a/Securitytxt/composer.json +++ b/Securitytxt/composer.json @@ -3,7 +3,7 @@ "description": "Security.txt file for Magento 2 websites", "type": "magento2-module", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-store": "*" diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 42b7339a..9652cc2a 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-two-factor-auth", "description": "Two Factor Authentication module for Magento2", "require": { - "php": "~8.1.0||~8.2.0", + "php": "~8.1.0||~8.2.0||~8.3.0", "magento/framework": "*", "magento/magento-composer-installer": "*", "magento/module-backend": "*", From 3aac5a4cea6a62b425b26816b22a5715bf97c891 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 21 Nov 2023 11:59:13 +0530 Subject: [PATCH 089/208] #AC-9196::Update spomky-labs/otphp to its latest version available (11.2.0) in security package --- TwoFactorAuth/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 42b7339a..e0528a41 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -13,7 +13,7 @@ "magento/module-user": "*", "magento/module-integration": "*", "christian-riesen/base32": "^1.3", - "spomky-labs/otphp": "^10.0", + "spomky-labs/otphp": "^11.2", "endroid/qr-code": "^4.3.5", "2tvenom/cborencode": "^1.0" }, From 4961f0149aff5a503ed79249b2a98f5afa12b8bd Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 29 Nov 2023 21:51:50 +0530 Subject: [PATCH 090/208] #AC-9196::Update spomky-labs/otphp to its latest version available (11.2.0) in security package-changing window period inside test files --- TwoFactorAuth/Test/Api/GoogleActivateTest.php | 2 +- TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/TwoFactorAuth/Test/Api/GoogleActivateTest.php b/TwoFactorAuth/Test/Api/GoogleActivateTest.php index 3253933f..1ee867c6 100644 --- a/TwoFactorAuth/Test/Api/GoogleActivateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleActivateTest.php @@ -129,7 +129,7 @@ public function testAlreadyActivatedProvider() /** * @magentoConfigFixture twofactorauth/general/force_providers google * @magentoApiDataFixture Magento/User/_files/user_with_custom_role.php - * @magentoConfigFixture twofactorauth/google/otp_window 120 + * @magentoConfigFixture twofactorauth/google/otp_window 20 */ public function testActivate() { diff --git a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php index bd6e5eca..a004d15e 100644 --- a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php @@ -222,7 +222,7 @@ public function testNotConfiguredProvider(): void /** * @magentoConfigFixture twofactorauth/general/force_providers google * @magentoApiDataFixture Magento/User/_files/user_with_custom_role.php - * @magentoConfigFixture twofactorauth/google/otp_window 120 + * @magentoConfigFixture twofactorauth/google/otp_window 20 * * @return void */ From 4bf69cddd1b06bf5f50810c7eaeeea5c46d91e07 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 2 Jan 2024 11:57:35 +0530 Subject: [PATCH 091/208] #AC-9196::Update spomky-labs/otphp to its latest version available (11.2.0)- Static test failures fixes --- TwoFactorAuth/Test/Api/GoogleActivateTest.php | 8 ++++---- TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/TwoFactorAuth/Test/Api/GoogleActivateTest.php b/TwoFactorAuth/Test/Api/GoogleActivateTest.php index 1ee867c6..73087341 100644 --- a/TwoFactorAuth/Test/Api/GoogleActivateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleActivateTest.php @@ -18,10 +18,10 @@ class GoogleActivateTest extends WebapiAbstract { - const SERVICE_VERSION = 'V1'; - const SERVICE_NAME = 'twoFactorAuthGoogleConfigureV1'; - const OPERATION = 'Activate'; - const RESOURCE_PATH = '/V1/tfa/provider/google/activate'; + public const SERVICE_VERSION = 'V1'; + public const SERVICE_NAME = 'twoFactorAuthGoogleConfigureV1'; + public const OPERATION = 'Activate'; + public const RESOURCE_PATH = '/V1/tfa/provider/google/activate'; /** * @var UserFactory diff --git a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php index a004d15e..70144596 100644 --- a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php @@ -25,10 +25,10 @@ */ class GoogleAuthenticateTest extends WebapiAbstract { - const SERVICE_VERSION = 'V1'; - const SERVICE_NAME = 'twoFactorAuthGoogleAuthenticateV1'; - const OPERATION = 'CreateAdminAccessToken'; - const RESOURCE_PATH = '/V1/tfa/provider/google/authenticate'; + public const SERVICE_VERSION = 'V1'; + public const SERVICE_NAME = 'twoFactorAuthGoogleAuthenticateV1'; + public const OPERATION = 'CreateAdminAccessToken'; + public const RESOURCE_PATH = '/V1/tfa/provider/google/authenticate'; /** * @var UserFactory From f812fbb23ffe1909265aa224438ab51e2f15d70b Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@adobe.com> Date: Thu, 18 Jan 2024 14:29:05 -0600 Subject: [PATCH 092/208] ACP2E-2755: Issue with rest api after enable 2FA Duo --- TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 362c444c..149684ea 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -208,7 +208,7 @@ public function getRequestSignature(UserInterface $user): string $duoSignature = $this->signValues( $this->getSecretKey(), $values, - static::DUO_PREFIX, + static::AUTH_PREFIX, static::DUO_EXPIRE, $time ); From fb93d2a972d2c58cec68216fed3707ff48dca40d Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@adobe.com> Date: Thu, 18 Jan 2024 16:14:19 -0600 Subject: [PATCH 093/208] ACP2E-2755: Issue with rest api after enable 2FA Duo --- .../Model/Provider/Engine/DuoSecurityTest.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index cb6d2aa0..41b02942 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -8,6 +8,7 @@ namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine; +use Magento\User\Api\Data\UserInterface; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; use PHPUnit\Framework\MockObject\MockObject; @@ -26,6 +27,11 @@ class DuoSecurityTest extends TestCase */ private $configMock; + /** + * @var UserInterface|MockObject + */ + private $user; + /** * @inheritDoc */ @@ -33,6 +39,7 @@ protected function setUp(): void { $objectManager = new ObjectManager($this); $this->configMock = $this->getMockBuilder(ScopeConfigInterface::class)->disableOriginalConstructor()->getMock(); + $this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock(); $this->model = $objectManager->getObject(DuoSecurity::class, ['scopeConfig' => $this->configMock]); } @@ -119,4 +126,16 @@ public function testIsEnabled( $this->assertEquals($expected, $this->model->isEnabled()); } + + public function testGetRequestSignature() : void + { + $this->user->expects($this->any()) + ->method('getUserName') + ->willReturn('admin'); + $this->configMock->expects($this->any()) + ->method('getValue') + ->willReturn('SECRET'); + + $this->assertStringContainsString($this->model::AUTH_PREFIX, $this->model->getRequestSignature($this->user)); + } } From 541d7be6ace11c7d1813b127144bca27f0bddaa2 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@adobe.com> Date: Wed, 24 Jan 2024 11:41:54 -0600 Subject: [PATCH 094/208] ACP2E-2755: Issue with rest api after enable 2FA Duo --- TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 149684ea..92159b94 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -208,7 +208,7 @@ public function getRequestSignature(UserInterface $user): string $duoSignature = $this->signValues( $this->getSecretKey(), $values, - static::AUTH_PREFIX, + static::DUO_PREFIX, static::DUO_EXPIRE, $time ); @@ -236,8 +236,8 @@ public function verify(UserInterface $user, DataObject $request): bool } [$authSig, $appSig] = $signatures; - $authUser = $this->parseValues($this->getSecretKey(), $authSig, static::AUTH_PREFIX, $time); $appUser = $this->parseValues($this->getApplicationKey(), $appSig, static::APP_PREFIX, $time); + $authUser = $this->parseValues($this->getSecretKey(), $authSig, static::DUO_PREFIX, $time); return (($authUser === $appUser) && ($appUser === $user->getUserName())); } From 54efe6de304be29473f66d6a2e37e9ad414ab255 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@adobe.com> Date: Wed, 24 Jan 2024 12:46:57 -0600 Subject: [PATCH 095/208] ACP2E-2755: Issue with rest api after enable 2FA Duo --- .../Model/Provider/Engine/DuoSecurity.php | 24 ++++++++++++++++--- TwoFactorAuth/etc/adminhtml/di.xml | 5 ++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 92159b94..fa78ddb9 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -77,13 +77,21 @@ class DuoSecurity implements EngineInterface */ private $scopeConfig; + /** + * @var bool + */ + private $forceUseDuoAuth; + /** * @param ScopeConfigInterface $scopeConfig + * @param bool $forceUseDuoAuth */ public function __construct( - ScopeConfigInterface $scopeConfig + ScopeConfigInterface $scopeConfig, + bool $forceUseDuoAuth = false ) { $this->scopeConfig = $scopeConfig; + $this->forceUseDuoAuth = $forceUseDuoAuth; } /** @@ -208,7 +216,7 @@ public function getRequestSignature(UserInterface $user): string $duoSignature = $this->signValues( $this->getSecretKey(), $values, - static::DUO_PREFIX, + $this->getPrefix(), static::DUO_EXPIRE, $time ); @@ -223,6 +231,16 @@ public function getRequestSignature(UserInterface $user): string return $duoSignature . ':' . $appSignature; } + /** + * Return prefix to use in the signature + * + * @return string + */ + private function getPrefix() : string + { + return ($this->forceUseDuoAuth) ? static::DUO_PREFIX : static::AUTH_PREFIX; + } + /** * @inheritDoc */ @@ -236,8 +254,8 @@ public function verify(UserInterface $user, DataObject $request): bool } [$authSig, $appSig] = $signatures; + $authUser = $this->parseValues($this->getSecretKey(), $authSig, static::AUTH_PREFIX, $time); $appUser = $this->parseValues($this->getApplicationKey(), $appSig, static::APP_PREFIX, $time); - $authUser = $this->parseValues($this->getSecretKey(), $authSig, static::DUO_PREFIX, $time); return (($authUser === $appUser) && ($appUser === $user->getUserName())); } diff --git a/TwoFactorAuth/etc/adminhtml/di.xml b/TwoFactorAuth/etc/adminhtml/di.xml index bcb1a8dc..40c69827 100644 --- a/TwoFactorAuth/etc/adminhtml/di.xml +++ b/TwoFactorAuth/etc/adminhtml/di.xml @@ -21,4 +21,9 @@ <type name="Magento\Backend\Model\Auth"> <plugin name="delete_tfat_cookie" type="Magento\TwoFactorAuth\Plugin\DeleteCookieOnLogout"/> </type> + <type name="Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity"> + <arguments> + <argument name="forceUseDuoAuth" xsi:type="boolean">true</argument> + </arguments> + </type> </config> From 99f9bdb4db6d63b98bf8004b6032663db30477c0 Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@adobe.com> Date: Wed, 24 Jan 2024 12:51:29 -0600 Subject: [PATCH 096/208] ACP2E-2755: Issue with rest api after enable 2FA Duo --- .../Model/Provider/Engine/DuoSecurityTest.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 41b02942..30eea6c7 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -22,6 +22,11 @@ class DuoSecurityTest extends TestCase */ private $model; + /** + * @var DuoSecurity + */ + private $modelWithForcedDuoAuth; + /** * @var ScopeConfigInterface|MockObject */ @@ -42,6 +47,7 @@ protected function setUp(): void $this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock(); $this->model = $objectManager->getObject(DuoSecurity::class, ['scopeConfig' => $this->configMock]); + $this->modelWithForcedDuoAuth = new DuoSecurity($this->configMock, true); } /** @@ -137,5 +143,15 @@ public function testGetRequestSignature() : void ->willReturn('SECRET'); $this->assertStringContainsString($this->model::AUTH_PREFIX, $this->model->getRequestSignature($this->user)); + $this->assertStringNotContainsString($this->model::DUO_PREFIX, $this->model->getRequestSignature($this->user)); + + $this->assertStringContainsString( + $this->model::DUO_PREFIX, + $this->modelWithForcedDuoAuth->getRequestSignature($this->user) + ); + $this->assertStringNotContainsString( + $this->model::AUTH_PREFIX, + $this->modelWithForcedDuoAuth->getRequestSignature($this->user) + ); } } From 2941bf1c2d1920591e6eb3b1fbf0bf703c68cf1e Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov <oiegorov@adobe.com> Date: Thu, 25 Jan 2024 12:25:11 -0600 Subject: [PATCH 097/208] ACP2E-2755: Issue with rest api after enable 2FA Duo --- .../Model/Provider/Engine/DuoSecurity.php | 22 +++++-------------- .../Model/Provider/Engine/DuoSecurityTest.php | 2 +- TwoFactorAuth/etc/adminhtml/di.xml | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index fa78ddb9..2463be87 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -78,20 +78,20 @@ class DuoSecurity implements EngineInterface private $scopeConfig; /** - * @var bool + * @var string */ - private $forceUseDuoAuth; + private $duoSignaturePrefix; /** * @param ScopeConfigInterface $scopeConfig - * @param bool $forceUseDuoAuth + * @param string $duoSignaturePrefix */ public function __construct( ScopeConfigInterface $scopeConfig, - bool $forceUseDuoAuth = false + string $duoSignaturePrefix = self::AUTH_PREFIX ) { $this->scopeConfig = $scopeConfig; - $this->forceUseDuoAuth = $forceUseDuoAuth; + $this->duoSignaturePrefix = $duoSignaturePrefix; } /** @@ -216,7 +216,7 @@ public function getRequestSignature(UserInterface $user): string $duoSignature = $this->signValues( $this->getSecretKey(), $values, - $this->getPrefix(), + $this->duoSignaturePrefix, static::DUO_EXPIRE, $time ); @@ -231,16 +231,6 @@ public function getRequestSignature(UserInterface $user): string return $duoSignature . ':' . $appSignature; } - /** - * Return prefix to use in the signature - * - * @return string - */ - private function getPrefix() : string - { - return ($this->forceUseDuoAuth) ? static::DUO_PREFIX : static::AUTH_PREFIX; - } - /** * @inheritDoc */ diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 30eea6c7..e057bee9 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -47,7 +47,7 @@ protected function setUp(): void $this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock(); $this->model = $objectManager->getObject(DuoSecurity::class, ['scopeConfig' => $this->configMock]); - $this->modelWithForcedDuoAuth = new DuoSecurity($this->configMock, true); + $this->modelWithForcedDuoAuth = new DuoSecurity($this->configMock, $this->model::DUO_PREFIX); } /** diff --git a/TwoFactorAuth/etc/adminhtml/di.xml b/TwoFactorAuth/etc/adminhtml/di.xml index 40c69827..6db37fd6 100644 --- a/TwoFactorAuth/etc/adminhtml/di.xml +++ b/TwoFactorAuth/etc/adminhtml/di.xml @@ -23,7 +23,7 @@ </type> <type name="Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity"> <arguments> - <argument name="forceUseDuoAuth" xsi:type="boolean">true</argument> + <argument name="duoSignaturePrefix" xsi:type="const">Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity::DUO_PREFIX</argument> </arguments> </type> </config> From 553ca8bf648f07afc5e513036561b31e2defc098 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 14 Feb 2024 18:17:14 +0530 Subject: [PATCH 098/208] #AC-9196::Update spomky-labs/otphp to its latest version available (11.2.0)- Static test failures fixes --- TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php | 1 + 1 file changed, 1 insertion(+) diff --git a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php index 70144596..101b9379 100644 --- a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php @@ -22,6 +22,7 @@ /** * Class checks google authentication behaviour + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class GoogleAuthenticateTest extends WebapiAbstract { From ff46e895ae41afc23713da419f9ec9c0fa13bc7f Mon Sep 17 00:00:00 2001 From: Rafal Janicki <rjanicki@adobe.com> Date: Fri, 15 Mar 2024 09:03:16 +0000 Subject: [PATCH 099/208] LYNX-363: Implement getting configurations for reCAPTCHA in GraphQL --- ReCaptchaVersion2Checkbox/Model/Config.php | 114 ++++++++++ ReCaptchaVersion2Checkbox/composer.json | 3 +- ReCaptchaVersion2Invisible/Model/Config.php | 114 ++++++++++ ReCaptchaVersion2Invisible/composer.json | 3 +- ReCaptchaVersion3Invisible/Model/Config.php | 47 ++-- ReCaptchaVersion3Invisible/composer.json | 3 +- .../Adapter/ReCaptchaConfigInterface.php | 66 ++++++ .../Model/Resolver/ReCaptchaFormConfig.php | 97 ++++++++ .../Model/Resolver/ReCaptchaV3.php | 7 +- .../Test/Api/ReCaptchaFormConfigTest.php | 210 ++++++++++++++++++ .../Test/Api/ReCaptchaV3ConfigTest.php | 21 +- ReCaptchaWebapiGraphQl/etc/graphql/di.xml | 23 ++ ReCaptchaWebapiGraphQl/etc/schema.graphqls | 23 ++ 13 files changed, 699 insertions(+), 32 deletions(-) create mode 100644 ReCaptchaVersion2Checkbox/Model/Config.php create mode 100644 ReCaptchaVersion2Invisible/Model/Config.php create mode 100644 ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php create mode 100644 ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php create mode 100644 ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php diff --git a/ReCaptchaVersion2Checkbox/Model/Config.php b/ReCaptchaVersion2Checkbox/Model/Config.php new file mode 100644 index 00000000..a54d9d42 --- /dev/null +++ b/ReCaptchaVersion2Checkbox/Model/Config.php @@ -0,0 +1,114 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaVersion2Checkbox\Model; + +use Magento\Framework\ObjectManager\ResetAfterRequestInterface; +use Magento\ReCaptchaVersion2Checkbox\Model\Frontend\UiConfigProvider; +use Magento\ReCaptchaWebapiGraphQl\Model\Adapter\ReCaptchaConfigInterface; + +class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface +{ + /** + * @var $minimumScore + */ + private ?float $minimumScore = null; + + /** + * @var array + */ + private array $uiConfig = []; + + /** + * @param UiConfigProvider $uiConfigProvider + */ + public function __construct( + private readonly UiConfigProvider $uiConfigProvider, + ) { + } + + /** + * Get front-end's UI configurations + * + * @return array + */ + public function getUiConfig(): array + { + if (empty($this->uiConfig)) { + $this->uiConfig = $this->uiConfigProvider->get(); + } + return $this->uiConfig; + } + + /** + * Get website's Google API public key + * + * @return string + */ + public function getWebsiteKey(): string + { + return $this->getUiConfig()['rendering']['sitekey']; + } + + /** + * Get configured captcha's theme + * + * @return string + */ + public function getTheme(): string + { + return $this->getUiConfig()['rendering']['theme']; + } + + /** + * Get code of language to send notifications + * + * @return string + */ + public function getLanguageCode(): string + { + return $this->getUiConfig()['rendering']['hl']; + } + + /** + * "I am not a robot" captcha does not provide configurable minimum score setting + * + * @return null + */ + public function getMinimumScore() + { + return $this->minimumScore; + } + + /** + * ReCaptcha V2 does not provide configurable badge_position setting + * + * @return string + */ + public function getBadgePosition(): string + { + return ''; + } + + /** + * @inheritDoc + */ + public function _resetState(): void + { + $this->uiConfig = []; + $this->minimumScore = null; + } +} diff --git a/ReCaptchaVersion2Checkbox/composer.json b/ReCaptchaVersion2Checkbox/composer.json index 5ef3ef87..6edc45c1 100644 --- a/ReCaptchaVersion2Checkbox/composer.json +++ b/ReCaptchaVersion2Checkbox/composer.json @@ -6,7 +6,8 @@ "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", - "magento/module-re-captcha-validation-api": "*" + "magento/module-re-captcha-validation-api": "*", + "magento/module-re-captcha-webapi-graph-ql": "*" }, "suggest": { "magento/module-config": "*", diff --git a/ReCaptchaVersion2Invisible/Model/Config.php b/ReCaptchaVersion2Invisible/Model/Config.php new file mode 100644 index 00000000..a8324c31 --- /dev/null +++ b/ReCaptchaVersion2Invisible/Model/Config.php @@ -0,0 +1,114 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaVersion2Invisible\Model; + +use Magento\Framework\ObjectManager\ResetAfterRequestInterface; +use Magento\ReCaptchaVersion2Invisible\Model\Frontend\UiConfigProvider; +use Magento\ReCaptchaWebapiGraphQl\Model\Adapter\ReCaptchaConfigInterface; + +class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface +{ + /** + * @var array + */ + private array $uiConfig = []; + + /** + * @var $minimumScore + */ + private ?float $minimumScore = null; + + /** + * @param UiConfigProvider $uiConfigProvider + */ + public function __construct( + private readonly UiConfigProvider $uiConfigProvider, + ) { + } + + /** + * Get website's Google API public key + * + * @return string + */ + public function getWebsiteKey(): string + { + return $this->getUiConfig()['rendering']['sitekey']; + } + + /** + * ReCaptcha V2 Invisible does not provide configurable minimum score setting + * + * @return null + */ + public function getMinimumScore() + { + return $this->minimumScore; + } + + /** + * Get configured captcha's badge position + * + * @return string + */ + public function getBadgePosition(): string + { + return $this->getUiConfig()['rendering']['badge']; + } + + /** + * Get configured captcha's theme + * + * @return string + */ + public function getTheme(): string + { + return $this->getUiConfig()['rendering']['theme']; + } + + /** + * Get code of language to send notifications + * + * @return string + */ + public function getLanguageCode(): string + { + return $this->getUiConfig()['rendering']['hl']; + } + + /** + * Get front-end's UI configurations + * + * @return array + */ + public function getUiConfig(): array + { + if (empty($this->uiConfig)) { + $this->uiConfig = $this->uiConfigProvider->get(); + } + return $this->uiConfig; + } + + /** + * @inheritDoc + */ + public function _resetState(): void + { + $this->uiConfig = []; + $this->minimumScore = null; + } +} diff --git a/ReCaptchaVersion2Invisible/composer.json b/ReCaptchaVersion2Invisible/composer.json index afff926e..867cc8a6 100644 --- a/ReCaptchaVersion2Invisible/composer.json +++ b/ReCaptchaVersion2Invisible/composer.json @@ -6,7 +6,8 @@ "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", - "magento/module-re-captcha-validation-api": "*" + "magento/module-re-captcha-validation-api": "*", + "magento/module-re-captcha-webapi-graph-ql": "*" }, "suggest": { "magento/module-config": "*", diff --git a/ReCaptchaVersion3Invisible/Model/Config.php b/ReCaptchaVersion3Invisible/Model/Config.php index 8a517506..97d666a0 100644 --- a/ReCaptchaVersion3Invisible/Model/Config.php +++ b/ReCaptchaVersion3Invisible/Model/Config.php @@ -1,5 +1,4 @@ <?php - /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. @@ -12,8 +11,9 @@ use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; use Magento\ReCaptchaVersion3Invisible\Model\Frontend\UiConfigProvider; use Magento\ReCaptchaVersion3Invisible\Model\Frontend\ValidationConfigProvider; +use Magento\ReCaptchaWebapiGraphQl\Model\Adapter\ReCaptchaConfigInterface; -class Config implements ResetAfterRequestInterface +class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface { /** * @var string|null @@ -35,21 +35,11 @@ class Config implements ResetAfterRequestInterface */ private ?string $languageCode = null; - /** - * @var UiConfigProvider - */ - private UiConfigProvider $uiConfigProvider; - /** * @var array */ private array $uiConfig = []; - /** - * @var ValidationConfigProvider - */ - private ValidationConfigProvider $validationConfigProvider; - /** * @var ValidationConfigInterface|null */ @@ -66,13 +56,11 @@ class Config implements ResetAfterRequestInterface * @param array $formTypes */ public function __construct( - UiConfigProvider $uiConfigProvider, - ValidationConfigProvider $validationConfigProvider, + private readonly UiConfigProvider $uiConfigProvider, + private readonly ValidationConfigProvider $validationConfigProvider, array $formTypes = [] ) { $this->formTypes = $formTypes; - $this->uiConfigProvider = $uiConfigProvider; - $this->validationConfigProvider = $validationConfigProvider; } /** @@ -91,12 +79,16 @@ public function getWebsiteKey(): string /** * Get configured minimum score value * - * @return float + * @return float|null */ - public function getMinimumScore(): float + public function getMinimumScore(): float|null { if (!$this->minimumScore) { - $this->minimumScore = $this->validationConfig->getExtensionAttributes()->getScoreThreshold(); + $validationProvider = $this->validationConfigProvider->get(); + if ($validationProvider->getExtensionAttributes() === null) { + return $this->minimumScore; + } + $this->minimumScore = $validationProvider->getExtensionAttributes()->getScoreThreshold(); } return $this->minimumScore; } @@ -114,6 +106,16 @@ public function getBadgePosition(): string return $this->badgePosition; } + /** + * Get configured captcha's theme + * + * @return string + */ + public function getTheme(): string + { + return $this->getUiConfig()['rendering']['theme']; + } + /** * Get code of language to send notifications * @@ -155,7 +157,7 @@ public function getValidationConfig(): ValidationConfigInterface * * @return array */ - private function getUiConfig(): array + public function getUiConfig(): array { if (empty($this->uiConfig)) { $this->uiConfig = $this->uiConfigProvider->get(); @@ -168,8 +170,11 @@ private function getUiConfig(): array */ public function _resetState(): void { - $this->websiteKey = null; $this->uiConfig = []; + $this->websiteKey = null; + $this->minimumScore = null; + $this->languageCode = null; + $this->badgePosition = null; $this->validationConfig = null; } } diff --git a/ReCaptchaVersion3Invisible/composer.json b/ReCaptchaVersion3Invisible/composer.json index f0da1871..36b4318e 100644 --- a/ReCaptchaVersion3Invisible/composer.json +++ b/ReCaptchaVersion3Invisible/composer.json @@ -6,7 +6,8 @@ "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", - "magento/module-re-captcha-validation-api": "*" + "magento/module-re-captcha-validation-api": "*", + "magento/module-re-captcha-webapi-graph-ql": "*" }, "suggest": { "magento/module-config": "*", diff --git a/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php b/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php new file mode 100644 index 00000000..f719dcb9 --- /dev/null +++ b/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php @@ -0,0 +1,66 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaWebapiGraphQl\Model\Adapter; + +/** + * Interface for ReCaptcha config adapters. Used in Config adapters which retrieve + * configuration settings for different ReCaptcha types. + */ +interface ReCaptchaConfigInterface +{ + /** + * Get front-end's UI configurations + * + * @return array + */ + public function getUiConfig(); + + /** + * Get website's Google API public key + * + * @return string + */ + public function getWebsiteKey(); + + /** + * Get configured captcha's theme + * + * @return string + */ + public function getTheme(); + + /** + * Get code of language to send notifications + * + * @return string + */ + public function getLanguageCode(); + + /** + * Returns minimum score setting + * + * @return mixed + */ + public function getMinimumScore(); + + /** + * Returns badge_position setting + * + * @return string + */ + public function getBadgePosition(); +} diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php new file mode 100644 index 00000000..28b199e3 --- /dev/null +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php @@ -0,0 +1,97 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaWebapiGraphQl\Model\Resolver; + +use Magento\Framework\GraphQl\Config\Element\Field; +use Magento\Framework\GraphQl\Query\ResolverInterface; +use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +use Magento\Framework\GraphQl\Exception\GraphQlInputException; +use Magento\ReCaptchaFrontendUi\Model\CaptchaTypeResolver; +use Magento\ReCaptchaFrontendUi\Model\ErrorMessageConfig; + +/** + * Query returning reCaptcha configuration details for selected form type + */ +class ReCaptchaFormConfig implements ResolverInterface +{ + /** + * @var array + */ + private array $reCaptchaConfigProviders; + + /** + * @var array + */ + private array $formTypes; + + /** + * @param CaptchaTypeResolver $captchaTypeResolver + * @param ErrorMessageConfig $errorMessageConfig + * @param array $providers + * @param array $formTypes + */ + public function __construct( + private readonly CaptchaTypeResolver $captchaTypeResolver, + private readonly ErrorMessageConfig $errorMessageConfig, + array $providers = [], + array $formTypes = [] + ) { + $this->reCaptchaConfigProviders = $providers; + $this->formTypes = $formTypes; + } + + /** + * @inheritDoc + */ + public function resolve( + Field $field, + $context, + ResolveInfo $info, + array $value = null, + array $args = null, + ) { + try { + $captchaType = $this->captchaTypeResolver->getCaptchaTypeFor($this->formTypes[$args['formType']]); + + if (!$captchaType) { + return [ + 'is_enabled' => false, + 'configurations' => null + ]; + } + + $reCaptchaConfigProvider = $this->reCaptchaConfigProviders[$captchaType]; + return [ + 'is_enabled' => true, + 'configurations' => [ + 're_captcha_type' => mb_strtoupper($captchaType), + 'website_key' => $reCaptchaConfigProvider->getWebsiteKey(), + 'minimum_score' => $reCaptchaConfigProvider->getMinimumScore(), + 'badge_position' => $reCaptchaConfigProvider->getBadgePosition(), + 'theme' => $reCaptchaConfigProvider->getTheme(), + 'language_code' => $reCaptchaConfigProvider->getLanguageCode(), + 'validation_failure_message' => $this->errorMessageConfig->getValidationFailureMessage(), + 'technical_failure_message' => $this->errorMessageConfig->getTechnicalFailureMessage() + ] + ]; + } catch (\Exception $e) { + throw new GraphQlInputException( + __('Configuration for provided captcha type can not be retrieved.') + ); + } + } +} diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php index a014f0fc..18acb4a6 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -1,5 +1,4 @@ <?php - /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. @@ -26,6 +25,11 @@ class ReCaptchaV3 implements ResolverInterface, ResetAfterRequestInterface */ private ?bool $isEnabled = null; + /** + * @var array + */ + private array $forms = []; + /** * @var Config */ @@ -136,5 +140,6 @@ public function getFailureMessage(): string public function _resetState(): void { $this->isEnabled = null; + $this->failureMessage = null; } } diff --git a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php new file mode 100644 index 00000000..9ffc579b --- /dev/null +++ b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php @@ -0,0 +1,210 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaWebapiGraphQl\Test\Api; + +use Magento\Framework\Encryption\EncryptorInterface; +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; +use Magento\TestFramework\Fixture\Config; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * Test recaptcha config query + */ +class ReCaptchaFormConfigTest extends GraphQlAbstract +{ + /** + * @var EncryptorInterface $encryptor + */ + private $encryptor; + + /** + * @var \Magento\Config\Model\Config $config + */ + private $config; + + public function setUp(): void + { + $this->encryptor = Bootstrap::getObjectManager()->get(EncryptorInterface::class); + $this->config = Bootstrap::getObjectManager()->get(\Magento\Config\Model\Config::class); + } + + #[ + Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.5), + Config('recaptcha_frontend/type_recaptcha_v3/position', 'inline'), + Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), + Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test validation failure message'), + Config('recaptcha_frontend/failure_messages/technical_failure_message', 'Test technical failure message'), + Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3') + ] + public function testRecaptchaFormConfigQueryForReCaptchaV3(): void + { + $this->setWebapiKeys('type_recaptcha_v3'); + + $result = $this->graphQlQuery($this->getQueryForForm()); + $response = [ + "recaptchaFormConfig" => [ + "is_enabled" => true, + "configurations" => [ + "re_captcha_type" => "RECAPTCHA_V3", + "badge_position" => "inline", + "theme" => "light", + "website_key" => "test_public_key", + "language_code" => "en", + "minimum_score" => 0.5, + "validation_failure_message" => "Test validation failure message", + "technical_failure_message" => "Test technical failure message" + ] + ] + ]; + + $this->assertEquals($response, $result, "reCaptcha config contains errors"); + } + + #[ + Config('recaptcha_frontend/type_recaptcha/position', 'bottomright'), + Config('recaptcha_frontend/type_recaptcha/lang', 'en'), + Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test validation failure message'), + Config('recaptcha_frontend/failure_messages/technical_failure_message', 'Test technical failure message'), + Config('recaptcha_frontend/type_for/customer_login', 'recaptcha') + ] + public function testRecaptchaFormConfigQueryForReCaptchaV2(): void + { + $this->setWebapiKeys('type_recaptcha'); + + $result = $this->graphQlQuery($this->getQueryForForm()); + $response = [ + "recaptchaFormConfig" => [ + "is_enabled" => true, + "configurations" => [ + "re_captcha_type" => "RECAPTCHA", + "badge_position" => '', + "theme" => "light", + "website_key" => "test_public_key", + "minimum_score" => null, + "language_code" => "en", + "validation_failure_message" => "Test validation failure message", + "technical_failure_message" => "Test technical failure message" + ] + ] + ]; + + $this->assertEquals($response, $result, "reCaptcha config contains errors"); + } + + #[ + Config('recaptcha_frontend/type_invisible/position', 'bottomright'), + Config('recaptcha_frontend/type_invisible/lang', 'en'), + Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test validation failure message'), + Config('recaptcha_frontend/failure_messages/technical_failure_message', 'Test technical failure message'), + Config('recaptcha_frontend/type_for/customer_login', 'invisible') + ] + public function testRecaptchaFormConfigQueryForReCaptchaV2Invisible(): void + { + $this->setWebapiKeys('type_invisible'); + + $result = $this->graphQlQuery($this->getQueryForForm()); + $response = [ + "recaptchaFormConfig" => [ + "is_enabled" => true, + "configurations" => [ + "re_captcha_type" => "INVISIBLE", + "badge_position" => "bottomright", + "theme" => "light", + "website_key" => "test_public_key", + "minimum_score" => null, + "language_code" => "en", + "validation_failure_message" => "Test validation failure message", + "technical_failure_message" => "Test technical failure message" + ] + ] + ]; + + $this->assertEquals($response, $result, "reCaptcha config contains errors"); + } + + public function testRecaptchaFormConfigQueryForNotConfiguredForm(): void + { + $result = $this->graphQlQuery($this->getQueryForForm()); + $response = [ + "recaptchaFormConfig" => [ + "is_enabled" => false, + "configurations" => null + ] + ]; + $this->assertEquals($response, $result, "reCaptcha config contains errors"); + } + + /** + * Generates wepapi private/public key for reCaptcha config + * + * @param string $captchaType + */ + private function setWebapiKeys(string $captchaType) + { + $this->config->setDataByPath( + "recaptcha_frontend/{$captchaType}/public_key", + $this->encryptor->encrypt('test_public_key') + ); + $this->config->setDataByPath( + "recaptcha_frontend/{$captchaType}/private_key", + $this->encryptor->encrypt('test_private_key') + ); + $this->config->save(); + } + + /** + * Returns formatted query for reCaptcha configuration + */ + private function getQueryForForm(): string + { + $query = <<<QUERY + query + { + recaptchaFormConfig(formType: CUSTOMER_LOGIN){ + is_enabled + configurations{ + re_captcha_type + badge_position + theme + website_key + language_code + minimum_score + validation_failure_message + technical_failure_message + } + } + } +QUERY; + + return $query; + } + + public function tearDown(): void + { + /** @var ResourceConnection $resource */ + $resource = Bootstrap::getObjectManager()->get(ResourceConnection::class); + /** @var AdapterInterface $connection */ + $connection = $resource->getConnection(ResourceConnection::DEFAULT_CONNECTION); + + $connection->delete( + $resource->getTableName('core_config_data') + ); + parent::tearDown(); + } +} diff --git a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php index c0978cae..7b946260 100644 --- a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php @@ -1,5 +1,4 @@ <?php - /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. @@ -10,6 +9,8 @@ use Magento\Framework\Encryption\EncryptorInterface; use Magento\TestFramework\Fixture\Config; +use Magento\Framework\App\ResourceConnection; +use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; @@ -49,7 +50,7 @@ public function setUp(): void Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), - Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3'), + Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3') ] public function testQueryRecaptchaNoPublicKeyConfigured(): void { @@ -75,7 +76,7 @@ public function testQueryRecaptchaNoPublicKeyConfigured(): void Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75), Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), - Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), + Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message') ] public function testQueryRecaptchaNoFormsConfigured(): void { @@ -111,7 +112,7 @@ public function testQueryRecaptchaNoFormsConfigured(): void Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), - Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3'), + Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3') ] public function testQueryRecaptchaConfigured(): void { @@ -146,8 +147,14 @@ public function testQueryRecaptchaConfigured(): void public function tearDown(): void { - $this->config->unsetData('recaptcha_frontend/type_recaptcha_v3/public_key'); - $this->config->unsetData('recaptcha_frontend/type_recaptcha_v3/private_key'); - $this->config->save(); + /** @var ResourceConnection $resource */ + $resource = Bootstrap::getObjectManager()->get(ResourceConnection::class); + /** @var AdapterInterface $connection */ + $connection = $resource->getConnection(ResourceConnection::DEFAULT_CONNECTION); + + $connection->delete( + $resource->getTableName('core_config_data') + ); + parent::tearDown(); } } diff --git a/ReCaptchaWebapiGraphQl/etc/graphql/di.xml b/ReCaptchaWebapiGraphQl/etc/graphql/di.xml index 5e9e9b79..2c0be078 100644 --- a/ReCaptchaWebapiGraphQl/etc/graphql/di.xml +++ b/ReCaptchaWebapiGraphQl/etc/graphql/di.xml @@ -10,4 +10,27 @@ <type name="Magento\ReCaptchaValidationApi\Api\ValidatorInterface"> <plugin name="graphql_recaptcha_validation_override" type="Magento\ReCaptchaWebapiGraphQl\Plugin\ValidationOverrider" /> </type> + + <type name="Magento\ReCaptchaWebapiGraphQl\Model\Resolver\ReCaptchaFormConfig"> + <arguments> + <argument name="providers" xsi:type="array"> + <item name="recaptcha" xsi:type="object">Magento\ReCaptchaVersion2Checkbox\Model\Config</item> + <item name="invisible" xsi:type="object">Magento\ReCaptchaVersion2Invisible\Model\Config</item> + <item name="recaptcha_v3" xsi:type="object">Magento\ReCaptchaVersion3Invisible\Model\Config</item> + </argument> + + <argument name="formTypes" xsi:type="array"> + <item name="PLACE_ORDER" xsi:type="string">place_order</item> + <item name="CONTACT" xsi:type="string">contact</item> + <item name="CUSTOMER_LOGIN" xsi:type="string">customer_login</item> + <item name="CUSTOMER_FORGOT_PASSWORD" xsi:type="string">customer_forgot_password</item> + <item name="CUSTOMER_CREATE" xsi:type="string">customer_create</item> + <item name="CUSTOMER_EDIT" xsi:type="string">customer_edit</item> + <item name="NEWSLETTER" xsi:type="string">newsletter</item> + <item name="PRODUCT_REVIEW" xsi:type="string">product_review</item> + <item name="SENDFRIEND" xsi:type="string">sendfriend</item> + <item name="BRAINTREE" xsi:type="string">braintree</item> + </argument> + </arguments> + </type> </config> diff --git a/ReCaptchaWebapiGraphQl/etc/schema.graphqls b/ReCaptchaWebapiGraphQl/etc/schema.graphqls index 63e152fa..29715650 100644 --- a/ReCaptchaWebapiGraphQl/etc/schema.graphqls +++ b/ReCaptchaWebapiGraphQl/etc/schema.graphqls @@ -3,6 +3,7 @@ type Query { recaptchaV3Config: ReCaptchaConfigurationV3 @resolver(class: "Magento\\ReCaptchaWebapiGraphQl\\Model\\Resolver\\ReCaptchaV3") @doc(description: "Returns details about Google reCAPTCHA V3-Invisible configuration.") + recaptchaFormConfig(formType: ReCaptchaFormEnum!): ReCaptchaConfigOutput @resolver(class: "Magento\\ReCaptchaWebapiGraphQl\\Model\\Resolver\\ReCaptchaFormConfig") } enum ReCaptchaFormEnum { @@ -18,6 +19,28 @@ enum ReCaptchaFormEnum { BRAINTREE } +enum ReCaptchaTypeEmum { + INVISIBLE + RECAPTCHA + RECAPTCHA_V3 +} + +type ReCaptchaConfigOutput { + is_enabled: Boolean! + configurations: ReCaptchaConfiguration +} + +type ReCaptchaConfiguration @doc(description: "Contains reCAPTCHA form configuration details.") { + re_captcha_type: ReCaptchaTypeEmum! + website_key: String! @doc(description: "The website key generated when the Google reCAPTCHA account was registered.") + minimum_score: Float @doc(description: "The minimum score that identifies a user interaction as a potential risk.") + badge_position: String @doc(description: "The position of the invisible reCAPTCHA badge on each page.") + theme: String! @doc(description: "Theme to be used to render reCaptcha.") + language_code: String @doc(description: "A two-character code that specifies the language that is used for Google reCAPTCHA text and messaging.") + validation_failure_message: String! @doc(description: "The message that appears to the user if validation fails.") + technical_failure_message: String! @doc(description: "The message that appears when reCaptcha fails.") +} + type ReCaptchaConfigurationV3 @doc(description: "Contains reCAPTCHA V3-Invisible configuration details.") { is_enabled: Boolean! @doc(description: "Return whether recaptcha is enabled or not") website_key: String! @doc(description: "The website key generated when the Google reCAPTCHA account was registered.") From 661928098c03901814066922a6da9d5c56a3f168 Mon Sep 17 00:00:00 2001 From: Rafal Janicki <rjanicki@adobe.com> Date: Fri, 15 Mar 2024 14:46:24 +0000 Subject: [PATCH 100/208] LYNX-363: CR refactoring --- ReCaptchaVersion2Checkbox/Model/Config.php | 22 +++---- ReCaptchaVersion2Invisible/Model/Config.php | 26 ++++----- ReCaptchaVersion3Invisible/Model/Config.php | 57 ++++--------------- .../Adapter/ReCaptchaConfigInterface.php | 19 ++----- ReCaptchaWebapiGraphQl/etc/schema.graphqls | 4 +- 5 files changed, 38 insertions(+), 90 deletions(-) diff --git a/ReCaptchaVersion2Checkbox/Model/Config.php b/ReCaptchaVersion2Checkbox/Model/Config.php index a54d9d42..8858f058 100644 --- a/ReCaptchaVersion2Checkbox/Model/Config.php +++ b/ReCaptchaVersion2Checkbox/Model/Config.php @@ -22,11 +22,6 @@ class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface { - /** - * @var $minimumScore - */ - private ?float $minimumScore = null; - /** * @var array */ @@ -45,10 +40,10 @@ public function __construct( * * @return array */ - public function getUiConfig(): array + private function getUiConfig(): array { if (empty($this->uiConfig)) { - $this->uiConfig = $this->uiConfigProvider->get(); + $this->uiConfig = $this->uiConfigProvider->get() ?? []; } return $this->uiConfig; } @@ -60,7 +55,7 @@ public function getUiConfig(): array */ public function getWebsiteKey(): string { - return $this->getUiConfig()['rendering']['sitekey']; + return $this->getUiConfig()['rendering']['sitekey'] ?? ''; } /** @@ -70,7 +65,7 @@ public function getWebsiteKey(): string */ public function getTheme(): string { - return $this->getUiConfig()['rendering']['theme']; + return $this->getUiConfig()['rendering']['theme'] ?? ''; } /** @@ -80,17 +75,17 @@ public function getTheme(): string */ public function getLanguageCode(): string { - return $this->getUiConfig()['rendering']['hl']; + return $this->getUiConfig()['rendering']['hl'] ?? ''; } /** * "I am not a robot" captcha does not provide configurable minimum score setting * - * @return null + * @return null|float */ - public function getMinimumScore() + public function getMinimumScore(): ?float { - return $this->minimumScore; + return null; } /** @@ -109,6 +104,5 @@ public function getBadgePosition(): string public function _resetState(): void { $this->uiConfig = []; - $this->minimumScore = null; } } diff --git a/ReCaptchaVersion2Invisible/Model/Config.php b/ReCaptchaVersion2Invisible/Model/Config.php index a8324c31..16f941e2 100644 --- a/ReCaptchaVersion2Invisible/Model/Config.php +++ b/ReCaptchaVersion2Invisible/Model/Config.php @@ -27,11 +27,6 @@ class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface */ private array $uiConfig = []; - /** - * @var $minimumScore - */ - private ?float $minimumScore = null; - /** * @param UiConfigProvider $uiConfigProvider */ @@ -47,17 +42,17 @@ public function __construct( */ public function getWebsiteKey(): string { - return $this->getUiConfig()['rendering']['sitekey']; + return $this->getUiConfig()['rendering']['sitekey'] ?? ''; } /** - * ReCaptcha V2 Invisible does not provide configurable minimum score setting + * ReCaptcha v2 Invisible does not provide configuration for minimum score * - * @return null + * @return null|float */ - public function getMinimumScore() + public function getMinimumScore(): ?float { - return $this->minimumScore; + return null; } /** @@ -67,7 +62,7 @@ public function getMinimumScore() */ public function getBadgePosition(): string { - return $this->getUiConfig()['rendering']['badge']; + return $this->getUiConfig()['rendering']['badge'] ?? ''; } /** @@ -77,7 +72,7 @@ public function getBadgePosition(): string */ public function getTheme(): string { - return $this->getUiConfig()['rendering']['theme']; + return $this->getUiConfig()['rendering']['theme'] ?? ''; } /** @@ -87,7 +82,7 @@ public function getTheme(): string */ public function getLanguageCode(): string { - return $this->getUiConfig()['rendering']['hl']; + return $this->getUiConfig()['rendering']['hl'] ?? ''; } /** @@ -95,10 +90,10 @@ public function getLanguageCode(): string * * @return array */ - public function getUiConfig(): array + private function getUiConfig(): array { if (empty($this->uiConfig)) { - $this->uiConfig = $this->uiConfigProvider->get(); + $this->uiConfig = $this->uiConfigProvider->get() ?? []; } return $this->uiConfig; } @@ -109,6 +104,5 @@ public function getUiConfig(): array public function _resetState(): void { $this->uiConfig = []; - $this->minimumScore = null; } } diff --git a/ReCaptchaVersion3Invisible/Model/Config.php b/ReCaptchaVersion3Invisible/Model/Config.php index 97d666a0..3005c4d8 100644 --- a/ReCaptchaVersion3Invisible/Model/Config.php +++ b/ReCaptchaVersion3Invisible/Model/Config.php @@ -15,26 +15,11 @@ class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface { - /** - * @var string|null - */ - private ?string $websiteKey = null; - /** * @var float|null */ private ?float $minimumScore = null; - /** - * @var string|null - */ - private ?string $badgePosition = null; - - /** - * @var string|null - */ - private ?string $languageCode = null; - /** * @var array */ @@ -45,11 +30,6 @@ class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface */ private ?ValidationConfigInterface $validationConfig = null; - /** - * @var array - */ - private array $formTypes; - /** * @param UiConfigProvider $uiConfigProvider * @param ValidationConfigProvider $validationConfigProvider @@ -58,9 +38,8 @@ class Config implements ReCaptchaConfigInterface, ResetAfterRequestInterface public function __construct( private readonly UiConfigProvider $uiConfigProvider, private readonly ValidationConfigProvider $validationConfigProvider, - array $formTypes = [] + private readonly array $formTypes ) { - $this->formTypes = $formTypes; } /** @@ -70,10 +49,7 @@ public function __construct( */ public function getWebsiteKey(): string { - if (!$this->websiteKey) { - $this->websiteKey = $this->getUiConfig()['rendering']['sitekey']; - } - return $this->websiteKey; + return $this->getUiConfig()['rendering']['sitekey'] ?? ''; } /** @@ -81,7 +57,7 @@ public function getWebsiteKey(): string * * @return float|null */ - public function getMinimumScore(): float|null + public function getMinimumScore(): ?float { if (!$this->minimumScore) { $validationProvider = $this->validationConfigProvider->get(); @@ -100,33 +76,27 @@ public function getMinimumScore(): float|null */ public function getBadgePosition(): string { - if (!$this->badgePosition) { - $this->badgePosition = $this->getUiConfig()['rendering']['badge']; - } - return $this->badgePosition; + return $this->getUiConfig()['rendering']['badge'] ?? ''; } /** - * Get configured captcha's theme + * Get code of language to send notifications * * @return string */ - public function getTheme(): string + public function getLanguageCode(): string { - return $this->getUiConfig()['rendering']['theme']; + return $this->getUiConfig()['rendering']['hl'] ?? ''; } /** - * Get code of language to send notifications + * Get configured captcha's theme * * @return string */ - public function getLanguageCode(): string + public function getTheme(): string { - if (!$this->languageCode) { - $this->languageCode = $this->getUiConfig()['rendering']['hl']; - } - return $this->languageCode; + return $this->getUiConfig()['rendering']['theme'] ?? ''; } /** @@ -157,10 +127,10 @@ public function getValidationConfig(): ValidationConfigInterface * * @return array */ - public function getUiConfig(): array + private function getUiConfig(): array { if (empty($this->uiConfig)) { - $this->uiConfig = $this->uiConfigProvider->get(); + $this->uiConfig = $this->uiConfigProvider->get() ?? []; } return $this->uiConfig; } @@ -171,10 +141,7 @@ public function getUiConfig(): array public function _resetState(): void { $this->uiConfig = []; - $this->websiteKey = null; $this->minimumScore = null; - $this->languageCode = null; - $this->badgePosition = null; $this->validationConfig = null; } } diff --git a/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php b/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php index f719dcb9..08aea710 100644 --- a/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php +++ b/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php @@ -22,45 +22,38 @@ */ interface ReCaptchaConfigInterface { - /** - * Get front-end's UI configurations - * - * @return array - */ - public function getUiConfig(); - /** * Get website's Google API public key * * @return string */ - public function getWebsiteKey(); + public function getWebsiteKey(): string; /** * Get configured captcha's theme * * @return string */ - public function getTheme(); + public function getTheme(): string; /** * Get code of language to send notifications * * @return string */ - public function getLanguageCode(); + public function getLanguageCode(): string; /** * Returns minimum score setting * - * @return mixed + * @return float|null */ - public function getMinimumScore(); + public function getMinimumScore(): ?float; /** * Returns badge_position setting * * @return string */ - public function getBadgePosition(); + public function getBadgePosition(): string; } diff --git a/ReCaptchaWebapiGraphQl/etc/schema.graphqls b/ReCaptchaWebapiGraphQl/etc/schema.graphqls index 29715650..ac15158b 100644 --- a/ReCaptchaWebapiGraphQl/etc/schema.graphqls +++ b/ReCaptchaWebapiGraphQl/etc/schema.graphqls @@ -26,8 +26,8 @@ enum ReCaptchaTypeEmum { } type ReCaptchaConfigOutput { - is_enabled: Boolean! - configurations: ReCaptchaConfiguration + is_enabled: Boolean! @doc(description: "Indicates whether reCaptcha type is enabled") + configurations: ReCaptchaConfiguration @doc(description: "Configuration details for reCaptcha type") } type ReCaptchaConfiguration @doc(description: "Contains reCAPTCHA form configuration details.") { From 69b0b70a8e205eb63a97c544fca5b508d9252b76 Mon Sep 17 00:00:00 2001 From: manjusha729 <93243302+manjusha729@users.noreply.github.com> Date: Mon, 25 Mar 2024 11:17:41 +0530 Subject: [PATCH 101/208] Create class-file-naming-allowlist --- Securitytxt/Test/Mftf/class-file-naming-allowlist | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Securitytxt/Test/Mftf/class-file-naming-allowlist diff --git a/Securitytxt/Test/Mftf/class-file-naming-allowlist b/Securitytxt/Test/Mftf/class-file-naming-allowlist new file mode 100644 index 00000000..4f3447f8 --- /dev/null +++ b/Securitytxt/Test/Mftf/class-file-naming-allowlist @@ -0,0 +1,7 @@ +AssertFullSecurityTxtConfiguration +OpenSecurityTxtPage +OpenSecurityTxtSignaturePage + + + + From a305a8cb53e962b5f43a8b16a3a66290a4d6c185 Mon Sep 17 00:00:00 2001 From: jayrangnani-gl <142883278+jayrangnani-gl@users.noreply.github.com> Date: Wed, 27 Mar 2024 13:52:44 +0530 Subject: [PATCH 102/208] AC-11698:Remove Notice section form Magento Open source files copyright:Remove Notice --- .../ActionGroup/AdminSaveUserRoleActionGroup.xml | 11 ----------- .../frontend/js/reCaptcha.test.js | 13 +------------ 2 files changed, 1 insertion(+), 23 deletions(-) diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml index 1d78e661..df848dcb 100644 --- a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml @@ -1,19 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- /** -* ADOBE CONFIDENTIAL -* * Copyright 2023 Adobe * All Rights Reserved. -* -* NOTICE: All information contained herein is, and remains -* the property of Adobe and its suppliers, if any. The intellectual -* and technical concepts contained herein are proprietary to Adobe -* and its suppliers and are protected by all applicable intellectual -* property laws, including trade secret and copyright laws. -* Dissemination of this information or reproduction of this material -* is strictly forbidden unless prior written permission is obtained -* from Adobe. */ --> diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js index 63a51622..0900150b 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaFrontendUi/frontend/js/reCaptcha.test.js @@ -1,17 +1,6 @@ -/************************************************************************ - * +/** * Copyright 2023 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - * ************************************************************************ */ /* eslint-disable max-nested-callbacks */ From ff768631ee54ccb9b9582db08ca05cbf8d5e42fc Mon Sep 17 00:00:00 2001 From: Dima Shevtsov <shevtsov@adobe.com> Date: Mon, 15 Apr 2024 16:36:12 -0500 Subject: [PATCH 103/208] Fix links in docs --- README.md | 6 +++--- ReCaptchaAdminUi/README.md | 2 +- ReCaptchaCheckout/README.md | 2 +- ReCaptchaContact/README.md | 2 +- ReCaptchaCustomer/README.md | 2 +- ReCaptchaFrontendUi/README.md | 2 +- ReCaptchaMigration/README.md | 4 ++-- ReCaptchaNewsletter/README.md | 2 +- ReCaptchaPaypal/README.md | 2 +- ReCaptchaReview/README.md | 2 +- ReCaptchaSendFriend/README.md | 2 +- ReCaptchaStorePickup/README.md | 2 +- ReCaptchaUi/README.md | 2 +- ReCaptchaUser/README.md | 2 +- ReCaptchaValidation/README.md | 2 +- ReCaptchaValidationApi/README.md | 2 +- ReCaptchaVersion2Checkbox/README.md | 2 +- ReCaptchaVersion2Invisible/README.md | 2 +- ReCaptchaVersion3Invisible/README.md | 2 +- ReCaptchaWebapiApi/README.md | 2 +- ReCaptchaWebapiGraphQl/README.md | 2 +- ReCaptchaWebapiRest/README.md | 2 +- ReCaptchaWebapiUi/README.md | 2 +- TwoFactorAuth/README.md | 2 +- 24 files changed, 27 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 1832a33c..a7b97f94 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ disclosure practices. - Complete documentation located on the project [wiki pages](https://github.com/magento/security-package/wiki): - How to start local development described in the [installation guide](https://github.com/magento/security-package/wiki/Metapackage-Installation-Guide) - - Two-factor authentication [user guide](https://docs.magento.com/user-guide/stores/security-two-factor-authentication.html) and [technical guide](https://developer.adobe.com/commerce/testing/functional-testing-framework/two-factor-authentication/). - - Google ReCAPTCHA [user guide](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html) and [technical guide](https://experienceleague.adobe.com/docs/commerce-admin/systems/security/captcha/security-google-recaptcha.html). - - Security.txt [user guide](https://docs.magento.com/user-guide/configuration/security/security-txt.html) and [technical guide](https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/security/security-txt.html). + - Two-factor authentication [user guide](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/2fa/security-two-factor-authentication) and [technical guide](https://developer.adobe.com/commerce/testing/functional-testing-framework/two-factor-authentication/). + - Google ReCAPTCHA [user guide](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha) and [technical guide](https://experienceleague.adobe.com/docs/commerce-admin/systems/security/captcha/security-google-recaptcha.html). + - Security.txt [user guide](https://experienceleague.adobe.com/en/docs/commerce-admin/config/security/security-txt) and [technical guide](https://experienceleague.adobe.com/docs/commerce-operations/configuration-guide/security/security-txt.html). ## Community Engineering Slack diff --git a/ReCaptchaAdminUi/README.md b/ReCaptchaAdminUi/README.md index a8905029..4ac86160 100644 --- a/ReCaptchaAdminUi/README.md +++ b/ReCaptchaAdminUi/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA UI files related to views in the admin panel. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaCheckout/README.md b/ReCaptchaCheckout/README.md index 97ceacbf..50e9cf12 100644 --- a/ReCaptchaCheckout/README.md +++ b/ReCaptchaCheckout/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to checkout. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaContact/README.md b/ReCaptchaContact/README.md index 3c1ad04a..3d7c29df 100644 --- a/ReCaptchaContact/README.md +++ b/ReCaptchaContact/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to the contact page. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaCustomer/README.md b/ReCaptchaCustomer/README.md index 4d04a6db..ac8b823e 100644 --- a/ReCaptchaCustomer/README.md +++ b/ReCaptchaCustomer/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to customer actions. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaFrontendUi/README.md b/ReCaptchaFrontendUi/README.md index dafae798..0cc95680 100644 --- a/ReCaptchaFrontendUi/README.md +++ b/ReCaptchaFrontendUi/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the UI related to customer-facing reCAPTCHA views. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaMigration/README.md b/ReCaptchaMigration/README.md index eb1189ad..1b7eb14d 100644 --- a/ReCaptchaMigration/README.md +++ b/ReCaptchaMigration/README.md @@ -1,7 +1,7 @@ # Magento reCAPTCHA -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module helps migrate data from the old reCAPTCHA implementation to the new one. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaNewsletter/README.md b/ReCaptchaNewsletter/README.md index a04d6bef..a468a8fc 100644 --- a/ReCaptchaNewsletter/README.md +++ b/ReCaptchaNewsletter/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to newsletter subscriptions. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaPaypal/README.md b/ReCaptchaPaypal/README.md index 55504ff0..8193b708 100644 --- a/ReCaptchaPaypal/README.md +++ b/ReCaptchaPaypal/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to PayPal payments. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaReview/README.md b/ReCaptchaReview/README.md index 081a06f1..cd06808e 100644 --- a/ReCaptchaReview/README.md +++ b/ReCaptchaReview/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to product reviews. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaSendFriend/README.md b/ReCaptchaSendFriend/README.md index da18f865..b37ba418 100644 --- a/ReCaptchaSendFriend/README.md +++ b/ReCaptchaSendFriend/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to store send to friend actions. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaStorePickup/README.md b/ReCaptchaStorePickup/README.md index b8b5b1a1..0eb382f6 100644 --- a/ReCaptchaStorePickup/README.md +++ b/ReCaptchaStorePickup/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to store pickup actions. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaUi/README.md b/ReCaptchaUi/README.md index e91c7e43..7e5fbac4 100644 --- a/ReCaptchaUi/README.md +++ b/ReCaptchaUi/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module contains the base UI related to all reCAPTCHA features. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaUser/README.md b/ReCaptchaUser/README.md index 5bf8739b..5872c22d 100644 --- a/ReCaptchaUser/README.md +++ b/ReCaptchaUser/README.md @@ -4,7 +4,7 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementations related to user actions. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). ## Emergency commandline disable for Admin panel Login page: diff --git a/ReCaptchaValidation/README.md b/ReCaptchaValidation/README.md index a5f0548c..5e733e7e 100644 --- a/ReCaptchaValidation/README.md +++ b/ReCaptchaValidation/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the base implementation for reCAPTCHA. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaValidationApi/README.md b/ReCaptchaValidationApi/README.md index 6da66c85..96c4ecfc 100644 --- a/ReCaptchaValidationApi/README.md +++ b/ReCaptchaValidationApi/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the service contracts for the base reCAPTCHA implementation. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaVersion2Checkbox/README.md b/ReCaptchaVersion2Checkbox/README.md index e5b30cf6..9c34cefa 100644 --- a/ReCaptchaVersion2Checkbox/README.md +++ b/ReCaptchaVersion2Checkbox/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementation for the V2 Checkbox variation. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaVersion2Invisible/README.md b/ReCaptchaVersion2Invisible/README.md index 76cdb3b6..b0b1a769 100644 --- a/ReCaptchaVersion2Invisible/README.md +++ b/ReCaptchaVersion2Invisible/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementation for the V2 Invisible variation. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaVersion3Invisible/README.md b/ReCaptchaVersion3Invisible/README.md index f1500134..b9e29e54 100644 --- a/ReCaptchaVersion3Invisible/README.md +++ b/ReCaptchaVersion3Invisible/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the reCAPTCHA implementation for the V3 Invisible variation. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiApi/README.md b/ReCaptchaWebapiApi/README.md index 13640a31..00796604 100644 --- a/ReCaptchaWebapiApi/README.md +++ b/ReCaptchaWebapiApi/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the service contracts related to the base reCAPTCHA implementation. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiGraphQl/README.md b/ReCaptchaWebapiGraphQl/README.md index 81fd5d70..317ab6d7 100644 --- a/ReCaptchaWebapiGraphQl/README.md +++ b/ReCaptchaWebapiGraphQl/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the GraphQl implementation of reCAPTCHA. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiRest/README.md b/ReCaptchaWebapiRest/README.md index cb9f3abe..de2986ae 100644 --- a/ReCaptchaWebapiRest/README.md +++ b/ReCaptchaWebapiRest/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the WebAPI REST implementation of reCAPTCHA. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiUi/README.md b/ReCaptchaWebapiUi/README.md index 68524ec4..e128292b 100644 --- a/ReCaptchaWebapiUi/README.md +++ b/ReCaptchaWebapiUi/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or “bot This module provides the UI files related to the WebAPI implementation of reCAPTCHA. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/TwoFactorAuth/README.md b/TwoFactorAuth/README.md index 0ec6f9a0..9b0544ab 100644 --- a/TwoFactorAuth/README.md +++ b/TwoFactorAuth/README.md @@ -2,4 +2,4 @@ The Magento Admin provides all access to your store, orders, and customer data. To prevent unauthorized access to your data, all users who attempt to sign in to the Admin of your Magento installation must complete a second step to verify their identity. -For more information please view the Magento documentation for [a general guide on 2fa](https://docs.magento.com/user-guide/stores/security-two-factor-authentication.html) as well as a [a more technical guide](https://developer.adobe.com/commerce/testing/functional-testing-framework/two-factor-authentication/). +For more information please view the Magento documentation for [a general guide on 2fa](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/2fa/security-two-factor-authentication) as well as a [a more technical guide](https://developer.adobe.com/commerce/testing/functional-testing-framework/two-factor-authentication/). From 562b4b85eb62366fe43f00553566d6b1be1a998f Mon Sep 17 00:00:00 2001 From: Sergio Vera <sergio.vera@gmail.com> Date: Thu, 18 Apr 2024 14:46:44 +0200 Subject: [PATCH 104/208] LYNX-390: Recaptcha for Resending Email Confirmation mutation --- .../Model/WebapiConfigProvider.php | 61 ++++++++++++++++++ .../ResendConfirmationEmailObserver.php | 62 +++++++++++++++++++ ReCaptchaResendConfirmationEmail/README.md | 7 +++ .../ResendConfirmationEmailTest.php | 55 ++++++++++++++++ .../composer.json | 22 +++++++ .../etc/adminhtml/system.xml | 32 ++++++++++ .../etc/config.xml | 28 +++++++++ ReCaptchaResendConfirmationEmail/etc/di.xml | 28 +++++++++ .../etc/module.xml | 22 +++++++ .../registration.php | 21 +++++++ ReCaptchaWebapiGraphQl/etc/schema.graphqls | 1 + _metapackage/composer.json | 1 + 12 files changed, 340 insertions(+) create mode 100644 ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php create mode 100644 ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php create mode 100644 ReCaptchaResendConfirmationEmail/README.md create mode 100644 ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php create mode 100644 ReCaptchaResendConfirmationEmail/composer.json create mode 100644 ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml create mode 100644 ReCaptchaResendConfirmationEmail/etc/config.xml create mode 100644 ReCaptchaResendConfirmationEmail/etc/di.xml create mode 100644 ReCaptchaResendConfirmationEmail/etc/module.xml create mode 100644 ReCaptchaResendConfirmationEmail/registration.php diff --git a/ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php b/ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php new file mode 100644 index 00000000..1df7d4d4 --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php @@ -0,0 +1,61 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaResendConfirmationEmail\Model; + +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaUi\Model\ValidationConfigResolverInterface; +use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; +use Magento\ReCaptchaWebapiApi\Api\Data\EndpointInterface; +use Magento\ReCaptchaWebapiApi\Api\WebapiValidationConfigProviderInterface; +use Magento\CustomerGraphQl\Model\Resolver\ResendConfirmationEmail; + +/** + * Provide ResendConfirmationEmail related endpoint configuration. + */ +class WebapiConfigProvider implements WebapiValidationConfigProviderInterface +{ + /** + * Captcha id from config. + */ + private const CAPTCHA_ID = 'resend_confirmation_email'; + + /** + * @param IsCaptchaEnabledInterface $isEnabled + * @param ValidationConfigResolverInterface $configResolver + */ + public function __construct( + private readonly IsCaptchaEnabledInterface $isEnabled, + private readonly ValidationConfigResolverInterface $configResolver + ) { + } + + /** + * @inheritDoc + */ + public function getConfigFor(EndpointInterface $endpoint): ?ValidationConfigInterface + { + if ($endpoint->getServiceMethod() === 'resolve' + && $endpoint->getServiceClass() === ResendConfirmationEmail::class + ) { + if ($this->isEnabled->isCaptchaEnabledFor(self::CAPTCHA_ID)) { + return $this->configResolver->get(self::CAPTCHA_ID); + } + } + + return null; + } +} diff --git a/ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php b/ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php new file mode 100644 index 00000000..0d8129e3 --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php @@ -0,0 +1,62 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaResendConfirmationEmail\Observer; + +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Response\RedirectInterface; +use Magento\Framework\Event\Observer; +use Magento\Framework\Event\ObserverInterface; +use Magento\Framework\Exception\LocalizedException; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaUi\Model\RequestHandlerInterface; + +class ResendConfirmationEmailObserver implements ObserverInterface +{ + private const KEY = 'resend_confirmation_email'; + + /** + * @param RedirectInterface $redirect + * @param IsCaptchaEnabledInterface $isCaptchaEnabled + * @param RequestHandlerInterface $requestHandler + */ + public function __construct( + private readonly RedirectInterface $redirect, + private readonly IsCaptchaEnabledInterface $isCaptchaEnabled, + private readonly RequestHandlerInterface $requestHandler + ) { + } + + /** + * Check captcha result if captcha has been enabled for this endpoint + * + * @param Observer $observer + * @return void + * @throws LocalizedException + */ + public function execute(Observer $observer): void + { + if ($this->isCaptchaEnabled->isCaptchaEnabledFor(self::KEY)) { + /** @var Action $controller */ + $controller = $observer->getControllerAction(); + $request = $controller->getRequest(); + $response = $controller->getResponse(); + $redirectOnFailureUrl = $this->redirect->getRefererUrl(); + + $this->requestHandler->execute(self::KEY, $request, $response, $redirectOnFailureUrl); + } + } +} diff --git a/ReCaptchaResendConfirmationEmail/README.md b/ReCaptchaResendConfirmationEmail/README.md new file mode 100644 index 00000000..c07b1646 --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/README.md @@ -0,0 +1,7 @@ +# Magento reCAPTCHA + +Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. + +This module provides the reCAPTCHA implementations related to resend confirmation email action. + +For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). diff --git a/ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php b/ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php new file mode 100644 index 00000000..01733bcc --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaResendConfirmationEmail\Test\Api\GraphQl\ResendConfirmationEmail; + +use Magento\TestFramework\Fixture\Config as ConfigFixture; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * GraphQl test for resend confirmation email functionality with ReCaptcha enabled. + */ +class ResendConfirmationEmailTest extends GraphQlAbstract +{ + + #[ + ConfigFixture('recaptcha_frontend/type_invisible/public_key', 'test_public_key'), + ConfigFixture('recaptcha_frontend/type_invisible/private_key', 'test_private_key'), + ConfigFixture('recaptcha_frontend/type_for/resend_confirmation_email', 'invisible') + ] + public function testResendConfirmationEmailReCaptchaValidationFailed(): void + { + $query = $this->getQuery("test@example.com"); + + $this->expectExceptionMessage('ReCaptcha validation failed, please try again'); + $this->graphQlMutation($query); + } + + /** + * @param string $email + * @return string + */ + private function getQuery(string $email): string + { + return <<<QUERY +mutation { + resendConfirmationEmail( + email: "{$email}" + ) +} +QUERY; + } +} diff --git a/ReCaptchaResendConfirmationEmail/composer.json b/ReCaptchaResendConfirmationEmail/composer.json new file mode 100644 index 00000000..ab62a3e1 --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/composer.json @@ -0,0 +1,22 @@ +{ + "name": "magento/module-re-captcha-resend-confirmation-email", + "description": "Google reCAPTCHA integration for Magento2", + "require": { + "php": "~8.1.0||~8.2.0||~8.3.0", + "magento/framework": "*", + "magento/module-re-captcha-ui": "*", + "magento/module-re-captcha-validation-api": "*", + "magento/module-re-captcha-webapi-api": "*", + "magento/module-customer-graph-ql": "*" + }, + "type": "magento2-module", + "license": "OSL-3.0", + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\ReCaptchaResendConfirmationEmail\\": "" + } + } +} diff --git a/ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml b/ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml new file mode 100644 index 00000000..2eaab50b --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<!-- +/************************************************************************ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + * ************************************************************************ + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> + <system> + <section id="recaptcha_frontend"> + <group id="type_for"> + <field id="resend_confirmation_email" translate="label" type="select" sortOrder="170" showInDefault="1" + showInWebsite="1" showInStore="0" canRestore="1"> + <label>Enable for Resend Confirmation Email</label> + <source_model>Magento\ReCaptchaAdminUi\Model\OptionSource\Type</source_model> + </field> + </group> + </section> + </system> +</config> diff --git a/ReCaptchaResendConfirmationEmail/etc/config.xml b/ReCaptchaResendConfirmationEmail/etc/config.xml new file mode 100644 index 00000000..ffca5578 --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/etc/config.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<!-- +/************************************************************************ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + * ************************************************************************ + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> + <default> + <recaptcha_frontend> + <type_for> + <resend_confirmation_email/> + </type_for> + </recaptcha_frontend> + </default> +</config> diff --git a/ReCaptchaResendConfirmationEmail/etc/di.xml b/ReCaptchaResendConfirmationEmail/etc/di.xml new file mode 100644 index 00000000..3089cd0a --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/etc/di.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<!-- +/************************************************************************ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + * ************************************************************************ + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> + <arguments> + <argument name="providers" xsi:type="array"> + <item name="resend_confirmation_email" xsi:type="object">Magento\ReCaptchaResendConfirmationEmail\Model\WebapiConfigProvider</item> + </argument> + </arguments> + </type> +</config> diff --git a/ReCaptchaResendConfirmationEmail/etc/module.xml b/ReCaptchaResendConfirmationEmail/etc/module.xml new file mode 100644 index 00000000..8b07d8c0 --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/etc/module.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<!-- +/************************************************************************ + * + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe. + * ************************************************************************ + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> + <module name="Magento_ReCaptchaResendConfirmationEmail"/> +</config> diff --git a/ReCaptchaResendConfirmationEmail/registration.php b/ReCaptchaResendConfirmationEmail/registration.php new file mode 100644 index 00000000..fb4277d6 --- /dev/null +++ b/ReCaptchaResendConfirmationEmail/registration.php @@ -0,0 +1,21 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe and its suppliers, if any. The intellectual + * and technical concepts contained herein are proprietary to Adobe + * and its suppliers and are protected by all applicable intellectual + * property laws, including trade secret and copyright laws. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained from + * Adobe. + */ +declare(strict_types=1); + +\Magento\Framework\Component\ComponentRegistrar::register( + \Magento\Framework\Component\ComponentRegistrar::MODULE, + 'Magento_ReCaptchaResendConfirmationEmail', + __DIR__ +); diff --git a/ReCaptchaWebapiGraphQl/etc/schema.graphqls b/ReCaptchaWebapiGraphQl/etc/schema.graphqls index ac15158b..2887d4da 100644 --- a/ReCaptchaWebapiGraphQl/etc/schema.graphqls +++ b/ReCaptchaWebapiGraphQl/etc/schema.graphqls @@ -17,6 +17,7 @@ enum ReCaptchaFormEnum { PRODUCT_REVIEW SENDFRIEND BRAINTREE + RESEND_CONFIRMATION_EMAIL } enum ReCaptchaTypeEmum { diff --git a/_metapackage/composer.json b/_metapackage/composer.json index 23d52829..91885e9c 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -11,6 +11,7 @@ "magento/module-re-captcha-migration": "*", "magento/module-re-captcha-newsletter": "*", "magento/module-re-captcha-paypal": "*", + "magento/module-re-captcha-resend-confirmation-email": "*", "magento/module-re-captcha-review": "*", "magento/module-re-captcha-send-friend": "*", "magento/module-re-captcha-store-pickup": "*", From a78a900ac9cd5ce036de2b87d51ce799aefd0fda Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Mon, 6 May 2024 19:31:29 +0530 Subject: [PATCH 105/208] #AC-11762-Update 2FA OTP window field with correct description and default value after BiC change-updated command logic and added upgrade script --- .../Model/Config/Backend/OtpWindow.php | 56 ++++++++++++++ .../Setup/Patch/Data/UpdateOtpWindow.php | 75 +++++++++++++++++++ TwoFactorAuth/etc/adminhtml/system.xml | 1 + TwoFactorAuth/etc/config.xml | 2 +- 4 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 TwoFactorAuth/Model/Config/Backend/OtpWindow.php create mode 100644 TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php diff --git a/TwoFactorAuth/Model/Config/Backend/OtpWindow.php b/TwoFactorAuth/Model/Config/Backend/OtpWindow.php new file mode 100644 index 00000000..0cde8325 --- /dev/null +++ b/TwoFactorAuth/Model/Config/Backend/OtpWindow.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TwoFactorAuth\Model\Config\Backend; + +use Magento\Framework\App\Config\Value; +use Magento\Framework\App\Config\Data\ProcessorInterface; +use Magento\Framework\Exception\ValidatorException; +use OTPHP\TOTPInterface; + +class OtpWindow extends Value implements ProcessorInterface +{ + /** + * @return int + */ + private function getDefaultPeriod(): int + { + return TOTPInterface::DEFAULT_PERIOD; + } + + /** + * Process the value before saving. + * + * @param mixed $value The configuration value. + * @return mixed The processed value. + * @throws ValidatorException If the value is invalid. + */ + public function processValue($value) + { + if (!is_numeric($value)) { + throw new ValidatorException(__('The OTP window must be a numeric value.')); + } + $numericValue = (int) $value; + return $numericValue; + } + + /** + * Validates the value before saving. + * + * @throws ValidatorException If the value is invalid. + */ + public function beforeSave() + { + $value = $this->getValue(); + $period = $this->getDefaultPeriod(); + if (!is_numeric($value) || $value < 1 || $value >= $period) { + throw new ValidatorException(__('Invalid OTP window value. It must be less than the OTP period value '.$period)); + } + + return parent::beforeSave(); + } +} diff --git a/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php b/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php new file mode 100644 index 00000000..227d0e34 --- /dev/null +++ b/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php @@ -0,0 +1,75 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TwoFactorAuth\Setup\Patch\Data; + +use Magento\Framework\Setup\Patch\DataPatchInterface; +use Magento\Framework\Setup\ModuleDataSetupInterface; +use OTPHP\TOTPInterface; + +class UpdateOtpWindow implements DataPatchInterface +{ + /** + * @var ModuleDataSetupInterface + */ + private $moduleDataSetup; + + public function __construct(ModuleDataSetupInterface $moduleDataSetup) + { + $this->moduleDataSetup = $moduleDataSetup; + } + + public function getDefaultPeriod() + { + return TOTPInterface::DEFAULT_PERIOD; + } + + /** + * Apply the data patch + */ + public function apply() + { + $setup = $this->moduleDataSetup->getConnection(); + $setup->startSetup(); + $select = $setup->select() + ->from('core_config_data', ['path']) + ->where('path = ?', 'twofactorauth/google/otp_window'); + + $existingValue = $setup->fetchOne($select); + $period = $this->getDefaultPeriod(); + if ($existingValue && $existingValue >= $period) { + $newWindowValue = $period - 1; + } + + if ($existingValue) { + $setup->update( + 'core_config_data', + ['value' => $newWindowValue], + 'path = "twofactorauth/google/otp_window"' + ); + } + + $setup->endSetup(); + } + + /** + * @inheritdoc + */ + public static function getDependencies() + { + return []; + } + + /** + * @inheritdoc + */ + public function getAliases() + { + return []; + } + +} diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 7086746b..9c5e673f 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -43,6 +43,7 @@ showInWebsite="0" showInStore="0" canRestore="1"> <label>OTP Window</label> <comment>This determines how long the one-time-passwords are valid for. An OTP Window of 1 will result in the current OTP value plus 1 code in the past and 1 code in the future to be valid at any given point in time.</comment> + <backend_model>Magento\TwoFactorAuth\Model\Config\Backend\OtpWindow</backend_model> </field> </group> <group id="duo" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 515a4ae9..a6b97788 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -21,7 +21,7 @@ <application_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </duo> <google> - <otp_window>1</otp_window> + <otp_window backend_model="Magento\TwoFactorAuth\Model\Config\Backend\OtpWindow">1</otp_window> </google> </twofactorauth> </default> From 35f0e82eaac71e931726a12413d03c5371a4caf8 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 8 May 2024 18:37:08 +0530 Subject: [PATCH 106/208] #AC-11762-Update 2FA OTP window field with correct description and default value after BiC change-code review changes on copyright --- TwoFactorAuth/Model/Config/Backend/OtpWindow.php | 4 ++-- TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/TwoFactorAuth/Model/Config/Backend/OtpWindow.php b/TwoFactorAuth/Model/Config/Backend/OtpWindow.php index 0cde8325..0c1ff7d1 100644 --- a/TwoFactorAuth/Model/Config/Backend/OtpWindow.php +++ b/TwoFactorAuth/Model/Config/Backend/OtpWindow.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php b/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php index 227d0e34..5fb1e8ec 100644 --- a/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php +++ b/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); From 32724ef2b3c8c3d4cc85b5ecc0461b2bd1319cfb Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Sat, 11 May 2024 23:47:31 +0530 Subject: [PATCH 107/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Block/Provider/Google/Auth.php | 26 +++++++++++++++++++ TwoFactorAuth/etc/adminhtml/system.xml | 5 ++++ .../view/adminhtml/web/js/google/auth.js | 17 ++++++++++++ 3 files changed, 48 insertions(+) diff --git a/TwoFactorAuth/Block/Provider/Google/Auth.php b/TwoFactorAuth/Block/Provider/Google/Auth.php index 221c44ca..e7005095 100644 --- a/TwoFactorAuth/Block/Provider/Google/Auth.php +++ b/TwoFactorAuth/Block/Provider/Google/Auth.php @@ -8,12 +8,35 @@ namespace Magento\TwoFactorAuth\Block\Provider\Google; use Magento\Backend\Block\Template; +use Magento\Framework\App\Config\ScopeConfigInterface; /** * @api */ class Auth extends Template { + /** + * Config path for the 2FA Attempts + */ + public const XML_PATH_2FA_RETRY_ATTEMPTS = 'twofactorauth/general/twofactorauth_retry'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @param ScopeConfigInterface|null $scopeConfig + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + ScopeConfigInterface $scopeConfig, + array $data = [] + ) { + parent::__construct($context, $data); + $this->scopeConfig = $scopeConfig; + } + /** * @inheritdoc */ @@ -25,6 +48,9 @@ public function getJsLayout() $this->jsLayout['components']['tfa-auth']['successUrl'] = $this->getUrl($this->_urlBuilder->getStartupPageUrl()); + $this->jsLayout['components']['tfa-auth']['attempts'] = + $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); + return parent::getJsLayout(); } } diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 7086746b..ba8522eb 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -35,6 +35,11 @@ <label>Configuration Email URL for Web API</label> <comment>This can be used to override the default email configuration link that is sent when using the Magento Web API's to authenticate. Use the placeholder :tfat to indicate where the token should be injected</comment> </field> + <field canRestore="1" id="twofactorauth_retry" translate="label" type="text" sortOrder="40" + showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Configuration for 2FA retry attempts</label> + <comment>Security configurations for TowFatcorAuth page. To avoid the bruteforce of twofactorauth API</comment> + </field> </group> <group id="google" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> diff --git a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js index 02f57d3d..972274e3 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js @@ -11,6 +11,8 @@ define([ ], function ($, ko, Component, error) { 'use strict'; + let attempts = 0; + return Component.extend({ currentStep: ko.observable('register'), waitText: ko.observable(''), @@ -40,6 +42,14 @@ define([ return this.postUrl; }, + /** + * Get Retry Attempts + * @returns {int} + */ + getRetryAttempts: function () { + return this.attempts; + }, + /** * Get plain Secret Code * @returns {String} @@ -62,6 +72,13 @@ define([ doVerify: function () { var me = this; + attempts++; + if (attempts > this.getRetryAttempts()){ + alert("Maximum otp retries are done."); + location.href = $(".tfa-logout-link").attr("href"); + return; + } + this.waitText('Please wait...'); $.post(this.getPostUrl(), { 'tfa_code': this.verifyCode() From 9ff0e509b8a51bf8faeec91479cf9d3a59ac3afe Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Tue, 14 May 2024 14:01:13 +0530 Subject: [PATCH 108/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Block/Provider/Google/Auth.php | 4 +++- TwoFactorAuth/view/adminhtml/web/js/google/auth.js | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/TwoFactorAuth/Block/Provider/Google/Auth.php b/TwoFactorAuth/Block/Provider/Google/Auth.php index e7005095..a668790c 100644 --- a/TwoFactorAuth/Block/Provider/Google/Auth.php +++ b/TwoFactorAuth/Block/Provider/Google/Auth.php @@ -26,7 +26,9 @@ class Auth extends Template private $scopeConfig; /** - * @param ScopeConfigInterface|null $scopeConfig + * @param \Magento\Backend\Block\Template\Context $context + * @param ScopeConfigInterface $scopeConfig + * @param array $data */ public function __construct( \Magento\Backend\Block\Template\Context $context, diff --git a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js index 972274e3..82df7499 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js @@ -73,9 +73,9 @@ define([ var me = this; attempts++; - if (attempts > this.getRetryAttempts()){ - alert("Maximum otp retries are done."); - location.href = $(".tfa-logout-link").attr("href"); + if (attempts > this.getRetryAttempts()) { + console.log('Maximum otp retries are done.'); + location.href = $('.tfa-logout-link').attr('href'); return; } From 38524f6dffdfe0e994b6e93cc76ff20de8cced5b Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 15 May 2024 15:42:11 +0530 Subject: [PATCH 109/208] #AC-11762::Update 2FA OTP window field with correct description and default value after BiC change-fixes for static tests failures --- TwoFactorAuth/Model/Config/Backend/OtpWindow.php | 10 +++++++++- .../Setup/Patch/Data/UpdateOtpWindow.php | 15 ++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/TwoFactorAuth/Model/Config/Backend/OtpWindow.php b/TwoFactorAuth/Model/Config/Backend/OtpWindow.php index 0c1ff7d1..97d19a88 100644 --- a/TwoFactorAuth/Model/Config/Backend/OtpWindow.php +++ b/TwoFactorAuth/Model/Config/Backend/OtpWindow.php @@ -15,6 +15,8 @@ class OtpWindow extends Value implements ProcessorInterface { /** + * Fetch Totp default period value + * * @return int */ private function getDefaultPeriod(): int @@ -48,7 +50,13 @@ public function beforeSave() $value = $this->getValue(); $period = $this->getDefaultPeriod(); if (!is_numeric($value) || $value < 1 || $value >= $period) { - throw new ValidatorException(__('Invalid OTP window value. It must be less than the OTP period value '.$period)); + throw new ValidatorException( + __( + 'Invalid OTP window value. It must be between 1 and %1 as default period is %2', + $period-1, + $period + ) + ); } return parent::beforeSave(); diff --git a/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php b/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php index 5fb1e8ec..aacd956b 100644 --- a/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php +++ b/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php @@ -18,11 +18,19 @@ class UpdateOtpWindow implements DataPatchInterface */ private $moduleDataSetup; + /** + * @param ModuleDataSetupInterface $moduleDataSetup + */ public function __construct(ModuleDataSetupInterface $moduleDataSetup) { $this->moduleDataSetup = $moduleDataSetup; } + /** + * Fetch Totp default period + * + * @return int + */ public function getDefaultPeriod() { return TOTPInterface::DEFAULT_PERIOD; @@ -43,17 +51,15 @@ public function apply() $period = $this->getDefaultPeriod(); if ($existingValue && $existingValue >= $period) { $newWindowValue = $period - 1; - } - - if ($existingValue) { $setup->update( 'core_config_data', ['value' => $newWindowValue], 'path = "twofactorauth/google/otp_window"' ); } - $setup->endSetup(); + + return $this; } /** @@ -71,5 +77,4 @@ public function getAliases() { return []; } - } From bcf44ac4d4f00c61e130ad33912a38ccf84d3051 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Wed, 15 May 2024 15:53:12 +0530 Subject: [PATCH 110/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Block/Provider/Authy/Auth.php | 28 +++++++++++++++++++ TwoFactorAuth/etc/config.xml | 1 + .../view/adminhtml/web/js/authy/auth.js | 16 +++++++++++ 3 files changed, 45 insertions(+) diff --git a/TwoFactorAuth/Block/Provider/Authy/Auth.php b/TwoFactorAuth/Block/Provider/Authy/Auth.php index 18182240..3f5281ff 100644 --- a/TwoFactorAuth/Block/Provider/Authy/Auth.php +++ b/TwoFactorAuth/Block/Provider/Authy/Auth.php @@ -8,12 +8,37 @@ namespace Magento\TwoFactorAuth\Block\Provider\Authy; use Magento\Backend\Block\Template; +use Magento\Framework\App\Config\ScopeConfigInterface; /** * @api */ class Auth extends Template { + /** + * Config path for the 2FA Attempts + */ + private const XML_PATH_2FA_RETRY_ATTEMPTS = 'twofactorauth/general/twofactorauth_retry'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @param \Magento\Backend\Block\Template\Context $context + * @param ScopeConfigInterface $scopeConfig + * @param array $data + */ + public function __construct( + \Magento\Backend\Block\Template\Context $context, + ScopeConfigInterface $scopeConfig, + array $data = [] + ) { + parent::__construct($context, $data); + $this->scopeConfig = $scopeConfig; + } + /** * @inheritdoc */ @@ -34,6 +59,9 @@ public function getJsLayout() $this->jsLayout['components']['tfa-auth']['successUrl'] = $this->getUrl($this->_urlBuilder->getStartupPageUrl()); + $this->jsLayout['components']['tfa-auth']['attempts'] = + $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); + return parent::getJsLayout(); } } diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 515a4ae9..9b6f1bf7 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -11,6 +11,7 @@ <twofactorauth> <general> <force_providers></force_providers> + <twofactorauth_retry>10</twofactorauth_retry> </general> <authy> <onetouch_message>Login request to your Magento Admin</onetouch_message> diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js index 5048adc0..6340347f 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js @@ -12,6 +12,7 @@ define([ ], function ($, ko, Component, error) { 'use strict'; + let attempts = 0; return Component.extend({ selectedMethod: ko.observable(''), waitingText: ko.observable(''), @@ -190,12 +191,27 @@ define([ this.success(false); }, + /** + * Get Retry Attempts + * @returns {int} + */ + getRetryAttempts: function () { + return this.attempts; + }, + /** * Verify authy code */ verifyCode: function () { var me = this; + attempts++; + if (attempts > this.getRetryAttempts()) { + console.log('Maximum otp retries are done.'); + location.href = $('.tfa-logout-link').attr('href'); + return; + } + this.waitingText('Please wait...'); $.post(this.getPostUrl(), { From c3c1eddab046989688da57ffe1fc3f3aac208199 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Wed, 15 May 2024 18:35:39 +0530 Subject: [PATCH 111/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/view/adminhtml/web/js/authy/auth.js | 1 + 1 file changed, 1 insertion(+) diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js index 6340347f..afc7513e 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js @@ -13,6 +13,7 @@ define([ 'use strict'; let attempts = 0; + return Component.extend({ selectedMethod: ko.observable(''), waitingText: ko.observable(''), From 170cd750b9d5436124f41ecb673333047e8220d5 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 17 May 2024 16:47:30 +0530 Subject: [PATCH 112/208] #AC-11762::Update 2FA OTP window field with correct description and default value after BiC change-command logic changes and upgrade data script for otp window with Bic changes --- .../Model/Config/Backend/{OtpWindow.php => Leeway.php} | 6 +++--- TwoFactorAuth/Model/Provider/Engine/Google.php | 4 ++-- .../Patch/Data/{UpdateOtpWindow.php => UpdateLeeway.php} | 6 +++--- TwoFactorAuth/Test/Api/GoogleActivateTest.php | 2 +- TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php | 2 +- TwoFactorAuth/etc/adminhtml/system.xml | 8 ++++---- TwoFactorAuth/etc/config.xml | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) rename TwoFactorAuth/Model/Config/Backend/{OtpWindow.php => Leeway.php} (84%) rename TwoFactorAuth/Setup/Patch/Data/{UpdateOtpWindow.php => UpdateLeeway.php} (89%) diff --git a/TwoFactorAuth/Model/Config/Backend/OtpWindow.php b/TwoFactorAuth/Model/Config/Backend/Leeway.php similarity index 84% rename from TwoFactorAuth/Model/Config/Backend/OtpWindow.php rename to TwoFactorAuth/Model/Config/Backend/Leeway.php index 97d19a88..bb45d0e1 100644 --- a/TwoFactorAuth/Model/Config/Backend/OtpWindow.php +++ b/TwoFactorAuth/Model/Config/Backend/Leeway.php @@ -12,7 +12,7 @@ use Magento\Framework\Exception\ValidatorException; use OTPHP\TOTPInterface; -class OtpWindow extends Value implements ProcessorInterface +class Leeway extends Value implements ProcessorInterface { /** * Fetch Totp default period value @@ -34,7 +34,7 @@ private function getDefaultPeriod(): int public function processValue($value) { if (!is_numeric($value)) { - throw new ValidatorException(__('The OTP window must be a numeric value.')); + throw new ValidatorException(__('The Leeway must be a numeric value.')); } $numericValue = (int) $value; return $numericValue; @@ -52,7 +52,7 @@ public function beforeSave() if (!is_numeric($value) || $value < 1 || $value >= $period) { throw new ValidatorException( __( - 'Invalid OTP window value. It must be between 1 and %1 as default period is %2', + 'Invalid Leeway value. It must be between 1 and %1 as default period is %2', $period-1, $period ) diff --git a/TwoFactorAuth/Model/Provider/Engine/Google.php b/TwoFactorAuth/Model/Provider/Engine/Google.php index 9d77ba90..415f501d 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Google.php +++ b/TwoFactorAuth/Model/Provider/Engine/Google.php @@ -35,7 +35,7 @@ class Google implements EngineInterface /** * Config path for the OTP window */ - const XML_PATH_OTP_WINDOW = 'twofactorauth/google/otp_window'; + public const XML_PATH_LEEWAY = 'twofactorauth/google/leeway'; /** * Engine code @@ -199,7 +199,7 @@ public function verify(UserInterface $user, DataObject $request): bool return $totp->verify( $token, null, - $config['window'] ?? (int)$this->scopeConfig->getValue(self::XML_PATH_OTP_WINDOW) ?: null + $config['window'] ?? (int)$this->scopeConfig->getValue(self::XML_PATH_LEEWAY) ?: null ); } diff --git a/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php b/TwoFactorAuth/Setup/Patch/Data/UpdateLeeway.php similarity index 89% rename from TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php rename to TwoFactorAuth/Setup/Patch/Data/UpdateLeeway.php index aacd956b..98826317 100644 --- a/TwoFactorAuth/Setup/Patch/Data/UpdateOtpWindow.php +++ b/TwoFactorAuth/Setup/Patch/Data/UpdateLeeway.php @@ -11,7 +11,7 @@ use Magento\Framework\Setup\ModuleDataSetupInterface; use OTPHP\TOTPInterface; -class UpdateOtpWindow implements DataPatchInterface +class UpdateLeeway implements DataPatchInterface { /** * @var ModuleDataSetupInterface @@ -45,7 +45,7 @@ public function apply() $setup->startSetup(); $select = $setup->select() ->from('core_config_data', ['path']) - ->where('path = ?', 'twofactorauth/google/otp_window'); + ->where('path = ?', 'twofactorauth/google/leeway'); $existingValue = $setup->fetchOne($select); $period = $this->getDefaultPeriod(); @@ -54,7 +54,7 @@ public function apply() $setup->update( 'core_config_data', ['value' => $newWindowValue], - 'path = "twofactorauth/google/otp_window"' + 'path = "twofactorauth/google/leeway"' ); } $setup->endSetup(); diff --git a/TwoFactorAuth/Test/Api/GoogleActivateTest.php b/TwoFactorAuth/Test/Api/GoogleActivateTest.php index 73087341..cdae4865 100644 --- a/TwoFactorAuth/Test/Api/GoogleActivateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleActivateTest.php @@ -129,7 +129,7 @@ public function testAlreadyActivatedProvider() /** * @magentoConfigFixture twofactorauth/general/force_providers google * @magentoApiDataFixture Magento/User/_files/user_with_custom_role.php - * @magentoConfigFixture twofactorauth/google/otp_window 20 + * @magentoConfigFixture twofactorauth/google/leeway 29 */ public function testActivate() { diff --git a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php index 101b9379..ef54a531 100644 --- a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php @@ -223,7 +223,7 @@ public function testNotConfiguredProvider(): void /** * @magentoConfigFixture twofactorauth/general/force_providers google * @magentoApiDataFixture Magento/User/_files/user_with_custom_role.php - * @magentoConfigFixture twofactorauth/google/otp_window 20 + * @magentoConfigFixture twofactorauth/google/leeway 29 * * @return void */ diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 9c5e673f..257b2a62 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -39,11 +39,11 @@ <group id="google" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Google</label> - <field id="otp_window" translate="label comment" type="text" sortOrder="10" showInDefault="1" + <field id="leeway" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0" canRestore="1"> - <label>OTP Window</label> - <comment>This determines how long the one-time-passwords are valid for. An OTP Window of 1 will result in the current OTP value plus 1 code in the past and 1 code in the future to be valid at any given point in time.</comment> - <backend_model>Magento\TwoFactorAuth\Model\Config\Backend\OtpWindow</backend_model> + <label>Leeway</label> + <comment>This sets the time drift leeway for OTPs. A leeway of 29 with a period of 30 means OTPs are valid within ±29 seconds from the current time. The leeway must be smaller than the period</comment> + <backend_model>Magento\TwoFactorAuth\Model\Config\Backend\Leeway</backend_model> </field> </group> <group id="duo" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index a6b97788..6333af28 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -21,7 +21,7 @@ <application_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </duo> <google> - <otp_window backend_model="Magento\TwoFactorAuth\Model\Config\Backend\OtpWindow">1</otp_window> + <leeway backend_model="Magento\TwoFactorAuth\Model\Config\Backend\Leeway">29</leeway> </google> </twofactorauth> </default> From a8f42f16cb4b386fa9231c9fd881a7e2842cd247 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Mon, 20 May 2024 14:44:41 +0530 Subject: [PATCH 113/208] AC-9797: 2FA functionality enhancement --- .../Controller/Adminhtml/Authy/Authpost.php | 62 ++++++++++++++-- .../Controller/Adminhtml/Google/Authpost.php | 74 ++++++++++++++++--- TwoFactorAuth/etc/adminhtml/system.xml | 9 ++- TwoFactorAuth/etc/config.xml | 1 + .../view/adminhtml/web/js/authy/auth.js | 17 ----- .../view/adminhtml/web/js/google/auth.js | 17 ----- 6 files changed, 126 insertions(+), 54 deletions(-) diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php index 1fd18f93..41edbfff 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -19,6 +19,8 @@ use Magento\TwoFactorAuth\Controller\Adminhtml\AbstractAction; use Magento\TwoFactorAuth\Model\Provider\Engine\Authy; use Magento\User\Model\User; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\User\Model\ResourceModel\User as UserResource; /** * @SuppressWarnings(PHPMD.CamelCaseMethodName) @@ -60,6 +62,26 @@ class Authpost extends AbstractAction implements HttpPostActionInterface */ private $alert; + /** + * Config path for the 2FA Attempts + */ + private const XML_PATH_2FA_RETRY_ATTEMPTS = 'twofactorauth/general/twofactorauth_retry'; + + /** + * Config path for the 2FA Attempts + */ + private const XML_PATH_2FA_LOCK_EXPIRE = 'twofactorauth/general/auth_lock_expire'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @var UserResource + */ + protected $userResource; + /** * @param Action\Context $context * @param Session $session @@ -69,6 +91,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory + * @param UserResource $userResource + * @param ScopeConfigInterface $scopeConfig */ public function __construct( Action\Context $context, @@ -78,7 +102,9 @@ public function __construct( TfaSessionInterface $tfaSession, TfaInterface $tfa, AlertInterface $alert, - DataObjectFactory $dataObjectFactory + DataObjectFactory $dataObjectFactory, + UserResource $userResource, + ScopeConfigInterface $scopeConfig ) { parent::__construct($context); $this->tfa = $tfa; @@ -88,6 +114,8 @@ public function __construct( $this->authy = $authy; $this->dataObjectFactory = $dataObjectFactory; $this->alert = $alert; + $this->userResource = $userResource; + $this->scopeConfig = $scopeConfig; } /** @@ -109,11 +137,20 @@ public function execute() $result = $this->jsonFactory->create(); try { - $this->authy->verify($user, $this->dataObjectFactory->create([ - 'data' => $this->getRequest()->getParams(), - ])); - $this->tfaSession->grantAccess(); - $result->setData(['success' => true]); + $maxRetries = $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); + $retries = $this->verifyRetryAttempts(); + if ($retries > $maxRetries) { //locked the user + $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); + if ($this->userResource->lock($user->getId(),0, $lockThreshold)) { + $result->setData(['success' => false, 'message' => "User is disabled temporarily!"]); + } + } else { + $this->authy->verify($user, $this->dataObjectFactory->create([ + 'data' => $this->getRequest()->getParams(), + ])); + $this->tfaSession->grantAccess(); + $result->setData(['success' => true]); + } } catch (Exception $e) { $this->alert->event( 'Magento_TwoFactorAuth', @@ -141,4 +178,17 @@ protected function _isAllowed() $this->tfa->getProviderIsAllowed((int) $user->getId(), Authy::CODE) && $this->tfa->getProvider(Authy::CODE)->isActive((int) $user->getId()); } + + /** + * Get retry attempt count + * + * @return int + */ + private function verifyRetryAttempts() : int + { + $verifyAttempts = $this->session->getOtpAttempt(); + $verifyAttempts = is_null($verifyAttempts) ? 0 : $verifyAttempts+1; + $this->session->setOtpAttempt($verifyAttempts); + return $verifyAttempts; + } } diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php index f0437f1d..0db02860 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -19,6 +19,8 @@ use Magento\TwoFactorAuth\Controller\Adminhtml\AbstractAction; use Magento\TwoFactorAuth\Model\Provider\Engine\Google; use Magento\User\Model\User; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\User\Model\ResourceModel\User as UserResource; /** * Google authenticator post controller @@ -61,6 +63,26 @@ class Authpost extends AbstractAction implements HttpPostActionInterface */ private $alert; + /** + * Config path for the 2FA Attempts + */ + private const XML_PATH_2FA_RETRY_ATTEMPTS = 'twofactorauth/general/twofactorauth_retry'; + + /** + * Config path for the 2FA Attempts + */ + private const XML_PATH_2FA_LOCK_EXPIRE = 'twofactorauth/general/auth_lock_expire'; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @var UserResource + */ + protected $userResource; + /** * @param Action\Context $context * @param Session $session @@ -70,6 +92,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory + * @param UserResource $userResource + * @param ScopeConfigInterface $scopeConfig */ public function __construct( Action\Context $context, @@ -79,7 +103,9 @@ public function __construct( TfaSessionInterface $tfaSession, TfaInterface $tfa, AlertInterface $alert, - DataObjectFactory $dataObjectFactory + DataObjectFactory $dataObjectFactory, + UserResource $userResource, + ScopeConfigInterface $scopeConfig ) { parent::__construct($context); $this->tfa = $tfa; @@ -89,6 +115,8 @@ public function __construct( $this->tfaSession = $tfaSession; $this->dataObjectFactory = $dataObjectFactory; $this->alert = $alert; + $this->userResource = $userResource; + $this->scopeConfig = $scopeConfig; } /** @@ -103,18 +131,27 @@ public function execute() /** @var \Magento\Framework\DataObject $request */ $request = $this->dataObjectFactory->create(['data' => $this->getRequest()->getParams()]); - if ($this->google->verify($user, $request)) { - $this->tfaSession->grantAccess(); - $response->setData(['success' => true]); + $maxRetries = $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); + $retries = $this->verifyRetryAttempts(); + if ($retries > $maxRetries) { //locked the user + $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); + if ($this->userResource->lock($user->getId(),0, $lockThreshold)) { + $response->setData(['success' => false, 'message' => "User is disabled temporarily!"]); + } } else { - $this->alert->event( - 'Magento_TwoFactorAuth', - 'Google auth invalid token', - AlertInterface::LEVEL_WARNING, - $user->getUserName() - ); - - $response->setData(['success' => false, 'message' => 'Invalid code']); + if ($this->google->verify($user, $request)) { + $this->tfaSession->grantAccess(); + $response->setData(['success' => true]); + } else { + $this->alert->event( + 'Magento_TwoFactorAuth', + 'Google auth invalid token', + AlertInterface::LEVEL_WARNING, + $user->getUserName() + ); + + $response->setData(['success' => false, 'message' => 'Invalid code']); + } } return $response; @@ -133,4 +170,17 @@ protected function _isAllowed() && $this->tfa->getProviderIsAllowed((int)$user->getId(), Google::CODE) && $this->tfa->getProvider(Google::CODE)->isActive((int)$user->getId()); } + + /** + * Get retry attempt count + * + * @return int + */ + private function verifyRetryAttempts() : int + { + $verifyAttempts = $this->session->getOtpAttempt(); + $verifyAttempts = is_null($verifyAttempts) ? 0 : $verifyAttempts+1; + $this->session->setOtpAttempt($verifyAttempts); + return $verifyAttempts; + } } diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index ba8522eb..a4942c82 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -34,11 +34,16 @@ showInDefault="1" showInWebsite="0" showInStore="0"> <label>Configuration Email URL for Web API</label> <comment>This can be used to override the default email configuration link that is sent when using the Magento Web API's to authenticate. Use the placeholder :tfat to indicate where the token should be injected</comment> - </field> + </field>x <field canRestore="1" id="twofactorauth_retry" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Configuration for 2FA retry attempts</label> - <comment>Security configurations for TowFatcorAuth page. To avoid the bruteforce of twofactorauth API</comment> + <comment>Security configurations for TowFatcorAuth page.</comment> + </field> + <field canRestore="1" id="auth_lock_expire" translate="label" type="text" sortOrder="40" + showInDefault="1" showInWebsite="0" showInStore="0"> + <label>Configuration for 2FA lock expire time</label> + <comment>TwoFactor Authentation Configuration.</comment> </field> </group> <group id="google" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 9b6f1bf7..dffc3669 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -12,6 +12,7 @@ <general> <force_providers></force_providers> <twofactorauth_retry>10</twofactorauth_retry> + <auth_lock_expire>300</auth_lock_expire> </general> <authy> <onetouch_message>Login request to your Magento Admin</onetouch_message> diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js index afc7513e..5048adc0 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js @@ -12,8 +12,6 @@ define([ ], function ($, ko, Component, error) { 'use strict'; - let attempts = 0; - return Component.extend({ selectedMethod: ko.observable(''), waitingText: ko.observable(''), @@ -192,27 +190,12 @@ define([ this.success(false); }, - /** - * Get Retry Attempts - * @returns {int} - */ - getRetryAttempts: function () { - return this.attempts; - }, - /** * Verify authy code */ verifyCode: function () { var me = this; - attempts++; - if (attempts > this.getRetryAttempts()) { - console.log('Maximum otp retries are done.'); - location.href = $('.tfa-logout-link').attr('href'); - return; - } - this.waitingText('Please wait...'); $.post(this.getPostUrl(), { diff --git a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js index 82df7499..02f57d3d 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js @@ -11,8 +11,6 @@ define([ ], function ($, ko, Component, error) { 'use strict'; - let attempts = 0; - return Component.extend({ currentStep: ko.observable('register'), waitText: ko.observable(''), @@ -42,14 +40,6 @@ define([ return this.postUrl; }, - /** - * Get Retry Attempts - * @returns {int} - */ - getRetryAttempts: function () { - return this.attempts; - }, - /** * Get plain Secret Code * @returns {String} @@ -72,13 +62,6 @@ define([ doVerify: function () { var me = this; - attempts++; - if (attempts > this.getRetryAttempts()) { - console.log('Maximum otp retries are done.'); - location.href = $('.tfa-logout-link').attr('href'); - return; - } - this.waitText('Please wait...'); $.post(this.getPostUrl(), { 'tfa_code': this.verifyCode() From 25d28a8c4fbcca03b7d8e18f1b741502eea5ddd7 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Mon, 20 May 2024 14:55:32 +0530 Subject: [PATCH 114/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Block/Provider/Authy/Auth.php | 28 -------------------- TwoFactorAuth/Block/Provider/Google/Auth.php | 28 -------------------- 2 files changed, 56 deletions(-) diff --git a/TwoFactorAuth/Block/Provider/Authy/Auth.php b/TwoFactorAuth/Block/Provider/Authy/Auth.php index 3f5281ff..18182240 100644 --- a/TwoFactorAuth/Block/Provider/Authy/Auth.php +++ b/TwoFactorAuth/Block/Provider/Authy/Auth.php @@ -8,37 +8,12 @@ namespace Magento\TwoFactorAuth\Block\Provider\Authy; use Magento\Backend\Block\Template; -use Magento\Framework\App\Config\ScopeConfigInterface; /** * @api */ class Auth extends Template { - /** - * Config path for the 2FA Attempts - */ - private const XML_PATH_2FA_RETRY_ATTEMPTS = 'twofactorauth/general/twofactorauth_retry'; - - /** - * @var ScopeConfigInterface - */ - private $scopeConfig; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param ScopeConfigInterface $scopeConfig - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - ScopeConfigInterface $scopeConfig, - array $data = [] - ) { - parent::__construct($context, $data); - $this->scopeConfig = $scopeConfig; - } - /** * @inheritdoc */ @@ -59,9 +34,6 @@ public function getJsLayout() $this->jsLayout['components']['tfa-auth']['successUrl'] = $this->getUrl($this->_urlBuilder->getStartupPageUrl()); - $this->jsLayout['components']['tfa-auth']['attempts'] = - $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); - return parent::getJsLayout(); } } diff --git a/TwoFactorAuth/Block/Provider/Google/Auth.php b/TwoFactorAuth/Block/Provider/Google/Auth.php index a668790c..221c44ca 100644 --- a/TwoFactorAuth/Block/Provider/Google/Auth.php +++ b/TwoFactorAuth/Block/Provider/Google/Auth.php @@ -8,37 +8,12 @@ namespace Magento\TwoFactorAuth\Block\Provider\Google; use Magento\Backend\Block\Template; -use Magento\Framework\App\Config\ScopeConfigInterface; /** * @api */ class Auth extends Template { - /** - * Config path for the 2FA Attempts - */ - public const XML_PATH_2FA_RETRY_ATTEMPTS = 'twofactorauth/general/twofactorauth_retry'; - - /** - * @var ScopeConfigInterface - */ - private $scopeConfig; - - /** - * @param \Magento\Backend\Block\Template\Context $context - * @param ScopeConfigInterface $scopeConfig - * @param array $data - */ - public function __construct( - \Magento\Backend\Block\Template\Context $context, - ScopeConfigInterface $scopeConfig, - array $data = [] - ) { - parent::__construct($context, $data); - $this->scopeConfig = $scopeConfig; - } - /** * @inheritdoc */ @@ -50,9 +25,6 @@ public function getJsLayout() $this->jsLayout['components']['tfa-auth']['successUrl'] = $this->getUrl($this->_urlBuilder->getStartupPageUrl()); - $this->jsLayout['components']['tfa-auth']['attempts'] = - $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); - return parent::getJsLayout(); } } From e6445575e7f435f56df7351bf540decb6128a545 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Mon, 20 May 2024 17:02:34 +0530 Subject: [PATCH 115/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php | 5 +++-- TwoFactorAuth/etc/adminhtml/system.xml | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php index 41edbfff..2cdcf871 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -93,6 +93,7 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param DataObjectFactory $dataObjectFactory * @param UserResource $userResource * @param ScopeConfigInterface $scopeConfig + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( Action\Context $context, @@ -141,7 +142,7 @@ public function execute() $retries = $this->verifyRetryAttempts(); if ($retries > $maxRetries) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); - if ($this->userResource->lock($user->getId(),0, $lockThreshold)) { + if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { $result->setData(['success' => false, 'message' => "User is disabled temporarily!"]); } } else { @@ -187,7 +188,7 @@ protected function _isAllowed() private function verifyRetryAttempts() : int { $verifyAttempts = $this->session->getOtpAttempt(); - $verifyAttempts = is_null($verifyAttempts) ? 0 : $verifyAttempts+1; + $verifyAttempts = $verifyAttempts === null ? 1 : $verifyAttempts+1; $this->session->setOtpAttempt($verifyAttempts); return $verifyAttempts; } diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php index 0db02860..577471f6 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -94,6 +94,7 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param DataObjectFactory $dataObjectFactory * @param UserResource $userResource * @param ScopeConfigInterface $scopeConfig + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( Action\Context $context, @@ -135,7 +136,7 @@ public function execute() $retries = $this->verifyRetryAttempts(); if ($retries > $maxRetries) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); - if ($this->userResource->lock($user->getId(),0, $lockThreshold)) { + if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { $response->setData(['success' => false, 'message' => "User is disabled temporarily!"]); } } else { @@ -179,7 +180,7 @@ protected function _isAllowed() private function verifyRetryAttempts() : int { $verifyAttempts = $this->session->getOtpAttempt(); - $verifyAttempts = is_null($verifyAttempts) ? 0 : $verifyAttempts+1; + $verifyAttempts = $verifyAttempts === null ? 1 : $verifyAttempts+1; $this->session->setOtpAttempt($verifyAttempts); return $verifyAttempts; } diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index a4942c82..52887182 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -34,7 +34,7 @@ showInDefault="1" showInWebsite="0" showInStore="0"> <label>Configuration Email URL for Web API</label> <comment>This can be used to override the default email configuration link that is sent when using the Magento Web API's to authenticate. Use the placeholder :tfat to indicate where the token should be injected</comment> - </field>x + </field> <field canRestore="1" id="twofactorauth_retry" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Configuration for 2FA retry attempts</label> From 5de63dfcaa29714212fa8acd3f836587313eb207 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Thu, 23 May 2024 12:54:11 +0530 Subject: [PATCH 116/208] AC-9797: 2FA functionality enhancement --- .../Controller/Adminhtml/Authy/Authpost.php | 29 ++++++------ .../Controller/Adminhtml/Google/Authpost.php | 45 ++++++++++--------- TwoFactorAuth/etc/adminhtml/system.xml | 6 +-- 3 files changed, 44 insertions(+), 36 deletions(-) mode change 100644 => 100755 TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php mode change 100644 => 100755 TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php mode change 100644 => 100755 TwoFactorAuth/etc/adminhtml/system.xml diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php old mode 100644 new mode 100755 index 2cdcf871..73a93b8a --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -138,20 +138,18 @@ public function execute() $result = $this->jsonFactory->create(); try { - $maxRetries = $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); - $retries = $this->verifyRetryAttempts(); - if ($retries > $maxRetries) { //locked the user + if (!$this->allowApiRetries()) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { $result->setData(['success' => false, 'message' => "User is disabled temporarily!"]); + return $result; } - } else { - $this->authy->verify($user, $this->dataObjectFactory->create([ - 'data' => $this->getRequest()->getParams(), - ])); - $this->tfaSession->grantAccess(); - $result->setData(['success' => true]); } + $this->authy->verify($user, $this->dataObjectFactory->create([ + 'data' => $this->getRequest()->getParams(), + ])); + $this->tfaSession->grantAccess(); + $result->setData(['success' => true]); } catch (Exception $e) { $this->alert->event( 'Magento_TwoFactorAuth', @@ -181,15 +179,20 @@ protected function _isAllowed() } /** - * Get retry attempt count + * Check if retry attempt above threshold value * - * @return int + * @return bool */ - private function verifyRetryAttempts() : int + private function allowApiRetries() : bool { + $maxRetries = $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); $verifyAttempts = $this->session->getOtpAttempt(); $verifyAttempts = $verifyAttempts === null ? 1 : $verifyAttempts+1; $this->session->setOtpAttempt($verifyAttempts); - return $verifyAttempts; + if ($verifyAttempts > $maxRetries) { + return false; + } + + return true; } } diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php old mode 100644 new mode 100755 index 577471f6..cef4f615 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -13,6 +13,7 @@ use Magento\Framework\Controller\Result\JsonFactory; use Magento\Framework\DataObjectFactory; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Tests\NamingConvention\true\bool; use Magento\TwoFactorAuth\Model\AlertInterface; use Magento\TwoFactorAuth\Api\TfaInterface; use Magento\TwoFactorAuth\Api\TfaSessionInterface; @@ -132,27 +133,26 @@ public function execute() /** @var \Magento\Framework\DataObject $request */ $request = $this->dataObjectFactory->create(['data' => $this->getRequest()->getParams()]); - $maxRetries = $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); - $retries = $this->verifyRetryAttempts(); - if ($retries > $maxRetries) { //locked the user + if (!$this->allowApiRetries()) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { $response->setData(['success' => false, 'message' => "User is disabled temporarily!"]); + return $response; } + } + + if ($this->google->verify($user, $request)) { + $this->tfaSession->grantAccess(); + $response->setData(['success' => true]); } else { - if ($this->google->verify($user, $request)) { - $this->tfaSession->grantAccess(); - $response->setData(['success' => true]); - } else { - $this->alert->event( - 'Magento_TwoFactorAuth', - 'Google auth invalid token', - AlertInterface::LEVEL_WARNING, - $user->getUserName() - ); - - $response->setData(['success' => false, 'message' => 'Invalid code']); - } + $this->alert->event( + 'Magento_TwoFactorAuth', + 'Google auth invalid token', + AlertInterface::LEVEL_WARNING, + $user->getUserName() + ); + + $response->setData(['success' => false, 'message' => 'Invalid code']); } return $response; @@ -173,15 +173,20 @@ protected function _isAllowed() } /** - * Get retry attempt count + * Check if retry attempt above threshold value * - * @return int + * @return bool */ - private function verifyRetryAttempts() : int + private function allowApiRetries() : bool { + $maxRetries = $this->scopeConfig->getValue(self::XML_PATH_2FA_RETRY_ATTEMPTS); $verifyAttempts = $this->session->getOtpAttempt(); $verifyAttempts = $verifyAttempts === null ? 1 : $verifyAttempts+1; $this->session->setOtpAttempt($verifyAttempts); - return $verifyAttempts; + if ($verifyAttempts > $maxRetries) { + return false; + } + + return true; } } diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml old mode 100644 new mode 100755 index 52887182..4f237a3b --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -38,12 +38,12 @@ <field canRestore="1" id="twofactorauth_retry" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Configuration for 2FA retry attempts</label> - <comment>Security configurations for TowFatcorAuth page.</comment> + <comment>Security configurations for TwoFactorAuth page.</comment> </field> <field canRestore="1" id="auth_lock_expire" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Configuration for 2FA lock expire time</label> - <comment>TwoFactor Authentation Configuration.</comment> + <label>Configuration for TwoFactorAuth lock expire time</label> + <comment>TwoFactor Authentication Configuration.</comment> </field> </group> <group id="google" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" From 5c5ad5b7a590c1cb0652e4ba3fd291f7a509714a Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Thu, 23 May 2024 14:11:39 +0530 Subject: [PATCH 117/208] AC-9797: 2FA functionality enhancement --- .../Controller/Adminhtml/Authy/Authpost.php | 16 ++++++---------- .../Controller/Adminhtml/Google/Authpost.php | 16 ++++++---------- TwoFactorAuth/etc/adminhtml/system.xml | 4 ++-- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php index 73a93b8a..7125b45f 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -91,8 +91,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory - * @param UserResource $userResource - * @param ScopeConfigInterface $scopeConfig + * @param UserResource|null $userResource + * @param ScopeConfigInterface|null $scopeConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -104,8 +104,8 @@ public function __construct( TfaInterface $tfa, AlertInterface $alert, DataObjectFactory $dataObjectFactory, - UserResource $userResource, - ScopeConfigInterface $scopeConfig + ?UserResource $userResource = null, + ?ScopeConfigInterface $scopeConfig = null ) { parent::__construct($context); $this->tfa = $tfa; @@ -141,7 +141,7 @@ public function execute() if (!$this->allowApiRetries()) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { - $result->setData(['success' => false, 'message' => "User is disabled temporarily!"]); + $result->setData(['success' => false, 'message' => "Your account is temporarily disabled."]); return $result; } } @@ -189,10 +189,6 @@ private function allowApiRetries() : bool $verifyAttempts = $this->session->getOtpAttempt(); $verifyAttempts = $verifyAttempts === null ? 1 : $verifyAttempts+1; $this->session->setOtpAttempt($verifyAttempts); - if ($verifyAttempts > $maxRetries) { - return false; - } - - return true; + return $maxRetries >= $verifyAttempts; } } diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php index cef4f615..5a171188 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -93,8 +93,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory - * @param UserResource $userResource - * @param ScopeConfigInterface $scopeConfig + * @param UserResource|null $userResource + * @param ScopeConfigInterface|null $scopeConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -106,8 +106,8 @@ public function __construct( TfaInterface $tfa, AlertInterface $alert, DataObjectFactory $dataObjectFactory, - UserResource $userResource, - ScopeConfigInterface $scopeConfig + ?UserResource $userResource = null, + ?ScopeConfigInterface $scopeConfig = null ) { parent::__construct($context); $this->tfa = $tfa; @@ -136,7 +136,7 @@ public function execute() if (!$this->allowApiRetries()) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { - $response->setData(['success' => false, 'message' => "User is disabled temporarily!"]); + $response->setData(['success' => false, 'message' => "Your account is temporarily disabled."]); return $response; } } @@ -183,10 +183,6 @@ private function allowApiRetries() : bool $verifyAttempts = $this->session->getOtpAttempt(); $verifyAttempts = $verifyAttempts === null ? 1 : $verifyAttempts+1; $this->session->setOtpAttempt($verifyAttempts); - if ($verifyAttempts > $maxRetries) { - return false; - } - - return true; + return $maxRetries >= $verifyAttempts; } } diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 4f237a3b..9daf06c6 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -37,13 +37,13 @@ </field> <field canRestore="1" id="twofactorauth_retry" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Configuration for 2FA retry attempts</label> + <label>Configuration for TwoFactorAuth retry attempts</label> <comment>Security configurations for TwoFactorAuth page.</comment> </field> <field canRestore="1" id="auth_lock_expire" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Configuration for TwoFactorAuth lock expire time</label> - <comment>TwoFactor Authentication Configuration.</comment> + <comment>TwoFactorAuth Configuration.</comment> </field> </group> <group id="google" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" From 744a5322d5481ad4b8e1c316abe100429c27f6ac Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Thu, 23 May 2024 14:52:23 +0530 Subject: [PATCH 118/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php | 8 ++++---- TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php index 7125b45f..b453faa9 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -91,8 +91,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory - * @param UserResource|null $userResource - * @param ScopeConfigInterface|null $scopeConfig + * @param UserResource $userResource + * @param ScopeConfigInterface $scopeConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -104,8 +104,8 @@ public function __construct( TfaInterface $tfa, AlertInterface $alert, DataObjectFactory $dataObjectFactory, - ?UserResource $userResource = null, - ?ScopeConfigInterface $scopeConfig = null + UserResource $userResource, + ScopeConfigInterface $scopeConfig ) { parent::__construct($context); $this->tfa = $tfa; diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php index 5a171188..739365df 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -13,7 +13,6 @@ use Magento\Framework\Controller\Result\JsonFactory; use Magento\Framework\DataObjectFactory; use Magento\Framework\Exception\NoSuchEntityException; -use Magento\Tests\NamingConvention\true\bool; use Magento\TwoFactorAuth\Model\AlertInterface; use Magento\TwoFactorAuth\Api\TfaInterface; use Magento\TwoFactorAuth\Api\TfaSessionInterface; @@ -93,8 +92,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory - * @param UserResource|null $userResource - * @param ScopeConfigInterface|null $scopeConfig + * @param UserResource $userResource + * @param ScopeConfigInterface $scopeConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -106,8 +105,8 @@ public function __construct( TfaInterface $tfa, AlertInterface $alert, DataObjectFactory $dataObjectFactory, - ?UserResource $userResource = null, - ?ScopeConfigInterface $scopeConfig = null + UserResource $userResource, + ScopeConfigInterface $scopeConfig ) { parent::__construct($context); $this->tfa = $tfa; From 83a5728221df70e066917e6bf143f3939e4de61f Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Fri, 24 May 2024 12:17:26 +0530 Subject: [PATCH 119/208] AC-9797: 2FA functionality enhancement --- .../Controller/Adminhtml/Authy/Authpost.php | 17 +++++++++-------- .../Controller/Adminhtml/Google/Authpost.php | 15 ++++++++------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php index b453faa9..af7c2358 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -21,6 +21,7 @@ use Magento\User\Model\User; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\User\Model\ResourceModel\User as UserResource; +use Magento\Framework\App\ObjectManager; /** * @SuppressWarnings(PHPMD.CamelCaseMethodName) @@ -80,7 +81,7 @@ class Authpost extends AbstractAction implements HttpPostActionInterface /** * @var UserResource */ - protected $userResource; + private $userResource; /** * @param Action\Context $context @@ -91,8 +92,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory - * @param UserResource $userResource - * @param ScopeConfigInterface $scopeConfig + * @param UserResource|null $userResource + * @param ScopeConfigInterface|null $scopeConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -104,8 +105,8 @@ public function __construct( TfaInterface $tfa, AlertInterface $alert, DataObjectFactory $dataObjectFactory, - UserResource $userResource, - ScopeConfigInterface $scopeConfig + ?UserResource $userResource = null, + ?ScopeConfigInterface $scopeConfig = null ) { parent::__construct($context); $this->tfa = $tfa; @@ -115,8 +116,8 @@ public function __construct( $this->authy = $authy; $this->dataObjectFactory = $dataObjectFactory; $this->alert = $alert; - $this->userResource = $userResource; - $this->scopeConfig = $scopeConfig; + $this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class); + $this->userResource = $userResource ?? ObjectManager::getInstance()->get(UserResource::class); } /** @@ -140,7 +141,7 @@ public function execute() try { if (!$this->allowApiRetries()) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); - if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { + if ($this->userResource->lock((int)$user->getId(), 0, $lockThreshold)) { $result->setData(['success' => false, 'message' => "Your account is temporarily disabled."]); return $result; } diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php index 739365df..dec8d2f4 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -21,6 +21,7 @@ use Magento\User\Model\User; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\User\Model\ResourceModel\User as UserResource; +use Magento\Framework\App\ObjectManager; /** * Google authenticator post controller @@ -92,8 +93,8 @@ class Authpost extends AbstractAction implements HttpPostActionInterface * @param TfaInterface $tfa * @param AlertInterface $alert * @param DataObjectFactory $dataObjectFactory - * @param UserResource $userResource - * @param ScopeConfigInterface $scopeConfig + * @param UserResource|null $userResource + * @param ScopeConfigInterface|null $scopeConfig * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -105,8 +106,8 @@ public function __construct( TfaInterface $tfa, AlertInterface $alert, DataObjectFactory $dataObjectFactory, - UserResource $userResource, - ScopeConfigInterface $scopeConfig + ?UserResource $userResource = null, + ?ScopeConfigInterface $scopeConfig = null ) { parent::__construct($context); $this->tfa = $tfa; @@ -116,8 +117,8 @@ public function __construct( $this->tfaSession = $tfaSession; $this->dataObjectFactory = $dataObjectFactory; $this->alert = $alert; - $this->userResource = $userResource; - $this->scopeConfig = $scopeConfig; + $this->scopeConfig = $scopeConfig ?? ObjectManager::getInstance()->get(ScopeConfigInterface::class); + $this->userResource = $userResource ?? ObjectManager::getInstance()->get(UserResource::class); } /** @@ -134,7 +135,7 @@ public function execute() if (!$this->allowApiRetries()) { //locked the user $lockThreshold = $this->scopeConfig->getValue(self::XML_PATH_2FA_LOCK_EXPIRE); - if ($this->userResource->lock($user->getId(), 0, $lockThreshold)) { + if ($this->userResource->lock((int)$user->getId(), 0, $lockThreshold)) { $response->setData(['success' => false, 'message' => "Your account is temporarily disabled."]); return $response; } From e4cb75ed2a418add82ad9e1dfcb59a2d90867556 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Sun, 26 May 2024 10:33:32 +0530 Subject: [PATCH 120/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php | 2 +- TwoFactorAuth/i18n/en_US.csv | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100755 TwoFactorAuth/i18n/en_US.csv diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php index dec8d2f4..14a70134 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -82,7 +82,7 @@ class Authpost extends AbstractAction implements HttpPostActionInterface /** * @var UserResource */ - protected $userResource; + private $userResource; /** * @param Action\Context $context diff --git a/TwoFactorAuth/i18n/en_US.csv b/TwoFactorAuth/i18n/en_US.csv new file mode 100755 index 00000000..667ec371 --- /dev/null +++ b/TwoFactorAuth/i18n/en_US.csv @@ -0,0 +1,5 @@ +"Configuration for TwoFactorAuth retry attempts","Configuration for TwoFactorAuth retry attempts" +"Configuration for TwoFactorAuth lock expire time","Configuration for TwoFactorAuth lock expire time" +"TwoFactorAuth Configuration","TwoFactorAuth Configuration" +"Security configurations for TwoFactorAuth page","Security configurations for TwoFactorAuth page" +"Your account is temporarily disabled.","Your account is temporarily disabled." From 8dc7fea7e2c00991d70fef1ef36ebe55aedbb616 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <rizwan.khan@BLR1-LMC-N90394.local> Date: Mon, 27 May 2024 13:15:49 +0530 Subject: [PATCH 121/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php | 1 + 1 file changed, 1 insertion(+) diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php index af7c2358..0a1d5674 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -25,6 +25,7 @@ /** * @SuppressWarnings(PHPMD.CamelCaseMethodName) + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Authpost extends AbstractAction implements HttpPostActionInterface { From b39d0a033295153179af34b78e9b85442244e39e Mon Sep 17 00:00:00 2001 From: Shradddha <shradddha@BLR1-LMC-N71235.local> Date: Wed, 22 May 2024 13:13:53 +0530 Subject: [PATCH 122/208] AC-11943:: Remove Deprecations- PhpUnit10 WebAPI Tests --- ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php b/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php index fe41d685..2f86d110 100644 --- a/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php +++ b/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php @@ -70,7 +70,7 @@ public function testAddProductReviewReCaptchaValidationFailed(string $customerNa /** * @return array */ - public function customerDataProvider(): array + public static function customerDataProvider(): array { return [ 'Guest' => ['John Doe', true], From e81fab1846440565ee2934293464a6143dbde52a Mon Sep 17 00:00:00 2001 From: Shradddha <shradddha@BLR1-LMC-N71235.local> Date: Wed, 19 Jun 2024 19:45:54 +0530 Subject: [PATCH 123/208] AC-12092:: Remove Deprecations- PhpUnit10 Unit Tests --- .../Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php | 2 +- .../Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php index 8cf57413..9050d2a5 100644 --- a/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php +++ b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -119,7 +119,7 @@ public function testProcess(array $mocks, array $expected): void $this->assertSame($expected, $actual); } - public function processDataProvider(): array + public static function processDataProvider(): array { return [ [ diff --git a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php index 2a01a10b..609fd7ef 100644 --- a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php +++ b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -107,7 +107,7 @@ public function testProcess(array $mocks, array $expected): void /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function processDataProvider(): array + public static function processDataProvider(): array { return [ [ From ee34b3890918487237c9a91280551379a922b261 Mon Sep 17 00:00:00 2001 From: Rizwan Khan <glo52257@adobe.com> Date: Wed, 19 Jun 2024 22:14:00 +0530 Subject: [PATCH 124/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/etc/adminhtml/system.xml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 9daf06c6..2ef0972a 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -37,13 +37,20 @@ </field> <field canRestore="1" id="twofactorauth_retry" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Configuration for TwoFactorAuth retry attempts</label> - <comment>Security configurations for TwoFactorAuth page.</comment> + <label>Setting the retry attempt limit for Two-Factor Authentication</label> + <comment> + This involves configuring the maximum number of retry attempts allowed for TwoFactorAuth. + This setting is very important for security, as it determines how many times a user can try to complete the 2FA process before being temporarily locked out. + By limiting the number of attempts, it helps to prevent unauthorized access and brute force attacks, thereby enhancing the overall security of the authentication process. + </comment> </field> <field canRestore="1" id="auth_lock_expire" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Configuration for TwoFactorAuth lock expire time</label> - <comment>TwoFactorAuth Configuration.</comment> + <comment> + This refers to the settings or parameters that determine how long the lock for TwoFactorAuth will remain active before it expires. + This configuration is very important for security, ensuring that users have a limited time to complete their 2FA process, thereby reducing the risk of unauthorized access. + </comment> </field> </group> <group id="google" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" From 966dc53b332d08eb078dd5bc724a1b7fe712c51b Mon Sep 17 00:00:00 2001 From: Rizwan Khan <glo52257@adobe.com> Date: Thu, 20 Jun 2024 13:37:24 +0530 Subject: [PATCH 125/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/etc/adminhtml/system.xml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 2ef0972a..71935212 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -37,19 +37,16 @@ </field> <field canRestore="1" id="twofactorauth_retry" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Setting the retry attempt limit for Two-Factor Authentication</label> + <label>Retry attempt limit for Two-Factor Authentication</label> <comment> - This involves configuring the maximum number of retry attempts allowed for TwoFactorAuth. - This setting is very important for security, as it determines how many times a user can try to complete the 2FA process before being temporarily locked out. - By limiting the number of attempts, it helps to prevent unauthorized access and brute force attacks, thereby enhancing the overall security of the authentication process. + Determines how many times a user can try to complete the 2FA process before being temporarily locked out. </comment> </field> <field canRestore="1" id="auth_lock_expire" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Configuration for TwoFactorAuth lock expire time</label> + <label>Two-Factor Authentication lockout time</label> <comment> - This refers to the settings or parameters that determine how long the lock for TwoFactorAuth will remain active before it expires. - This configuration is very important for security, ensuring that users have a limited time to complete their 2FA process, thereby reducing the risk of unauthorized access. + Determines how long a user is locked out if they reach the threshold defined above. </comment> </field> </group> From 905d36ab76a1a7e629dae9402155c514d2c2943c Mon Sep 17 00:00:00 2001 From: Rizwan Khan <glo52257@adobe.com> Date: Thu, 20 Jun 2024 16:00:45 +0530 Subject: [PATCH 126/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/etc/adminhtml/system.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 71935212..b2402f4c 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -44,7 +44,7 @@ </field> <field canRestore="1" id="auth_lock_expire" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Two-Factor Authentication lockout time</label> + <label>Two-Factor Authentication lockout time(seconds)</label> <comment> Determines how long a user is locked out if they reach the threshold defined above. </comment> From 56510777fefa17501cbf4222fbff2b24599f982e Mon Sep 17 00:00:00 2001 From: Rizwan Khan <glo52257@adobe.com> Date: Thu, 20 Jun 2024 16:19:25 +0530 Subject: [PATCH 127/208] AC-9797: 2FA functionality enhancement --- TwoFactorAuth/etc/adminhtml/system.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index b2402f4c..e2d0af0b 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -44,9 +44,10 @@ </field> <field canRestore="1" id="auth_lock_expire" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Two-Factor Authentication lockout time(seconds)</label> + <label>Two-Factor Authentication lockout time (seconds)</label> <comment> Determines how long a user is locked out if they reach the threshold defined above. + Please enter at least 120 and at most 1800 (30 minutes). </comment> </field> </group> From d8874d9e3446f4d166a8af729af96071d4c27c3d Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 21 Jun 2024 11:00:34 +0530 Subject: [PATCH 128/208] #AC-11762::Update 2FA OTP window field with correct description and default value after BiC change-command logic changes and removal of upgrade script as not required --- .../Setup/Patch/Data/UpdateLeeway.php | 80 ------------------- 1 file changed, 80 deletions(-) delete mode 100644 TwoFactorAuth/Setup/Patch/Data/UpdateLeeway.php diff --git a/TwoFactorAuth/Setup/Patch/Data/UpdateLeeway.php b/TwoFactorAuth/Setup/Patch/Data/UpdateLeeway.php deleted file mode 100644 index 98826317..00000000 --- a/TwoFactorAuth/Setup/Patch/Data/UpdateLeeway.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/** - * Copyright 2024 Adobe - * All Rights Reserved. - */ -declare(strict_types=1); - -namespace Magento\TwoFactorAuth\Setup\Patch\Data; - -use Magento\Framework\Setup\Patch\DataPatchInterface; -use Magento\Framework\Setup\ModuleDataSetupInterface; -use OTPHP\TOTPInterface; - -class UpdateLeeway implements DataPatchInterface -{ - /** - * @var ModuleDataSetupInterface - */ - private $moduleDataSetup; - - /** - * @param ModuleDataSetupInterface $moduleDataSetup - */ - public function __construct(ModuleDataSetupInterface $moduleDataSetup) - { - $this->moduleDataSetup = $moduleDataSetup; - } - - /** - * Fetch Totp default period - * - * @return int - */ - public function getDefaultPeriod() - { - return TOTPInterface::DEFAULT_PERIOD; - } - - /** - * Apply the data patch - */ - public function apply() - { - $setup = $this->moduleDataSetup->getConnection(); - $setup->startSetup(); - $select = $setup->select() - ->from('core_config_data', ['path']) - ->where('path = ?', 'twofactorauth/google/leeway'); - - $existingValue = $setup->fetchOne($select); - $period = $this->getDefaultPeriod(); - if ($existingValue && $existingValue >= $period) { - $newWindowValue = $period - 1; - $setup->update( - 'core_config_data', - ['value' => $newWindowValue], - 'path = "twofactorauth/google/leeway"' - ); - } - $setup->endSetup(); - - return $this; - } - - /** - * @inheritdoc - */ - public static function getDependencies() - { - return []; - } - - /** - * @inheritdoc - */ - public function getAliases() - { - return []; - } -} From dae5657cd11e5dac46deebb51bb9f708fe7ec29b Mon Sep 17 00:00:00 2001 From: mrprabhu92 <eze25057@adobe.com> Date: Mon, 29 Jul 2024 19:01:29 +0530 Subject: [PATCH 129/208] AC-10332: Tfa reset access --- TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php index 6f2d3a9d..69fae050 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php @@ -89,6 +89,7 @@ public function execute() */ protected function _isAllowed() { - return parent::_isAllowed() && $this->_authorization->isAllowed('Magento_TwoFactorAuth::tfa'); + return parent::_isAllowed() && $this->_authorization->isAllowed('Magento_TwoFactorAuth::tfa') + && $this->_authorization->isAllowed('Magento_User::acl_users'); } } From 5db42fb29db2d00488969675aa5ea6fa595976d0 Mon Sep 17 00:00:00 2001 From: Shradddha <shradddha@BLR1-LMC-N71235.local> Date: Wed, 31 Jul 2024 15:51:14 +0530 Subject: [PATCH 130/208] AC-12092:: Remove Deprecations- PhpUnit10 Unit Tests --- .../Test/Unit/Observer/PayPalObserverTest.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php index 66f4eead..c7e3f33b 100644 --- a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php +++ b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php @@ -114,7 +114,7 @@ public function testExecute(array $mocks): void $this->model->execute($this->observer); } - public function executeDataProvider(): array + public static function executeDataProvider(): array { return [ [ @@ -131,7 +131,7 @@ public function executeDataProvider(): array 'reCaptchaSession' => [ [ 'method' => 'save', - 'expects' => $this->never(), + 'expects' => self::never(), ] ] ] @@ -150,20 +150,20 @@ public function executeDataProvider(): array 'reCaptchaSession' => [ [ 'method' => 'save', - 'expects' => $this->never(), + 'expects' => self::never(), ] ], 'captchaValidator' => [ [ 'method' => 'isValid', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturnProperty' => 'validationResult' ] ], 'validationResult' => [ [ 'method' => 'isValid', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => true, ] ] @@ -183,20 +183,20 @@ public function executeDataProvider(): array 'reCaptchaSession' => [ [ 'method' => 'save', - 'expects' => $this->once(), + 'expects' => self::once(), ] ], 'captchaValidator' => [ [ 'method' => 'isValid', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturnProperty' => 'validationResult' ] ], 'validationResult' => [ [ 'method' => 'isValid', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => true, ] ] From 255466403ae9abc024dd31911d1bb9a16591f05c Mon Sep 17 00:00:00 2001 From: Shradddha <shradddha@BLR1-LMC-N71235.local> Date: Fri, 2 Aug 2024 18:28:44 +0530 Subject: [PATCH 131/208] AC-12092:: Remove Deprecations- PhpUnit10 Unit Tests --- ...eplayPayflowReCaptchaForPlaceOrderTest.php | 36 +++++++++---------- .../Test/Unit/Plugin/GraphQlValidatorTest.php | 2 +- .../Unit/Plugin/ValidationOverriderTest.php | 2 +- .../Unit/Plugin/RestValidationPluginTest.php | 2 +- .../Unit/Plugin/SoapValidationPluginTest.php | 2 +- .../Unit/Plugin/ValidationOverriderTest.php | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php index 6a6e884d..6a4322f3 100644 --- a/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php +++ b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php @@ -96,13 +96,13 @@ public function testAfterGetConfigFor(array $mocks, bool $isResultNull, bool $is /** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function afterGetConfigForDataProvider(): array + public static function afterGetConfigForDataProvider(): array { return [ [ [ 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->never()] + ['method' => 'isValid', 'expects' => self::never()] ] ], true, @@ -114,7 +114,7 @@ public function afterGetConfigForDataProvider(): array ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => false] ], 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->never(),] + ['method' => 'isValid', 'expects' => self::never(),] ] ], false, @@ -126,10 +126,10 @@ public function afterGetConfigForDataProvider(): array ['method' => 'isCaptchaEnabledFor', 'with' => 'paypal_payflowpro', 'willReturn' => true] ], 'request' => [ - ['method' => 'getBodyParams', 'expects' => $this->once(), 'willReturn' => []] + ['method' => 'getBodyParams', 'expects' => self::once(), 'willReturn' => []] ], 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->never(),] + ['method' => 'isValid', 'expects' => self::never(),] ] ], false, @@ -143,12 +143,12 @@ public function afterGetConfigForDataProvider(): array 'request' => [ [ 'method' => 'getBodyParams', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => 'checkmo']] ] ], 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->never(), 'willReturn' => false] + ['method' => 'isValid', 'expects' => self::never(), 'willReturn' => false] ] ], false, @@ -162,12 +162,12 @@ public function afterGetConfigForDataProvider(): array 'request' => [ [ 'method' => 'getBodyParams', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO]] ] ], 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => false] + ['method' => 'isValid', 'expects' => self::once(), 'with' => 1, 'willReturn' => false] ] ], false, @@ -181,12 +181,12 @@ public function afterGetConfigForDataProvider(): array 'request' => [ [ 'method' => 'getBodyParams', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => ['cartId' => 1, 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO]] ] ], 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => true] + ['method' => 'isValid', 'expects' => self::once(), 'with' => 1, 'willReturn' => true] ] ], false, @@ -200,7 +200,7 @@ public function afterGetConfigForDataProvider(): array 'request' => [ [ 'method' => 'getBodyParams', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => [ 'cart_id' => 1, 'payment_method' => ['method' => Config::METHOD_PAYFLOWPRO] @@ -208,7 +208,7 @@ public function afterGetConfigForDataProvider(): array ] ], 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->once(), 'with' => 1, 'willReturn' => true] + ['method' => 'isValid', 'expects' => self::once(), 'with' => 1, 'willReturn' => true] ] ], false, @@ -222,7 +222,7 @@ public function afterGetConfigForDataProvider(): array 'request' => [ [ 'method' => 'getBodyParams', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => [ 'cartId' => '17uc43rge98nc92', 'paymentMethod' => ['method' => Config::METHOD_PAYFLOWPRO] @@ -232,24 +232,24 @@ public function afterGetConfigForDataProvider(): array 'quoteIdMaskFactory' => [ [ 'method' => 'create', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturnProperty' => 'quoteIdMask' ] ], 'quoteIdMask' => [ [ 'method' => 'load', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturnSelf' => null ], [ 'method' => 'getQuoteId', - 'expects' => $this->once(), + 'expects' => self::once(), 'willReturn' => 2 ] ], 'reCaptchaSession' => [ - ['method' => 'isValid', 'expects' => $this->once(), 'with' => 2, 'willReturn' => true] + ['method' => 'isValid', 'expects' => self::once(), 'with' => 2, 'willReturn' => true] ] ], false, diff --git a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php index 3583aa32..0d253384 100644 --- a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php @@ -60,7 +60,7 @@ protected function setUp(): void ); } - public function getPluginCases(): array + public static function getPluginCases(): array { return [ 'not-mutation' => [false, true, false, false], diff --git a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php index 8d1baeaa..425707ef 100644 --- a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php @@ -35,7 +35,7 @@ protected function setUp(): void $this->model = new ValidationOverrider($this->userContextMock); } - public function getUserContextData(): array + public static function getUserContextData(): array { return [ 'customer' => [UserContextInterface::USER_TYPE_CUSTOMER, 1, true], diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php index 893d3f85..4c7323ba 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php @@ -71,7 +71,7 @@ protected function setUp(): void ); } - public function getPluginCases(): array + public static function getPluginCases(): array { return [ 'unprotected-endpoint' => [false, false, false], diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php index fba005ce..5b316ece 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php @@ -64,7 +64,7 @@ protected function setUp(): void ); } - public function getPluginCases(): array + public static function getPluginCases(): array { return [ 'not-protected' => [false, UserContextInterface::USER_TYPE_GUEST, null, false], diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php index e3d97216..3779c63e 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php @@ -35,7 +35,7 @@ protected function setUp(): void $this->model = new ValidationOverrider($this->userContextMock); } - public function getUserContextData(): array + public static function getUserContextData(): array { return [ 'customer' => [UserContextInterface::USER_TYPE_CUSTOMER, 1, true], From d855dadc5f236c33f5e417ff1f8b8bd56cd693d3 Mon Sep 17 00:00:00 2001 From: Shradddha <shradddha@BLR1-LMC-N71235.local> Date: Wed, 7 Aug 2024 16:57:45 +0530 Subject: [PATCH 132/208] AC-12092:: Remove Deprecations- PhpUnit10 Unit Tests --- .../Test/Unit/Plugin/GraphQlValidatorTest.php | 3 +++ .../Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php | 2 +- TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php | 2 +- .../Test/Unit/Model/Provider/Engine/DuoSecurityTest.php | 2 +- TwoFactorAuth/Test/Unit/Model/TfaTest.php | 2 +- .../Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php index 0d253384..5354c3ef 100644 --- a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php @@ -23,6 +23,9 @@ use PHPUnit\Framework\TestCase; use Magento\Framework\GraphQl\Schema\Type\ResolveInfo; +/** + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class GraphQlValidatorTest extends TestCase { /** diff --git a/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php b/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php index 5a670567..90166179 100644 --- a/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php @@ -40,7 +40,7 @@ public function testBefore($value, $isValid): void $this->model->beforeSave(); } - public function valuesDataProvider() + public static function valuesDataProvider() { return [ ['', true], diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php index f76871e3..d7989f7e 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php @@ -40,7 +40,7 @@ protected function setUp(): void * * @return array */ - public function getIsEnabledTestDataSet(): array + public static function getIsEnabledTestDataSet(): array { return [ 'api key present' => [ diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index e057bee9..5cd85e52 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -55,7 +55,7 @@ protected function setUp(): void * * @return array */ - public function getIsEnabledTestDataSet(): array + public static function getIsEnabledTestDataSet(): array { return [ [ diff --git a/TwoFactorAuth/Test/Unit/Model/TfaTest.php b/TwoFactorAuth/Test/Unit/Model/TfaTest.php index 394f6613..3d83222a 100644 --- a/TwoFactorAuth/Test/Unit/Model/TfaTest.php +++ b/TwoFactorAuth/Test/Unit/Model/TfaTest.php @@ -142,7 +142,7 @@ public function testAllEnabledProvidersUpdates(): void * * @return array */ - public function getForcedProvidersDataSet(): array + public static function getForcedProvidersDataSet(): array { return [ 'not defined' => [ diff --git a/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php b/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php index bee182f0..204afea3 100644 --- a/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php +++ b/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php @@ -95,7 +95,7 @@ protected function setUp(): void * * @return array */ - public function getTokenRequestData(): array + public static function getTokenRequestData(): array { return [ 'token in query' => [ From 4e54bc07bb22b8d8b7e603a65c293a4b908db912 Mon Sep 17 00:00:00 2001 From: Deepak Soni <deepaksoni@adobe.com> Date: Tue, 3 Sep 2024 14:19:57 +0530 Subject: [PATCH 133/208] LYNX-522: Add theme field to recaptchaV3Config query (#3) --- .../Model/Resolver/ReCaptchaV3.php | 3 ++- .../Test/Api/ReCaptchaV3ConfigTest.php | 16 ++++++++++++---- ReCaptchaWebapiGraphQl/etc/schema.graphqls | 1 + 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php index 18acb4a6..e227f27d 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -82,7 +82,8 @@ public function resolve( 'badge_position' => $this->reCaptchaV3Config->getBadgePosition(), 'language_code' => $this->reCaptchaV3Config->getLanguageCode(), 'failure_message' => $this->getFailureMessage(), - 'forms' => $this->getEnumFormTypes() + 'forms' => $this->getEnumFormTypes(), + 'theme' => $this->reCaptchaV3Config->getTheme() ]; } diff --git a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php index 7b946260..367e7229 100644 --- a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php @@ -7,6 +7,7 @@ namespace Magento\ReCaptchaWebapiGraphQl\Test\Api; +use Exception; use Magento\Framework\Encryption\EncryptorInterface; use Magento\TestFramework\Fixture\Config; use Magento\Framework\App\ResourceConnection; @@ -29,6 +30,7 @@ class ReCaptchaV3ConfigTest extends GraphQlAbstract language_code failure_message forms + theme } } QUERY; @@ -49,6 +51,7 @@ public function setUp(): void Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75), Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), + Config('recaptcha_frontend/type_recaptcha_v3/theme', 'light'), Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3') ] @@ -65,7 +68,8 @@ public function testQueryRecaptchaNoPublicKeyConfigured(): void 'failure_message' => 'Test failure message', 'forms' => [ 'CUSTOMER_LOGIN' - ] + ], + 'theme' => 'light' ] ], $this->graphQlQuery(self::QUERY) @@ -76,6 +80,7 @@ public function testQueryRecaptchaNoPublicKeyConfigured(): void Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75), Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), + Config('recaptcha_frontend/type_recaptcha_v3/theme', 'light'), Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message') ] public function testQueryRecaptchaNoFormsConfigured(): void @@ -100,7 +105,8 @@ public function testQueryRecaptchaNoFormsConfigured(): void 'badge_position' => 'bottomright', 'language_code' => 'en', 'failure_message' => 'Test failure message', - 'forms' => [] + 'forms' => [], + 'theme' => 'light' ] ], $this->graphQlQuery(self::QUERY) @@ -111,6 +117,7 @@ public function testQueryRecaptchaNoFormsConfigured(): void Config('recaptcha_frontend/type_recaptcha_v3/score_threshold', 0.75), Config('recaptcha_frontend/type_recaptcha_v3/position', 'bottomright'), Config('recaptcha_frontend/type_recaptcha_v3/lang', 'en'), + Config('recaptcha_frontend/type_recaptcha_v3/theme', 'dark'), Config('recaptcha_frontend/failure_messages/validation_failure_message', 'Test failure message'), Config('recaptcha_frontend/type_for/customer_login', 'recaptcha_v3') ] @@ -138,7 +145,8 @@ public function testQueryRecaptchaConfigured(): void 'failure_message' => 'Test failure message', 'forms' => [ 'CUSTOMER_LOGIN' - ] + ], + 'theme' => 'dark' ] ], $this->graphQlQuery(self::QUERY) @@ -151,7 +159,7 @@ public function tearDown(): void $resource = Bootstrap::getObjectManager()->get(ResourceConnection::class); /** @var AdapterInterface $connection */ $connection = $resource->getConnection(ResourceConnection::DEFAULT_CONNECTION); - + $connection->delete( $resource->getTableName('core_config_data') ); diff --git a/ReCaptchaWebapiGraphQl/etc/schema.graphqls b/ReCaptchaWebapiGraphQl/etc/schema.graphqls index 2887d4da..c1a22330 100644 --- a/ReCaptchaWebapiGraphQl/etc/schema.graphqls +++ b/ReCaptchaWebapiGraphQl/etc/schema.graphqls @@ -50,4 +50,5 @@ type ReCaptchaConfigurationV3 @doc(description: "Contains reCAPTCHA V3-Invisible language_code: String @doc(description: "A two-character code that specifies the language that is used for Google reCAPTCHA text and messaging.") failure_message: String! @doc(description: "The message that appears to the user if validation fails.") forms: [ReCaptchaFormEnum!]! @doc(description: "A list of forms on the storefront that have been configured to use reCAPTCHA V3.") + theme: String! @doc(description: "Theme to be used to render reCaptcha.") } From 8e3e9dea0500098e47ad28e4c0d4fbb988ecc7fb Mon Sep 17 00:00:00 2001 From: Anna Bukatar <abukatar@adobe.com> Date: Mon, 16 Sep 2024 15:43:37 -0700 Subject: [PATCH 134/208] ACP2E-3300: Captcha on admin login does not require interaction for some users --- ReCaptchaUser/Observer/LoginObserver.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ReCaptchaUser/Observer/LoginObserver.php b/ReCaptchaUser/Observer/LoginObserver.php index 7c0dbfed..4fb52736 100644 --- a/ReCaptchaUser/Observer/LoginObserver.php +++ b/ReCaptchaUser/Observer/LoginObserver.php @@ -56,6 +56,8 @@ class LoginObserver implements ObserverInterface /** * @var string + * @deprecated + * @see no actuall usage in the class */ private $loginActionName; @@ -117,9 +119,7 @@ public function __construct( public function execute(Observer $observer): void { $key = 'user_login'; - if ($this->isCaptchaEnabled->isCaptchaEnabledFor($key) - && $this->request->getFullActionName() === $this->loginActionName - ) { + if ($this->isCaptchaEnabled->isCaptchaEnabledFor($key)) { $validationConfig = $this->validationConfigResolver->get($key); try { $reCaptchaResponse = $this->captchaResponseResolver->resolve($this->request); From b4414d9952476c26496cf2099b02f35f00284c16 Mon Sep 17 00:00:00 2001 From: Anna Bukatar <abukatar@adobe.com> Date: Tue, 17 Sep 2024 14:03:11 -0700 Subject: [PATCH 135/208] ACP2E-3300: Captcha on admin login does not require interaction for some users --- .../Test/Integration/LoginFormTest.php | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ReCaptchaUser/Test/Integration/LoginFormTest.php b/ReCaptchaUser/Test/Integration/LoginFormTest.php index f0ff0437..68671006 100644 --- a/ReCaptchaUser/Test/Integration/LoginFormTest.php +++ b/ReCaptchaUser/Test/Integration/LoginFormTest.php @@ -156,6 +156,36 @@ public function testPostRequestIfReCaptchaParameterIsMissed(): void $this->checkFailedPostResponse(); } + /** + * @magentoAdminConfigFixture admin/security/use_form_key 0 + * @magentoAdminConfigFixture admin/captcha/enable 0 + * @magentoAdminConfigFixture recaptcha_backend/type_invisible/public_key test_public_key + * @magentoAdminConfigFixture recaptcha_backend/type_invisible/private_key test_private_key + * @magentoAdminConfigFixture recaptcha_backend/type_for/user_login invisible + */ + public function testPostRequestIfReCaptchaParameterIsMissedWithRef(): void + { + $postValues = []; + $this->getRequest() + ->setMethod(Http::METHOD_POST) + ->setPostValue(array_replace_recursive( + [ + 'form_key' => $this->formKey->getFormKey(), + 'login' => [ + 'username' => Bootstrap::ADMIN_NAME, + 'password' => Bootstrap::ADMIN_PASSWORD, + ], + ], + $postValues + )); + $this->dispatch('backend/admin/dashboard/index'); + $this->assertSessionMessages( + self::equalTo(['Something went wrong with reCAPTCHA. Please contact the store owner.']), + MessageInterface::TYPE_ERROR + ); + self::assertFalse($this->auth->isLoggedIn()); + } + /** * @magentoAdminConfigFixture admin/security/use_form_key 0 * @magentoAdminConfigFixture admin/captcha/enable 0 From 33ccc4b891660e4fce78508ded5da90859e83300 Mon Sep 17 00:00:00 2001 From: Bhavin Parmar <cod62627@adobe.com> Date: Thu, 26 Sep 2024 11:38:56 +0530 Subject: [PATCH 136/208] AC-13039:: Remove PHP 8.1 from adobe Commerce community edition - CE --- ReCaptchaAdminUi/composer.json | 2 +- ReCaptchaCheckout/composer.json | 2 +- ReCaptchaCheckoutSalesRule/composer.json | 2 +- ReCaptchaContact/composer.json | 2 +- ReCaptchaCustomer/composer.json | 2 +- ReCaptchaFrontendUi/composer.json | 2 +- ReCaptchaMigration/composer.json | 2 +- ReCaptchaNewsletter/composer.json | 2 +- ReCaptchaPaypal/composer.json | 2 +- ReCaptchaResendConfirmationEmail/composer.json | 2 +- ReCaptchaReview/composer.json | 2 +- ReCaptchaSendFriend/composer.json | 2 +- ReCaptchaStorePickup/composer.json | 2 +- ReCaptchaUi/composer.json | 2 +- ReCaptchaUser/composer.json | 2 +- ReCaptchaValidation/composer.json | 2 +- ReCaptchaValidationApi/composer.json | 2 +- ReCaptchaVersion2Checkbox/composer.json | 2 +- ReCaptchaVersion2Invisible/composer.json | 2 +- ReCaptchaVersion3Invisible/composer.json | 2 +- ReCaptchaWebapiApi/composer.json | 2 +- ReCaptchaWebapiGraphQl/composer.json | 2 +- ReCaptchaWebapiRest/composer.json | 2 +- ReCaptchaWebapiUi/composer.json | 2 +- Securitytxt/composer.json | 2 +- TwoFactorAuth/composer.json | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ReCaptchaAdminUi/composer.json b/ReCaptchaAdminUi/composer.json index d37ce494..52e9e7d1 100644 --- a/ReCaptchaAdminUi/composer.json +++ b/ReCaptchaAdminUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-admin-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckout/composer.json b/ReCaptchaCheckout/composer.json index fd5d1240..bc080644 100644 --- a/ReCaptchaCheckout/composer.json +++ b/ReCaptchaCheckout/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckoutSalesRule/composer.json b/ReCaptchaCheckoutSalesRule/composer.json index 3d66f93c..d0f8dae9 100644 --- a/ReCaptchaCheckoutSalesRule/composer.json +++ b/ReCaptchaCheckoutSalesRule/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout-sales-rule", "description": "Google ReCaptcha integration for Magento2 coupons", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-sales-rule": "*", diff --git a/ReCaptchaContact/composer.json b/ReCaptchaContact/composer.json index 6c8f9ae9..dbf2fcb9 100644 --- a/ReCaptchaContact/composer.json +++ b/ReCaptchaContact/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-contact", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*" }, diff --git a/ReCaptchaCustomer/composer.json b/ReCaptchaCustomer/composer.json index 065d3183..5b28477e 100644 --- a/ReCaptchaCustomer/composer.json +++ b/ReCaptchaCustomer/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-customer", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-customer": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaFrontendUi/composer.json b/ReCaptchaFrontendUi/composer.json index 78cdd6a9..c7a37556 100644 --- a/ReCaptchaFrontendUi/composer.json +++ b/ReCaptchaFrontendUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-frontend-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaMigration/composer.json b/ReCaptchaMigration/composer.json index 81504bcb..a25de655 100644 --- a/ReCaptchaMigration/composer.json +++ b/ReCaptchaMigration/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-migration", "description": "Google reCAPTCHA config migration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-config": "*" }, diff --git a/ReCaptchaNewsletter/composer.json b/ReCaptchaNewsletter/composer.json index 687a9cef..f190336d 100644 --- a/ReCaptchaNewsletter/composer.json +++ b/ReCaptchaNewsletter/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-newsletter", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index e6373715..5059d495 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-paypal", "description": "Google reCaptcha integration for Magento2 PayPal PayflowPro payment form", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaResendConfirmationEmail/composer.json b/ReCaptchaResendConfirmationEmail/composer.json index ab62a3e1..6840849d 100644 --- a/ReCaptchaResendConfirmationEmail/composer.json +++ b/ReCaptchaResendConfirmationEmail/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-resend-confirmation-email", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaReview/composer.json b/ReCaptchaReview/composer.json index 628da4f6..d1fe0231 100644 --- a/ReCaptchaReview/composer.json +++ b/ReCaptchaReview/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-review", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaSendFriend/composer.json b/ReCaptchaSendFriend/composer.json index 10845103..6623c542 100644 --- a/ReCaptchaSendFriend/composer.json +++ b/ReCaptchaSendFriend/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-send-friend", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaStorePickup/composer.json b/ReCaptchaStorePickup/composer.json index 9858c213..a8aacc42 100644 --- a/ReCaptchaStorePickup/composer.json +++ b/ReCaptchaStorePickup/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-store-pickup", "description": "Google reCaptcha integration for Magento2 Inventory Store Pickup shipping form", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaUi/composer.json b/ReCaptchaUi/composer.json index e49c14bc..097fbb80 100644 --- a/ReCaptchaUi/composer.json +++ b/ReCaptchaUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaUser/composer.json b/ReCaptchaUser/composer.json index 8d71f56f..2292e153 100644 --- a/ReCaptchaUser/composer.json +++ b/ReCaptchaUser/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-user", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*" diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index cf1422d6..ddad14e7 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", "google/recaptcha": "^1.2" diff --git a/ReCaptchaValidationApi/composer.json b/ReCaptchaValidationApi/composer.json index 46bce41c..94bfa1ff 100644 --- a/ReCaptchaValidationApi/composer.json +++ b/ReCaptchaValidationApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*" }, "type": "magento2-module", diff --git a/ReCaptchaVersion2Checkbox/composer.json b/ReCaptchaVersion2Checkbox/composer.json index 6edc45c1..51ab67af 100644 --- a/ReCaptchaVersion2Checkbox/composer.json +++ b/ReCaptchaVersion2Checkbox/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-checkbox", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion2Invisible/composer.json b/ReCaptchaVersion2Invisible/composer.json index 867cc8a6..c1b67e2f 100644 --- a/ReCaptchaVersion2Invisible/composer.json +++ b/ReCaptchaVersion2Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion3Invisible/composer.json b/ReCaptchaVersion3Invisible/composer.json index 36b4318e..05a9dcc3 100644 --- a/ReCaptchaVersion3Invisible/composer.json +++ b/ReCaptchaVersion3Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-3-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaWebapiApi/composer.json b/ReCaptchaWebapiApi/composer.json index e9933c44..cd541c9c 100644 --- a/ReCaptchaWebapiApi/composer.json +++ b/ReCaptchaWebapiApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaWebapiGraphQl/composer.json b/ReCaptchaWebapiGraphQl/composer.json index d32a4c6d..2ee22260 100644 --- a/ReCaptchaWebapiGraphQl/composer.json +++ b/ReCaptchaWebapiGraphQl/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-graph-ql", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-frontend-ui": "*", diff --git a/ReCaptchaWebapiRest/composer.json b/ReCaptchaWebapiRest/composer.json index 42d2b752..b2cb7fd9 100644 --- a/ReCaptchaWebapiRest/composer.json +++ b/ReCaptchaWebapiRest/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-rest", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiUi/composer.json b/ReCaptchaWebapiUi/composer.json index e55a03a3..2601796c 100644 --- a/ReCaptchaWebapiUi/composer.json +++ b/ReCaptchaWebapiUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-re-captcha-frontend-ui": "*" }, diff --git a/Securitytxt/composer.json b/Securitytxt/composer.json index 7fdc5633..ee91e328 100644 --- a/Securitytxt/composer.json +++ b/Securitytxt/composer.json @@ -3,7 +3,7 @@ "description": "Security.txt file for Magento 2 websites", "type": "magento2-module", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-store": "*" diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index ae527fde..baee8fed 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-two-factor-auth", "description": "Two Factor Authentication module for Magento2", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0", "magento/framework": "*", "magento/magento-composer-installer": "*", "magento/module-backend": "*", From dd21badb3bbd6328cd41fb1b3dd0f809020a5b27 Mon Sep 17 00:00:00 2001 From: hemanthjadobe <hemanthj@adobe.com> Date: Fri, 27 Sep 2024 02:36:15 +0000 Subject: [PATCH 137/208] AC-10142: Wishlist sharing email issue fixed --- .../Observer/ShareWishlistObserver.php | 76 +++++ ReCaptchaWishlist/README.md | 1 + .../Integration/ShareWishlistFormTest.php | 271 ++++++++++++++++++ ReCaptchaWishlist/composer.json | 19 ++ ReCaptchaWishlist/etc/adminhtml/system.xml | 21 ++ ReCaptchaWishlist/etc/config.xml | 17 ++ ReCaptchaWishlist/etc/frontend/events.xml | 13 + ReCaptchaWishlist/etc/module.xml | 11 + ReCaptchaWishlist/registration.php | 12 + .../frontend/layout/wishlist_index_share.xml | 30 ++ .../view/frontend/web/css/source/_module.less | 7 + _metapackage/composer.json | 1 + 12 files changed, 479 insertions(+) create mode 100644 ReCaptchaWishlist/Observer/ShareWishlistObserver.php create mode 100644 ReCaptchaWishlist/README.md create mode 100644 ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php create mode 100644 ReCaptchaWishlist/composer.json create mode 100644 ReCaptchaWishlist/etc/adminhtml/system.xml create mode 100644 ReCaptchaWishlist/etc/config.xml create mode 100644 ReCaptchaWishlist/etc/frontend/events.xml create mode 100644 ReCaptchaWishlist/etc/module.xml create mode 100644 ReCaptchaWishlist/registration.php create mode 100644 ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml create mode 100644 ReCaptchaWishlist/view/frontend/web/css/source/_module.less diff --git a/ReCaptchaWishlist/Observer/ShareWishlistObserver.php b/ReCaptchaWishlist/Observer/ShareWishlistObserver.php new file mode 100644 index 00000000..aa904bdf --- /dev/null +++ b/ReCaptchaWishlist/Observer/ShareWishlistObserver.php @@ -0,0 +1,76 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaWishlist\Observer; + +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Response\RedirectInterface; +use Magento\Framework\Event\Observer; +use Magento\Framework\Event\ObserverInterface; +use Magento\Framework\Exception\InputException; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaUi\Model\RequestHandlerInterface; + +/** + * Adds Captcha support for share wishlist + */ +class ShareWishlistObserver implements ObserverInterface +{ + /** + * @var string Captcha key + */ + private const CAPTCHA_KEY = 'wishlist'; + + /** + * @var RedirectInterface + */ + private $redirect; + + /** + * @var IsCaptchaEnabledInterface + */ + private $isCaptchaEnabled; + + /** + * @var RequestHandlerInterface + */ + private $requestHandler; + + /** + * @param RedirectInterface $redirect + * @param IsCaptchaEnabledInterface $isCaptchaEnabled + * @param RequestHandlerInterface $requestHandler + */ + public function __construct( + RedirectInterface $redirect, + IsCaptchaEnabledInterface $isCaptchaEnabled, + RequestHandlerInterface $requestHandler + ) { + $this->redirect = $redirect; + $this->isCaptchaEnabled = $isCaptchaEnabled; + $this->requestHandler = $requestHandler; + } + + /** + * @inheritdoc + * @param Observer $observer + * @return void + * @throws InputException + */ + public function execute(Observer $observer): void + { + if ($this->isCaptchaEnabled->isCaptchaEnabledFor(self::CAPTCHA_KEY)) { + /** @var Action $controller */ + $controller = $observer->getControllerAction(); + $request = $controller->getRequest(); + $response = $controller->getResponse(); + $redirectOnFailureUrl = $this->redirect->getRefererUrl(); + + $this->requestHandler->execute(self::CAPTCHA_KEY, $request, $response, $redirectOnFailureUrl); + } + } +} diff --git a/ReCaptchaWishlist/README.md b/ReCaptchaWishlist/README.md new file mode 100644 index 00000000..2eb34c63 --- /dev/null +++ b/ReCaptchaWishlist/README.md @@ -0,0 +1 @@ +Please refer to: https://github.com/magento/security-package \ No newline at end of file diff --git a/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php b/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php new file mode 100644 index 00000000..d4d1f1de --- /dev/null +++ b/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php @@ -0,0 +1,271 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaWishlist\Test\Integration; + +use Magento\Customer\Model\Session; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Data\Form\FormKey; +use Magento\Framework\Message\MessageInterface; +use Magento\Framework\Validation\ValidationResult; +use Magento\ReCaptchaValidation\Model\Validator; +use Magento\TestFramework\TestCase\AbstractController; +use Magento\TestFramework\Wishlist\Model\GetWishlistByCustomerId; +use Magento\ReCaptchaUi\Model\CaptchaResponseResolverInterface; +use Magento\Framework\UrlInterface; +use PHPUnit\Framework\MockObject\MockObject; + +/** + * Tests for create wish list + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDbIsolation enabled + * @magentoAppArea frontend + */ +class ShareWishlistFormTest extends AbstractController +{ + /** + * @var string Customer ID + */ + private const CUSTOMER_ID = 1; + + /** + * @var Session + */ + private $customerSession; + + /** + * @var string + */ + private $formKey; + + /** + * @var UrlInterface + */ + private $url; + + /** + * @var int + */ + private $wishlistId; + + /** + * @var ValidationResult|MockObject + */ + private $captchaValidationResultMock; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + parent::setUp(); + $this->formKey = $this->_objectManager->get(FormKey::class)->getFormKey(); + $this->customerSession = $this->_objectManager->get(Session::class); + $this->customerSession->setCustomerId(self::CUSTOMER_ID); + $this->wishlistId = $this->_objectManager->get(GetWishlistByCustomerId::class) + ->execute(self::CUSTOMER_ID) + ->getId(); + $this->url = $this->_objectManager->get(UrlInterface::class); + $this->captchaValidationResultMock = $this->createMock(ValidationResult::class); + $captchaValidatorMock = $this->createMock(Validator::class); + $captchaValidatorMock->expects($this->any()) + ->method('isValid') + ->willReturn($this->captchaValidationResultMock); + $this->_objectManager->addSharedInstance($captchaValidatorMock, Validator::class); + } + + /** + * Checks the content of the 'Wish List Sharing' page when ReCaptcha is disabled + */ + public function testGetRequestIfReCaptchaIsDisabled(): void + { + $this->checkSuccessfulGetResponse(); + } + + /** + * Checks the content of the 'Wish List Sharing' page when ReCaptcha is enabled + * but keys are not configured + * + * @magentoConfigFixture base_website recaptcha_frontend/type_for/wishlist invisible + * + * It's needed for proper work of "ifconfig" in layout during tests running + * @magentoConfigFixture default_store recaptcha_frontend/type_for/wishlist invisible + */ + public function testGetRequestIfReCaptchaKeysAreNotConfigured(): void + { + $this->checkSuccessfulGetResponse(); + } + + /** + * Checks the content of the 'Wish List Sharing' page when ReCaptcha is enabled + * and keys are configured + * + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/wishlist invisible + * + * It's needed for proper work of "ifconfig" in layout during tests running + * @magentoConfigFixture default_store recaptcha_frontend/type_for/wishlist invisible + */ + public function testGetRequestIfReCaptchaIsEnabled(): void + { + $this->checkSuccessfulGetResponse(true); + } + + /** + * Checks GET response + * + * @param bool $shouldContainReCaptcha + * @return void + */ + private function checkSuccessfulGetResponse(bool $shouldContainReCaptcha = false): void + { + $this->dispatch('wishlist/index/share/wishlist_id/' . $this->wishlistId); + $content = $this->getResponse()->getBody(); + + $this->assertNotEmpty($content); + + $shouldContainReCaptcha + ? $this->assertStringContainsString('field-recaptcha', $content) + : $this->assertStringNotContainsString('field-recaptcha', $content); + + $this->assertEmpty($this->getSessionMessages(MessageInterface::TYPE_ERROR)); + } + + /** + * Checks the sharing process without ReCaptcha validation + */ + public function testPostRequestWithoutReCaptchaValidation(): void + { + $this->checkSuccessfulPostRequest(); + } + + /** + * Checks the sharing process if ReCaptcha is enabled but keys are not configured + * + * @magentoConfigFixture base_website recaptcha_frontend/type_for/wishlist invisible + * + * It's needed for proper work of "ifconfig" in layout during tests running + * @magentoConfigFixture default_store recaptcha_frontend/type_for/wishlist invisible + */ + public function testPostRequestIfReCaptchaKeysAreNotConfigured(): void + { + $this->checkSuccessfulPostRequest(); + } + + /** + * Checks the successful sharing process with ReCaptcha validation + * + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/wishlist invisible + * + * It's needed for proper work of "ifconfig" in layout during tests running + * @magentoConfigFixture default_store recaptcha_frontend/type_for/wishlist invisible + */ + public function testPostRequestWithSuccessfulReCaptchaValidation(): void + { + $this->captchaValidationResultMock->expects($this->once()) + ->method('isValid') + ->willReturn(true); + $this->checkSuccessfulPostRequest(true); + } + + /** + * Checks successful sharing process + * + * @param bool $withParamReCaptcha + */ + private function checkSuccessfulPostRequest(bool $withParamReCaptcha = false):void + { + $this->makePostRequest($withParamReCaptcha); + $url = $this->url->getRouteUrl('wishlist/index/index/wishlist_id/' . $this->wishlistId . '/'); + $this->assertRedirect(self::equalTo($url)); + $this->assertEmpty($this->getSessionMessages(MessageInterface::TYPE_ERROR)); + } + + /** + * Checks the sharing process with ReCaptcha validation when `g-recaptcha-response` missed + * + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/wishlist invisible + * + * It's needed for proper work of "ifconfig" in layout during tests running + * @magentoConfigFixture default_store recaptcha_frontend/type_for/wishlist invisible + */ + public function testPostRequestIfReCaptchaParameterIsMissed(): void + { + $this->checkFailedPostRequest(); + } + + /** + * Checks the failed sharing process with ReCaptcha validation + * + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key + * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key + * @magentoConfigFixture base_website recaptcha_frontend/type_for/wishlist invisible + * + * It's needed for proper work of "ifconfig" in layout during tests running + * @magentoConfigFixture default_store recaptcha_frontend/type_for/wishlist invisible + */ + public function testPostRequestWithFailedReCaptchaValidation(): void + { + $this->captchaValidationResultMock->expects($this->once()) + ->method('isValid') + ->willReturn(false); + $this->checkFailedPostRequest(true); + } + + /** + * Checks failed sharing process + * + * @param bool $withParamReCaptcha + */ + private function checkFailedPostRequest(bool $withParamReCaptcha = false): void + { + $this->makePostRequest($withParamReCaptcha); + $this->assertSessionMessages( + $this->equalTo(['Something went wrong with reCAPTCHA. Please contact the store owner.']), + MessageInterface::TYPE_ERROR + ); + } + + /** + * Makes post request + * + * @param bool $withParamReCaptcha + * @return void + */ + private function makePostRequest(bool $withParamReCaptcha = false): void + { + $postValue = [ + 'form_key' => $this->formKey, + 'emails' => 'example1@gmail.com, example2@gmail.com, example3@gmail.com', + ]; + + if ($withParamReCaptcha) { + $postValue[CaptchaResponseResolverInterface::PARAM_RECAPTCHA] = 'test'; + } + + $this->getRequest() + ->setMethod(Http::METHOD_POST) + ->setPostValue($postValue); + + $this->dispatch('wishlist/index/send/wishlist_id/' . $this->wishlistId); + } + + /** + * @inheritDoc + */ + public function tearDown(): void + { + $this->customerSession->setCustomerId(null); + parent::tearDown(); + } +} diff --git a/ReCaptchaWishlist/composer.json b/ReCaptchaWishlist/composer.json new file mode 100644 index 00000000..bdb59f42 --- /dev/null +++ b/ReCaptchaWishlist/composer.json @@ -0,0 +1,19 @@ +{ + "name": "magento/module-re-captcha-wishlist", + "description": "Google reCAPTCHA integration for Magento2", + "type": "magento2-module", + "license": "OSL-3.0", + "require": { + "php": "~8.1.0||~8.2.0||~8.3.0", + "magento/framework": "*", + "magento/module-re-captcha-ui": "*" + }, + "autoload": { + "files": [ + "registration.php" + ], + "psr-4": { + "Magento\\ReCaptchaWishlist\\": "" + } + } +} diff --git a/ReCaptchaWishlist/etc/adminhtml/system.xml b/ReCaptchaWishlist/etc/adminhtml/system.xml new file mode 100644 index 00000000..ff80f2d2 --- /dev/null +++ b/ReCaptchaWishlist/etc/adminhtml/system.xml @@ -0,0 +1,21 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> + <system> + <section id="recaptcha_frontend"> + <group id="type_for"> + <field id="wishlist" translate="label" type="select" sortOrder="180" showInDefault="1" + showInWebsite="1" showInStore="0" canRestore="1"> + <label>Enable for Wishlist Sharing</label> + <source_model>Magento\ReCaptchaAdminUi\Model\OptionSource\Type</source_model> + </field> + </group> + </section> + </system> +</config> diff --git a/ReCaptchaWishlist/etc/config.xml b/ReCaptchaWishlist/etc/config.xml new file mode 100644 index 00000000..72b62efe --- /dev/null +++ b/ReCaptchaWishlist/etc/config.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> + <default> + <recaptcha_frontend> + <type_for> + <wishlist/> + </type_for> + </recaptcha_frontend> + </default> +</config> diff --git a/ReCaptchaWishlist/etc/frontend/events.xml b/ReCaptchaWishlist/etc/frontend/events.xml new file mode 100644 index 00000000..b2062abe --- /dev/null +++ b/ReCaptchaWishlist/etc/frontend/events.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> + <event name="controller_action_predispatch_wishlist_index_send"> + <observer name="recaptcha_on_share_wish" instance="Magento\ReCaptchaWishlist\Observer\ShareWishlistObserver"/> + </event> +</config> diff --git a/ReCaptchaWishlist/etc/module.xml b/ReCaptchaWishlist/etc/module.xml new file mode 100644 index 00000000..49f1eb62 --- /dev/null +++ b/ReCaptchaWishlist/etc/module.xml @@ -0,0 +1,11 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> + <module name="Magento_ReCaptchaWishlist"/> +</config> diff --git a/ReCaptchaWishlist/registration.php b/ReCaptchaWishlist/registration.php new file mode 100644 index 00000000..80d100c8 --- /dev/null +++ b/ReCaptchaWishlist/registration.php @@ -0,0 +1,12 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +\Magento\Framework\Component\ComponentRegistrar::register( + \Magento\Framework\Component\ComponentRegistrar::MODULE, + 'Magento_ReCaptchaWishlist', + __DIR__ +); diff --git a/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml b/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml new file mode 100644 index 00000000..ffd90e30 --- /dev/null +++ b/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml @@ -0,0 +1,30 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + --> +<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> + <body> + <referenceBlock name="wishlist.sharing"> + <block class="Magento\ReCaptchaUi\Block\ReCaptcha" + name="captcha" + after="-" + template="Magento_ReCaptchaFrontendUi::recaptcha.phtml" + ifconfig="recaptcha_frontend/type_for/wishlist"> + <arguments> + <argument name="recaptcha_for" xsi:type="string">wishlist</argument> + <argument name="jsLayout" xsi:type="array"> + <item name="components" xsi:type="array"> + <item name="recaptcha" xsi:type="array"> + <item name="component" xsi:type="string">Magento_ReCaptchaFrontendUi/js/reCaptcha</item> + </item> + </item> + </argument> + </arguments> + </block> + </referenceBlock> + </body> +</page> diff --git a/ReCaptchaWishlist/view/frontend/web/css/source/_module.less b/ReCaptchaWishlist/view/frontend/web/css/source/_module.less new file mode 100644 index 00000000..27b68596 --- /dev/null +++ b/ReCaptchaWishlist/view/frontend/web/css/source/_module.less @@ -0,0 +1,7 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +.form.wishlist.share .g-recaptcha { + margin-bottom: 40px; +} diff --git a/_metapackage/composer.json b/_metapackage/composer.json index 91885e9c..a5d608e4 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -26,6 +26,7 @@ "magento/module-re-captcha-webapi-rest": "*", "magento/module-re-captcha-webapi-graph-ql": "*", "magento/module-re-captcha-webapi-ui": "*", + "magento/module-re-captcha-wishlist": "*", "magento/module-securitytxt": "*", "magento/module-two-factor-auth": "*", "google/recaptcha": "^1.2", From 7f805af1eaad1c53c7aabd53c9b99d8876c4141d Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 16 Oct 2024 16:01:07 +0530 Subject: [PATCH 138/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Composer dependency changes --- .../Model/Config/Source/DuoFailmode.php | 17 +++++++++++++++++ TwoFactorAuth/composer.json | 3 ++- TwoFactorAuth/etc/adminhtml/system.xml | 13 +++++++++---- 3 files changed, 28 insertions(+), 5 deletions(-) create mode 100644 TwoFactorAuth/Model/Config/Source/DuoFailmode.php diff --git a/TwoFactorAuth/Model/Config/Source/DuoFailmode.php b/TwoFactorAuth/Model/Config/Source/DuoFailmode.php new file mode 100644 index 00000000..09fdc166 --- /dev/null +++ b/TwoFactorAuth/Model/Config/Source/DuoFailmode.php @@ -0,0 +1,17 @@ +<?php + +namespace Magento\TwoFactorAuth\Model\Config\Source; + +use Magento\Framework\Data\OptionSourceInterface; + +class DuoFailmode implements OptionSourceInterface +{ + public function toOptionArray() + { + return [ + ['value' => 'closed', 'label' => __('Closed')], + ['value' => 'open', 'label' => __('Open')] + ]; + } + +} diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index ae527fde..dd992edc 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -15,7 +15,8 @@ "christian-riesen/base32": "^1.3", "spomky-labs/otphp": "^11.2", "endroid/qr-code": "^4.3.5", - "2tvenom/cborencode": "^1.0" + "2tvenom/cborencode": "^1.0", + "duosecurity/duo_universal_php": "^1.0" }, "type": "magento2-module", "license": "OSL-3.0", diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 257b2a62..bb109720 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -49,13 +49,13 @@ <group id="duo" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Duo Security</label> - <field id="integration_key" translate="label comment" type="text" sortOrder="20" showInDefault="1" + <field id="client_id" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Integration key</label> + <label>Client Id</label> </field> - <field id="secret_key" translate="label comment" type="obscure" sortOrder="30" showInDefault="1" + <field id="client_secret" translate="label comment" type="obscure" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Secret key</label> + <label>Client Secret</label> <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> </field> <field id="api_hostname" translate="label comment" type="text" sortOrder="40" showInDefault="1" @@ -63,6 +63,11 @@ <label>API hostname</label> <backend_model>Magento\TwoFactorAuth\Model\Config\Backend\Duo\ApiHostname</backend_model> </field> + <field id="duo_failmode" translate="label comment" type="select" sortOrder="50" showInDefault="1" + showInWebsite="0" showInStore="0"> + <label>Duo Failmode</label> + <source_model>Magento\TwoFactorAuth\Model\Config\Source\DuoFailmode</source_model> + </field> </group> <group id="authy" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" From 688f59a5e89b61366799906f2ae1d40703b0305a Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Thu, 17 Oct 2024 16:08:06 +0530 Subject: [PATCH 139/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Composer dependency and Univrsal prompt implementation for UI interface on Duo library --- TwoFactorAuth/Block/Provider/Duo/Auth.php | 40 +- .../Controller/Adminhtml/Duo/Authpost.php | 4 +- .../Model/Config/Source/DuoFailmode.php | 7 +- .../Model/Provider/Engine/DuoSecurity.php | 226 ++++----- .../templates/tfa/provider/auth.phtml | 2 +- .../view/adminhtml/web/js/duo/api.js | 437 +----------------- .../view/adminhtml/web/js/duo/auth.js | 32 +- 7 files changed, 146 insertions(+), 602 deletions(-) diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 4f07843a..5c0eb518 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -9,6 +9,8 @@ use Magento\Backend\Block\Template; use Magento\Backend\Model\Auth\Session; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Message\ManagerInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; /** @@ -26,6 +28,11 @@ class Auth extends Template */ private $session; + /** + * @var ManagerInterface + */ + private $messageManager; + /** * @param Template\Context $context * @param Session $session @@ -36,11 +43,13 @@ public function __construct( Template\Context $context, Session $session, DuoSecurity $duoSecurity, + ManagerInterface $messageManager, array $data = [] ) { parent::__construct($context, $data); $this->duoSecurity = $duoSecurity; $this->session = $session; + $this->messageManager = $messageManager; } /** @@ -48,15 +57,32 @@ public function __construct( */ public function getJsLayout() { - $this->jsLayout['components']['tfa-auth']['postUrl'] = - $this->getUrl('*/*/authpost', ['form_key' => $this->getFormKey()]); - - $this->jsLayout['components']['tfa-auth']['signature'] = - $this->duoSecurity->getRequestSignature($this->session->getUser()); + $duoFailMode = $this->duoSecurity->getDuoFailmode(); + try { + $this->duoSecurity->healthCheck(); + } catch (LocalizedException $e) { + if ($duoFailMode == "OPEN") { + // If we're failing open, errors in 2FA still allow for success + $this->messageManager->addSuccessMessage( + __("Login 'Successful', but 2FA Not Performed. Confirm Duo client/secret/host values are correct") + ); + return $this->_redirect('adminhtml/dashboard'); + } else { + // Otherwise the login fails and redirect user to the login page + $this->messageManager->addErrorMessage( + __("2FA Unavailable. Confirm Duo client/secret/host values are correct") + ); + return $this->_redirect('adminhtml'); + } + } - $this->jsLayout['components']['tfa-auth']['apiHost'] = - $this->duoSecurity->getApiHostname(); + $user = $this->session->getUser(); + if ($user) { + $username = $user->getUserName(); + } + $prompt_uri = $this->duoSecurity->initiateAuth($username, $this->getFormKey().'lavijain'); + $this->jsLayout['components']['tfa-auth']['redirectUrl'] = $prompt_uri; return parent::getJsLayout(); } } diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php index 1928332d..25e09d3d 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php @@ -9,7 +9,7 @@ use Magento\Backend\Model\Auth\Session; use Magento\Backend\App\Action; -use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\DataObjectFactory; use Magento\TwoFactorAuth\Model\AlertInterface; use Magento\TwoFactorAuth\Api\TfaInterface; @@ -24,7 +24,7 @@ * * @SuppressWarnings(PHPMD.CamelCaseMethodName) */ -class Authpost extends AbstractAction implements HttpPostActionInterface +class Authpost extends AbstractAction implements HttpGetActionInterface { /** * @var TfaInterface diff --git a/TwoFactorAuth/Model/Config/Source/DuoFailmode.php b/TwoFactorAuth/Model/Config/Source/DuoFailmode.php index 09fdc166..3ebb0ff8 100644 --- a/TwoFactorAuth/Model/Config/Source/DuoFailmode.php +++ b/TwoFactorAuth/Model/Config/Source/DuoFailmode.php @@ -6,6 +6,12 @@ class DuoFailmode implements OptionSourceInterface { + + /** + * Get options + * + * @return array[] + */ public function toOptionArray() { return [ @@ -13,5 +19,4 @@ public function toOptionArray() ['value' => 'open', 'label' => __('Open')] ]; } - } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 2463be87..985885cb 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -9,8 +9,12 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\DataObject; +use Magento\Framework\Data\Form\FormKey; +use Magento\Framework\Encryption\EncryptorInterface; +use Magento\Framework\UrlInterface; use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Api\EngineInterface; +use Duo\DuoUniversal\Client; /** * Duo Security engine @@ -28,70 +32,83 @@ class DuoSecurity implements EngineInterface public const DUO_PREFIX = 'TX'; /** - * Duo app prefix + * Duo auth prefix */ - public const APP_PREFIX = 'APP'; + public const AUTH_PREFIX = 'AUTH'; /** - * Duo auth prefix + * Configuration XML path for enabled flag */ - public const AUTH_PREFIX = 'AUTH'; + public const XML_PATH_ENABLED = 'twofactorauth/duo/enabled'; /** - * Duo expire time + * Configuration XML path for Client Id */ - public const DUO_EXPIRE = 300; + public const XML_PATH_CLIENT_ID = 'twofactorauth/duo/client_id'; /** - * Application expire time + * Configuration XML path for Client secret */ - public const APP_EXPIRE = 3600; + public const XML_PATH_CLIENT_SECRET = 'twofactorauth/duo/client_secret'; /** - * Configuration XML path for enabled flag + * Configuration XML path for host name */ - public const XML_PATH_ENABLED = 'twofactorauth/duo/enabled'; + public const XML_PATH_API_HOSTNAME = 'twofactorauth/duo/api_hostname'; /** - * Configuration XML path for integration key + * Configuration path for Duo Mode */ - public const XML_PATH_INTEGRATION_KEY = 'twofactorauth/duo/integration_key'; + public const DUO_FAILMODE = 'twofactorauth/duo/duo_failmode'; /** - * Configuration XML path for secret key + * @var ScopeConfigInterface */ - public const XML_PATH_SECRET_KEY = 'twofactorauth/duo/secret_key'; + private $scopeConfig; /** - * Configuration XML path for host name + * @var Client */ - public const XML_PATH_API_HOSTNAME = 'twofactorauth/duo/api_hostname'; + private $client; /** - * Configuration XML path for application key + * @var EncryptorInterface */ - public const XML_PATH_APPLICATION_KEY = 'twofactorauth/duo/application_key'; + private $encryptor; /** - * @var ScopeConfigInterface + * @var UrlInterface */ - private $scopeConfig; + private $urlBuilder; /** - * @var string + * @var FormKey */ - private $duoSignaturePrefix; + private $formKey; /** * @param ScopeConfigInterface $scopeConfig - * @param string $duoSignaturePrefix + * @param EncryptorInterface $encryptor + * @param UrlInterface $urlBuilder + * @param FormKey $formKey + * @throws \Duo\DuoUniversal\DuoException */ public function __construct( ScopeConfigInterface $scopeConfig, - string $duoSignaturePrefix = self::AUTH_PREFIX + EncryptorInterface $encryptor, + UrlInterface $urlBuilder, + FormKey $formKey ) { $this->scopeConfig = $scopeConfig; - $this->duoSignaturePrefix = $duoSignaturePrefix; + $this->encryptor = $encryptor; + $this->urlBuilder = $urlBuilder; + $this->formKey = $formKey; + $this->client = new Client( + $this->getClientId(), + $this->getClientSecret(), // Replace with your actual client secret + $this->getApiHostname(), // Replace with your actual API host + $this->getCallbackUrl() + ); } /** @@ -105,163 +122,106 @@ public function getApiHostname(): string } /** - * Get application key + * Get Client Secret * * @return string */ - private function getApplicationKey(): string + private function getClientSecret(): string { - return $this->scopeConfig->getValue(static::XML_PATH_APPLICATION_KEY); + return $this->encryptor->decrypt($this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET)); } /** - * Get secret key + * Get Client Id * * @return string */ - private function getSecretKey(): string + private function getClientId(): string { - return $this->scopeConfig->getValue(static::XML_PATH_SECRET_KEY); + return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_ID); } /** - * Get integration key + * Get Duo Mode * * @return string */ - private function getIntegrationKey(): string + public function getDuoFailmode(): string { - return $this->scopeConfig->getValue(static::XML_PATH_INTEGRATION_KEY); + return strtoupper($this->scopeConfig->getValue(static::DUO_FAILMODE)); } /** - * Sign values + * Get callback URL * - * @param string $key - * @param string $values - * @param string $prefix - * @param int $expire - * @param int $time * @return string */ - private function signValues(string $key, string $values, string $prefix, int $expire, int $time): string + private function getCallbackUrl(): string { - $exp = $time + $expire; - $cookie = $prefix . '|' . base64_encode($values . '|' . $exp); - - $sig = hash_hmac('sha1', $cookie, $key); - return $cookie . '|' . $sig; + return $this->urlBuilder->getUrl('tfa/duo/authpost'); } /** - * Parse signed values and return username - * - * @param string $key - * @param string $val - * @param string $prefix - * @param int $time - * @return string|null + * @inheritDoc */ - private function parseValues(string $key, string $val, string $prefix, int $time): ?string + public function verify(UserInterface $user, DataObject $request): bool { - $integrationKey = $this->getIntegrationKey(); - - $timestamp = ($time ? $time : time()); - - $parts = explode('|', $val); - if (count($parts) !== 3) { - return null; - } - [$uPrefix, $uB64, $uSig] = $parts; - - $sig = hash_hmac('sha1', $uPrefix . '|' . $uB64, $key); - if (hash_hmac('sha1', $sig, $key) !== hash_hmac('sha1', $uSig, $key)) { - return null; - } + $savedState = $request->getData('state'); + $duoCode = $request->getData('duo_code'); + $username = $user->getUserName(); - if ($uPrefix !== $prefix) { - return null; + if (empty($savedState) || empty($username)) { + return false; } - - // @codingStandardsIgnoreStart - $cookieParts = explode('|', base64_decode($uB64)); - // @codingStandardsIgnoreEnd - - if (count($cookieParts) !== 3) { - return null; + if ($this->formKey->getFormKey().'lavijain' != $savedState) { + return false; } - [$user, $uIkey, $exp] = $cookieParts; - if ($uIkey !== $integrationKey) { - return null; - } - if ($timestamp >= (int) $exp) { - return null; + try { + $decoded_token = $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); + } catch (LocalizedException $e) { + return false; } - - return $user; + # Exchange happened successfully so render success page + return true; } /** - * Get request signature - * - * @param UserInterface $user - * @return string + * @inheritDoc */ - public function getRequestSignature(UserInterface $user): string + public function isEnabled(): bool { - $time = time(); - - $values = $user->getUserName() . '|' . $this->getIntegrationKey(); - $duoSignature = $this->signValues( - $this->getSecretKey(), - $values, - $this->duoSignaturePrefix, - static::DUO_EXPIRE, - $time - ); - $appSignature = $this->signValues( - $this->getApplicationKey(), - $values, - static::APP_PREFIX, - static::APP_EXPIRE, - $time - ); - - return $duoSignature . ':' . $appSignature; + try { + return !!$this->getApiHostname() && + !!$this->getClientId() && + !!$this->getClientSecret(); + } catch (\TypeError $exception) { + //At least one of the methods returned null instead of a string + return false; + } } /** - * @inheritDoc + * Generate URI to redirect to for the Duo prompt. + * + * @param string $username + * @param string $state + * @return string */ - public function verify(UserInterface $user, DataObject $request): bool + public function initiateAuth($username, string $state): string { - $time = time(); - - $signatures = explode(':', (string)$request->getData('sig_response')); - if (count($signatures) !== 2) { - return false; - } - [$authSig, $appSig] = $signatures; - - $authUser = $this->parseValues($this->getSecretKey(), $authSig, static::AUTH_PREFIX, $time); - $appUser = $this->parseValues($this->getApplicationKey(), $appSig, static::APP_PREFIX, $time); - - return (($authUser === $appUser) && ($appUser === $user->getUserName())); + $authUrl = $this->client->createAuthUrl($username, $state); + return $authUrl; } /** - * @inheritDoc + * Health check for Duo + * + * @return void + * @throws \Duo\DuoUniversal\DuoException */ - public function isEnabled(): bool + public function healthCheck(): void { - try { - return !!$this->getApiHostname() && - !!$this->getIntegrationKey() && - !!$this->getSecretKey(); - } catch (\TypeError $exception) { - //At least one of the methods returned null instead of a string - return false; - } + $this->client->healthCheck(); } } diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml index 71a1d935..be052324 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml @@ -13,7 +13,7 @@ <script type="text/x-magento-init"> { "#tfa-auth-container": { - "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?> + "Magento_TwoFactorAuth/js/duo/api": <?= /* @noEscape */ $block->getJsLayout() ?> } } </script> diff --git a/TwoFactorAuth/view/adminhtml/web/js/duo/api.js b/TwoFactorAuth/view/adminhtml/web/js/duo/api.js index 27cf3d0f..f9dce63f 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/duo/api.js +++ b/TwoFactorAuth/view/adminhtml/web/js/duo/api.js @@ -3,437 +3,16 @@ * Copyright 2017, Duo Security */ -/* eslint-disable */ -// jscs:disable +define([], function () { + 'use strict'; -(function (root, factory) { -/* eslint-disable */ -if (typeof define === 'function' && define.amd) { - // AMD. Register as an anonymous module. - define([], factory); -} else if (typeof module === 'object' && module.exports) { - // Node. Does not work with strict CommonJS, but - // only CommonJS-like environments that support module.exports, - // like Node. - module.exports = factory(); -} else { - // Browser globals (root is window) - var Duo = factory(); - // If the Javascript was loaded via a script tag, attempt to autoload - // the frame. - - Duo._onReady(Duo.init); - - // Attach Duo to the `window` object - root.Duo = Duo; -} -}(this, function () { - var DUO_MESSAGE_FORMAT = /^(?:AUTH|ENROLL)+\|[A-Za-z0-9\+\/=]+\|[A-Za-z0-9\+\/=]+$/; - var DUO_ERROR_FORMAT = /^ERR\|[\w\s\.\(\)]+$/; - var DUO_OPEN_WINDOW_FORMAT = /^DUO_OPEN_WINDOW\|/; - var VALID_OPEN_WINDOW_DOMAINS = [ - 'duo.com', - 'duosecurity.com', - 'duomobile.s3-us-west-1.amazonaws.com' - ]; - - var iframeId = 'duo_iframe', - postAction = '', - postArgument = 'sig_response', - host, - sigRequest, - duoSig, - appSig, - iframe, - submitCallback; - - function throwError(message, url) { - throw new Error( - 'Duo Web SDK error: ' + message + - (url ? '\n' + 'See ' + url + ' for more information' : '') - ); - } - - function hyphenize(str) { - return str.replace(/([a-z])([A-Z])/, '$1-$2').toLowerCase(); - } - - // cross-browser data attributes - function getDataAttribute(element, name) { - if ('dataset' in element) { - return element.dataset[name]; - } - - return element.getAttribute('data-' + hyphenize(name)); - - } - - // cross-browser event binding/unbinding - function on(context, event, fallbackEvent, callback) { - if ('addEventListener' in window) { - context.addEventListener(event, callback, false); - } else { - context.attachEvent(fallbackEvent, callback); - } - } - - function off(context, event, fallbackEvent, callback) { - if ('removeEventListener' in window) { - context.removeEventListener(event, callback, false); - } else { - context.detachEvent(fallbackEvent, callback); - } - } - - function onReady(callback) { - on(document, 'DOMContentLoaded', 'onreadystatechange', callback); - } - - function offReady(callback) { - off(document, 'DOMContentLoaded', 'onreadystatechange', callback); - } - - function onMessage(callback) { - on(window, 'message', 'onmessage', callback); - } - - function offMessage(callback) { - off(window, 'message', 'onmessage', callback); - } - - /** - * Parse the sig_request parameter, throwing errors if the token contains - * a server error or if the token is invalid. - * - * @param {String} sig Request token - */ - function parseSigRequest(sig) { - if (!sig) { - // nothing to do - return; - } - - // see if the token contains an error, throwing it if it does - if (sig.indexOf('ERR|') === 0) { - throwError(sig.split('|')[1]); + return function (config, element) { + var redirectUrl = config.components['tfa-auth'].redirectUrl; + if (window.location.href !== redirectUrl) { + window.location.href = redirectUrl; } - - // validate the token - if (sig.indexOf(':') === -1 || sig.split(':').length !== 2) { - throwError( - 'Duo was given a bad token. This might indicate a configuration ' + - 'problem with one of Duo\'s client libraries.', - 'https://www.duosecurity.com/docs/duoweb#first-steps' - ); - } - - var sigParts = sig.split(':'); - - // hang on to the token, and the parsed duo and app sigs - sigRequest = sig; - duoSig = sigParts[0]; - appSig = sigParts[1]; - - return { - sigRequest: sig, - duoSig: sigParts[0], - appSig: sigParts[1] - }; - } - - /** - * This function is set up to run when the DOM is ready, if the iframe was - * not available during `init`. - */ - function onDOMReady() { - iframe = document.getElementById(iframeId); - - if (!iframe) { - throw new Error( - 'This page does not contain an iframe for Duo to use.' + - 'Add an element like <iframe id="duo_iframe"></iframe> ' + - 'to this page. ' + - 'See https://www.duosecurity.com/docs/duoweb#3.-show-the-iframe ' + - 'for more information.' - ); - } - - // we've got an iframe, away we go! - ready(); - - // always clean up after yourself - offReady(onDOMReady); - } - - /** - * Validate that a MessageEvent came from the Duo service, and that it - * is a properly formatted payload. - * - * The Google Chrome sign-in page injects some JS into pages that also - * make use of postMessage, so we need to do additional validation above - * and beyond the origin. - * - * @param {MessageEvent} event Message received via postMessage - */ - function isDuoMessage(event) { - return Boolean( - event.origin === 'https://' + host && - typeof event.data === 'string' && - ( - event.data.match(DUO_MESSAGE_FORMAT) || - event.data.match(DUO_ERROR_FORMAT) || - event.data.match(DUO_OPEN_WINDOW_FORMAT) - ) - ); - } - - /** - * Validate the request token and prepare for the iframe to become ready. - * - * All options below can be passed into an options hash to `Duo.init`, or - * specified on the iframe using `data-` attributes. - * - * Options specified using the options hash will take precedence over - * `data-` attributes. - * - * Example using options hash: - * ```javascript - * Duo.init({ - * iframe: "some_other_id", - * host: "api-main.duo.test", - * sig_request: "...", - * post_action: "/auth", - * post_argument: "resp" - * }); - * ``` - * - * Example using `data-` attributes: - * ``` - * <iframe id="duo_iframe" - * data-host="api-main.duo.test" - * data-sig-request="..." - * data-post-action="https://github.com/auth" - * data-post-argument="resp" - * > - * </iframe> - * ``` - * - * @param {Object} options - * @param {String} options.iframe The iframe, or id of an iframe to set up - * @param {String} options.host Hostname - * @param {String} options.sig_request Request token - * @param {String} [options.post_action=''] URL to POST back to after successful auth - * @param {String} [options.post_argument='sig_response'] Parameter name to use for response token - * @param {Function} [options.submit_callback] If provided, duo will not submit the form instead execute - * the callback function with reference to the "duo_form" form object - * submit_callback can be used to prevent the webpage from reloading. - */ - function init(options) { - if (options) { - if (options.host) { - host = options.host; - } - - if (options.sig_request) { - parseSigRequest(options.sig_request); - } - - if (options.post_action) { - postAction = options.post_action; - } - - if (options.post_argument) { - postArgument = options.post_argument; - } - - if (options.iframe) { - if (options.iframe.tagName) { - iframe = options.iframe; - } else if (typeof options.iframe === 'string') { - iframeId = options.iframe; - } - } - - if (typeof options.submit_callback === 'function') { - submitCallback = options.submit_callback; - } - } - - // if we were given an iframe, no need to wait for the rest of the DOM - if (iframe) { - ready(); - } else { - // try to find the iframe in the DOM - iframe = document.getElementById(iframeId); - - // iframe is in the DOM, away we go! - if (iframe) { - ready(); - } else { - // wait until the DOM is ready, then try again - onReady(onDOMReady); - } - } - - // always clean up after yourself! - offReady(init); - } - - /** - * This function is called when a message was received from another domain - * using the `postMessage` API. Check that the event came from the Duo - * service domain, and that the message is a properly formatted payload, - * then perform the post back to the primary service. - * - * @param event Event object (contains origin and data) - */ - function onReceivedMessage(event) { - if (isDuoMessage(event)) { - if (event.data.match(DUO_OPEN_WINDOW_FORMAT)) { - var url = event.data.substring('DUO_OPEN_WINDOW|'.length); - - if (isValidUrlToOpen(url)) { - // Open the URL that comes after the DUO_WINDOW_OPEN token. - window.open(url, '_self'); - } - } else { - // the event came from duo, do the post back - doPostBack(event.data); - - // always clean up after yourself! - offMessage(onReceivedMessage); - } - } - } - - /** - * Validate that this passed in URL is one that we will actually allow to - * be opened. - * @param url String URL that the message poster wants to open - * @returns {boolean} true if we allow this url to be opened in the window - */ - function isValidUrlToOpen(url) { - if (!url) { - return false; - } - - var parser = document.createElement('a'); - - parser.href = url; - - if (parser.protocol === 'duotrustedendpoints:') { - return true; - } else if (parser.protocol !== 'https:') { - return false; - } - - for (var i = 0; i < VALID_OPEN_WINDOW_DOMAINS.length; i++) { - if (parser.hostname.endsWith('.' + VALID_OPEN_WINDOW_DOMAINS[i]) || - parser.hostname === VALID_OPEN_WINDOW_DOMAINS[i]) { - return true; - } - } - - return false; - } - - /** - * Point the iframe at Duo, then wait for it to postMessage back to us. - */ - function ready() { - if (!host) { - host = getDataAttribute(iframe, 'host'); - - if (!host) { - throwError( - 'No API hostname is given for Duo to use. Be sure to pass ' + - 'a `host` parameter to Duo.init, or through the `data-host` ' + - 'attribute on the iframe element.', - 'https://www.duosecurity.com/docs/duoweb#3.-show-the-iframe' - ); - } - } - - if (!duoSig || !appSig) { - parseSigRequest(getDataAttribute(iframe, 'sigRequest')); - - if (!duoSig || !appSig) { - throwError( - 'No valid signed request is given. Be sure to give the ' + - '`sig_request` parameter to Duo.init, or use the ' + - '`data-sig-request` attribute on the iframe element.', - 'https://www.duosecurity.com/docs/duoweb#3.-show-the-iframe' - ); - } - } - - // if postAction/Argument are defaults, see if they are specified - // as data attributes on the iframe - if (postAction === '') { - postAction = getDataAttribute(iframe, 'postAction') || postAction; - } - - if (postArgument === 'sig_response') { - postArgument = getDataAttribute(iframe, 'postArgument') || postArgument; - } - - // point the iframe at Duo - iframe.src = [ - 'https://', host, '/frame/web/v1/auth?tx=', duoSig, - '&parent=', encodeURIComponent(document.location.href), - '&v=2.6' - ].join(''); - - // listen for the 'message' event - onMessage(onReceivedMessage); - } - - /** - * We received a postMessage from Duo. POST back to the primary service - * with the response token, and any additional user-supplied parameters - * given in form#duo_form. - */ - function doPostBack(response) { - // create a hidden input to contain the response token - var input = document.createElement('input'); - - input.type = 'hidden'; - input.name = postArgument; - input.value = response + ':' + appSig; - - // user may supply their own form with additional inputs - var form = document.getElementById('duo_form'); - - // if the form doesn't exist, create one - if (!form) { - form = document.createElement('form'); - - // insert the new form after the iframe - iframe.parentElement.insertBefore(form, iframe.nextSibling); - } - - // make sure we are actually posting to the right place - form.method = 'POST'; - form.action = postAction; - - // add the response token input to the form - form.appendChild(input); - - // away we go! - if (typeof submitCallback === 'function') { - submitCallback.call(null, form); - } else { - form.submit(); - } - } - - return { - init: init, - _onReady: onReady, - _parseSigRequest: parseSigRequest, - _isDuoMessage: isDuoMessage, - _doPostBack: doPostBack }; -})); +}); + /* eslint-enable */ diff --git a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js index c94de8b9..5bf98ca8 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js @@ -17,9 +17,7 @@ define([ template: 'Magento_TwoFactorAuth/duo/auth' }, - signature: '', - apiHost: '', - postUrl: '', + redirectUrl: '', authenticateData: {}, /** @@ -27,32 +25,8 @@ define([ */ onAfterRender: function () { window.setTimeout(function () { - duo.init(); - }, 100); + duo(this, null); + }, 1000); }, - - /** - * Get POST URL - * @returns {String} - */ - getPostUrl: function () { - return this.postUrl; - }, - - /** - * Get signature - * @returns {String} - */ - getSignature: function () { - return this.signature; - }, - - /** - * Get API host - * @returns {String} - */ - getApiHost: function () { - return this.apiHost; - } }); }); From 25da84b6871156b499a962e6ae0e52a2b756250b Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Thu, 24 Oct 2024 16:11:11 +0530 Subject: [PATCH 140/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Auth API and Other configuration related changes --- TwoFactorAuth/Api/Data/DuoDataInterface.php | 36 +++-------- .../Api/DuoAuthenticateInterface.php | 6 +- TwoFactorAuth/Api/DuoConfigureInterface.php | 4 +- .../Data/Provider/Engine/DuoSecurity/Data.php | 24 ++------ .../Model/Provider/Engine/DuoSecurity.php | 59 +++++++++++++++++++ .../Engine/DuoSecurity/Authenticate.php | 16 ++--- .../Provider/Engine/DuoSecurity/Configure.php | 9 ++- TwoFactorAuth/composer.json | 1 + TwoFactorAuth/etc/adminhtml/system.xml | 11 +++- TwoFactorAuth/etc/config.xml | 1 - TwoFactorAuth/etc/di.xml | 4 ++ 11 files changed, 104 insertions(+), 67 deletions(-) diff --git a/TwoFactorAuth/Api/Data/DuoDataInterface.php b/TwoFactorAuth/Api/Data/DuoDataInterface.php index ae57ce22..2d5f4b44 100644 --- a/TwoFactorAuth/Api/Data/DuoDataInterface.php +++ b/TwoFactorAuth/Api/Data/DuoDataInterface.php @@ -17,44 +17,24 @@ interface DuoDataInterface extends ExtensibleDataInterface { /** - * Signature field name + * User Identifier field name */ - public const SIGNATURE = 'signature'; + public const USER_ID = 'user_id'; /** - * Api host field name - */ - public const API_HOSTNAME = 'api_hostname'; - - /** - * Get the signature - * - * @return string - */ - public function getSignature(): string; - - /** - * Set the signature - * - * @param string $value - * @return void - */ - public function setSignature(string $value): void; - - /** - * Get the api hostname + * Get the User Identifier * - * @return string + * @return array */ - public function getApiHostname(): string; + public function getUserId(): array; /** - * Set the api hostname + * Set the User Identifier * - * @param string $value + * @param array $value * @return void */ - public function setApiHostname(string $value): void; + public function setUserId(array $value): void; /** * Retrieve existing extension attributes object or create a new one diff --git a/TwoFactorAuth/Api/DuoAuthenticateInterface.php b/TwoFactorAuth/Api/DuoAuthenticateInterface.php index 221b539d..240fdd39 100644 --- a/TwoFactorAuth/Api/DuoAuthenticateInterface.php +++ b/TwoFactorAuth/Api/DuoAuthenticateInterface.php @@ -34,12 +34,14 @@ public function getAuthenticateData( * * @param string $username * @param string $password - * @param string $signatureResponse + * @param string $userIdentifier + * @param string $passcode * @return string */ public function createAdminAccessTokenWithCredentials( string $username, string $password, - string $signatureResponse + string $userIdentifier, + string $passcode ): string; } diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index c1c6e664..a8923ce5 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -31,8 +31,8 @@ public function getConfigurationData( * Activate the provider and get an admin token * * @param string $tfaToken - * @param string $signatureResponse + * @param string $userIdentifier * @return void */ - public function activate(string $tfaToken, string $signatureResponse): void; + public function activate(string $tfaToken, string $userIdentifier): void; } diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php index a2bcda14..c4e8e91b 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php @@ -20,33 +20,17 @@ class Data extends AbstractExtensibleModel implements DuoDataInterface /** * @inheritDoc */ - public function getSignature(): string + public function getUserId(): array { - return (string)$this->getData(self::SIGNATURE); + return $this->getData(self::USER_ID); } /** * @inheritDoc */ - public function setSignature(string $value): void + public function setUserId(array $value): void { - $this->setData(self::SIGNATURE, $value); - } - - /** - * @inheritDoc - */ - public function getApiHostname(): string - { - return (string)$this->getData(self::API_HOSTNAME); - } - - /** - * @inheritDoc - */ - public function setApiHostname(string $value): void - { - $this->setData(self::API_HOSTNAME, $value); + $this->setData(self::USER_ID, $value); } /** diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 985885cb..c54520de 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -15,6 +15,7 @@ use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Api\EngineInterface; use Duo\DuoUniversal\Client; +use DuoAPI\Auth as DuoAuth; /** * Duo Security engine @@ -56,6 +57,16 @@ class DuoSecurity implements EngineInterface */ public const XML_PATH_API_HOSTNAME = 'twofactorauth/duo/api_hostname'; + /** + * Configuration XML path for integration key + */ + public const XML_PATH_IKEY = 'two_factor_auth/duo/integration_key'; + + /** + * Configuration XML path for secret key + */ + public const XML_PATH_SKEY = 'two_factor_auth/duo/secret_key'; + /** * Configuration path for Duo Mode */ @@ -71,6 +82,11 @@ class DuoSecurity implements EngineInterface */ private $client; + /** + * @var DuoAuth + */ + private $duoAuth; + /** * @var EncryptorInterface */ @@ -109,6 +125,11 @@ public function __construct( $this->getApiHostname(), // Replace with your actual API host $this->getCallbackUrl() ); + $this->duoAuth = new DuoAuth( + $this->getIkey(), + $this->getSkey(), + $this->getApiHostname() + ); } /** @@ -161,6 +182,26 @@ private function getCallbackUrl(): string return $this->urlBuilder->getUrl('tfa/duo/authpost'); } + /** + * Get Integration Key + * + * @return string + */ + private function getIkey(): string + { + return $this->scopeConfig->getValue(static::XML_PATH_IKEY) ?? ''; + } + + /** + * Get Secret Key + * + * @return string + */ + private function getSkey(): string + { + return $this->encryptor->decrypt($this->scopeConfig->getValue(static::XML_PATH_SKEY)) ?? ''; + } + /** * @inheritDoc */ @@ -224,4 +265,22 @@ public function healthCheck(): void { $this->client->healthCheck(); } + + /** + * @param $username + * @param $valid_secs + * @return mixed + */ + public function enrollNewUser($username = null, $valid_secs = null) { + $enrolledUserData = $this->duoAuth->enroll($username, $valid_secs); + return $enrolledUserData; + } + + public function checkAuth($user_id, $ipaddr= null, $trusted_device_token = null, $username = true) { + $this->duoAuth->preauth($user_id, $ipaddr= null, $trusted_device_token = null, $username = true); + } + + public function duoAuthorize($user_identifier, $factor, $factor_params, $ipaddr = null, $async = false) { + return $this->duoAuth->auth($user_identifier, $factor, $factor_params, $ipaddr = null, $async = false); + } } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php index a12dc487..4b26307d 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php @@ -101,8 +101,7 @@ public function getAuthenticateData(string $username, string $password): DuoData return $this->dataFactory->create( [ 'data' => [ - DuoDataInterface::API_HOSTNAME => $this->duo->getApiHostname(), - DuoDataInterface::SIGNATURE => $this->duo->getRequestSignature($user) + DuoDataInterface::USER_ID => $this->duo->enrollNewUser($username, 60) ] ] ); @@ -114,14 +113,15 @@ public function getAuthenticateData(string $username, string $password): DuoData public function createAdminAccessTokenWithCredentials( string $username, string $password, - string $signatureResponse + string $userIdentifier, + string $passcode ): string { $token = $this->adminTokenService->createAdminAccessToken($username, $password); $user = $this->getUser($username); $this->userAuthenticator->assertProviderIsValidForUser((int)$user->getId(), DuoSecurity::CODE); - $this->assertResponseIsValid($user, $signatureResponse); + $this->assertResponseIsValid($user, $userIdentifier, $passcode); return $token; } @@ -130,19 +130,19 @@ public function createAdminAccessTokenWithCredentials( * Assert that the given signature is valid for the user * * @param UserInterface $user - * @param string $signatureResponse + * @param string $userIdentifier * @throws LocalizedException */ - public function assertResponseIsValid(UserInterface $user, string $signatureResponse): void + public function assertResponseIsValid(UserInterface $user, string $userIdentifier, string $passcode): void { $data = $this->dataObjectFactory->create( [ 'data' => [ - 'sig_response' => $signatureResponse + 'user_id' => $userIdentifier ] ] ); - if (!$this->duo->verify($user, $data)) { + if (!$this->duo->duoAuthorize($userIdentifier,"passcode", ['passcode' => $passcode])) { $this->alert->event( 'Magento_TwoFactorAuth', 'DuoSecurity invalid auth', diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index f842cb89..080f707c 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -67,7 +67,7 @@ public function __construct( } /** - * @inheritDoc + * @inheritDoc a user: DUWQ5DZ7ZVV3YUY4WCJX */ public function getConfigurationData(string $tfaToken): DuoDataInterface { @@ -76,8 +76,7 @@ public function getConfigurationData(string $tfaToken): DuoDataInterface return $this->dataFactory->create( [ 'data' => [ - DuoDataInterface::API_HOSTNAME => $this->duo->getApiHostname(), - DuoDataInterface::SIGNATURE => $this->duo->getRequestSignature($user) + DuoDataInterface::USER_ID => $this->duo->enrollNewUser($user->getUserName(), 60) ] ] ); @@ -86,12 +85,12 @@ public function getConfigurationData(string $tfaToken): DuoDataInterface /** * @inheritDoc */ - public function activate(string $tfaToken, string $signatureResponse): void + public function activate(string $tfaToken, string $userIdentifier): void { $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); $userId = (int)$user->getId(); - $this->authenticate->assertResponseIsValid($user, $signatureResponse); + $this->authenticate->assertResponseIsValid($user, $userIdentifier); $this->tfa->getProviderByCode(DuoSecurity::CODE) ->activate($userId); } diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index dd992edc..23177894 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -16,6 +16,7 @@ "spomky-labs/otphp": "^11.2", "endroid/qr-code": "^4.3.5", "2tvenom/cborencode": "^1.0", + "duosecurity/duo_api_php": "dev-master", "duosecurity/duo_universal_php": "^1.0" }, "type": "magento2-module", diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index bb109720..edeb098d 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -48,7 +48,7 @@ </group> <group id="duo" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0"> - <label>Duo Security</label> + <label>Duo Security Universal Prompt</label> <field id="client_id" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Client Id</label> @@ -68,6 +68,15 @@ <label>Duo Failmode</label> <source_model>Magento\TwoFactorAuth\Model\Config\Source\DuoFailmode</source_model> </field> + <field id="integration_key" translate="label comment" type="text" sortOrder="60" showInDefault="1" + showInWebsite="0" showInStore="0"> + <label>Integration Key</label> + </field> + <field id="secret_key" translate="label comment" type="obscure" sortOrder="70" showInDefault="1" + showInWebsite="0" showInStore="0"> + <label>Secret Key</label> + <backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model> + </field> </group> <group id="authy" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="0" diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 6333af28..5d87b5c5 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -18,7 +18,6 @@ </authy> <duo> <secret_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> - <application_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </duo> <google> <leeway backend_model="Magento\TwoFactorAuth\Model\Config\Backend\Leeway">29</leeway> diff --git a/TwoFactorAuth/etc/di.xml b/TwoFactorAuth/etc/di.xml index d58a4a55..58992ed6 100644 --- a/TwoFactorAuth/etc/di.xml +++ b/TwoFactorAuth/etc/di.xml @@ -57,12 +57,16 @@ <argument name="sensitive" xsi:type="array"> <item name="twofactorauth/duo/integration_key" xsi:type="string">1</item> <item name="twofactorauth/duo/secret_key" xsi:type="string">1</item> + <item name="twofactorauth/duo/client_id" xsi:type="string">1</item> + <item name="twofactorauth/duo/client_secret" xsi:type="string">1</item> <item name="twofactorauth/duo/api_hostname" xsi:type="string">1</item> <item name="twofactorauth/authy/api_key" xsi:type="string">1</item> </argument> <argument name="environment" xsi:type="array"> <item name="twofactorauth/duo/integration_key" xsi:type="string">1</item> <item name="twofactorauth/duo/secret_key" xsi:type="string">1</item> + <item name="twofactorauth/duo/client_id" xsi:type="string">1</item> + <item name="twofactorauth/duo/client_secret" xsi:type="string">1</item> <item name="twofactorauth/duo/api_hostname" xsi:type="string">1</item> <item name="twofactorauth/authy/api_key" xsi:type="string">1</item> </argument> From f5f123b7bbab72441ca9add62d9c34defabbf229 Mon Sep 17 00:00:00 2001 From: Anna Bukatar <abukatar@adobe.com> Date: Thu, 31 Oct 2024 14:01:39 -0700 Subject: [PATCH 141/208] ACP2E-3300: Captcha on admin login does not require interaction for some users --- ReCaptchaUser/Observer/LoginObserver.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReCaptchaUser/Observer/LoginObserver.php b/ReCaptchaUser/Observer/LoginObserver.php index 4fb52736..bdedc940 100644 --- a/ReCaptchaUser/Observer/LoginObserver.php +++ b/ReCaptchaUser/Observer/LoginObserver.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); From c6965551e01f96eaaa4e7c13dafdabdae6adc3df Mon Sep 17 00:00:00 2001 From: Anna Bukatar <abukatar@adobe.com> Date: Thu, 31 Oct 2024 14:02:26 -0700 Subject: [PATCH 142/208] ACP2E-3300: Captcha on admin login does not require interaction for some users --- ReCaptchaUser/Test/Integration/LoginFormTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReCaptchaUser/Test/Integration/LoginFormTest.php b/ReCaptchaUser/Test/Integration/LoginFormTest.php index 68671006..ce947236 100644 --- a/ReCaptchaUser/Test/Integration/LoginFormTest.php +++ b/ReCaptchaUser/Test/Integration/LoginFormTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); From 17871f13758c722e9410687887a1049d7015e242 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Mon, 4 Nov 2024 16:32:13 +0530 Subject: [PATCH 143/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-configure API related changes with data --- TwoFactorAuth/Api/Data/DuoDataInterface.php | 6 +-- TwoFactorAuth/Api/DuoConfigureInterface.php | 3 +- .../Data/Provider/Engine/DuoSecurity/Data.php | 8 ++-- .../Model/Provider/Engine/DuoSecurity.php | 38 ++++++++++++++----- .../Engine/DuoSecurity/Authenticate.php | 9 +---- .../Provider/Engine/DuoSecurity/Configure.php | 6 +-- 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/TwoFactorAuth/Api/Data/DuoDataInterface.php b/TwoFactorAuth/Api/Data/DuoDataInterface.php index 2d5f4b44..18e41617 100644 --- a/TwoFactorAuth/Api/Data/DuoDataInterface.php +++ b/TwoFactorAuth/Api/Data/DuoDataInterface.php @@ -19,14 +19,14 @@ interface DuoDataInterface extends ExtensibleDataInterface /** * User Identifier field name */ - public const USER_ID = 'user_id'; + public const USER_IDENTIFIER = 'user_identifier'; /** * Get the User Identifier * * @return array */ - public function getUserId(): array; + public function getUserIdentifier(): array; /** * Set the User Identifier @@ -34,7 +34,7 @@ public function getUserId(): array; * @param array $value * @return void */ - public function setUserId(array $value): void; + public function setUserIdentifier(array $value): void; /** * Retrieve existing extension attributes object or create a new one diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index a8923ce5..4d221b3f 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -32,7 +32,8 @@ public function getConfigurationData( * * @param string $tfaToken * @param string $userIdentifier + * @param string $passcode * @return void */ - public function activate(string $tfaToken, string $userIdentifier): void; + public function activate(string $tfaToken, string $userIdentifier, string $passcode): void; } diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php index c4e8e91b..81a56657 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php @@ -20,17 +20,17 @@ class Data extends AbstractExtensibleModel implements DuoDataInterface /** * @inheritDoc */ - public function getUserId(): array + public function getUserIdentifier(): array { - return $this->getData(self::USER_ID); + return $this->getData(self::USER_IDENTIFIER); } /** * @inheritDoc */ - public function setUserId(array $value): void + public function setUserIdentifier(array $value): void { - $this->setData(self::USER_ID, $value); + $this->setData(self::USER_IDENTIFIER, $value); } /** diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index c54520de..2db1e318 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -121,8 +121,8 @@ public function __construct( $this->formKey = $formKey; $this->client = new Client( $this->getClientId(), - $this->getClientSecret(), // Replace with your actual client secret - $this->getApiHostname(), // Replace with your actual API host + $this->getClientSecret(), + $this->getApiHostname(), $this->getCallbackUrl() ); $this->duoAuth = new DuoAuth( @@ -267,20 +267,40 @@ public function healthCheck(): void } /** - * @param $username - * @param $valid_secs + * Enroll a new user. + * + * @param string|null $username + * @param int|null $valid_secs * @return mixed */ public function enrollNewUser($username = null, $valid_secs = null) { - $enrolledUserData = $this->duoAuth->enroll($username, $valid_secs); - return $enrolledUserData; + return $this->duoAuth->enroll($username, $valid_secs); } - public function checkAuth($user_id, $ipaddr= null, $trusted_device_token = null, $username = true) { - $this->duoAuth->preauth($user_id, $ipaddr= null, $trusted_device_token = null, $username = true); + /** + * Check authentication. + * + * @param string $user_id + * @param string|null $ipaddr + * @param string|null $trusted_device_token + * @param bool $username + * @return void + */ + public function checkAuth($user_id, $ipaddr = null, $trusted_device_token = null, $username = true) { + $this->duoAuth->preauth($user_id, $ipaddr, $trusted_device_token, $username); } + /** + * Authorize a user with Duo. + * + * @param string $user_identifier + * @param string $factor + * @param array $factor_params + * @param string|null $ipaddr + * @param bool $async + * @return array|void + */ public function duoAuthorize($user_identifier, $factor, $factor_params, $ipaddr = null, $async = false) { - return $this->duoAuth->auth($user_identifier, $factor, $factor_params, $ipaddr = null, $async = false); + return $this->duoAuth->auth($user_identifier, $factor, $factor_params, $ipaddr, $async); } } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php index 4b26307d..a7dc7f9a 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php @@ -101,7 +101,7 @@ public function getAuthenticateData(string $username, string $password): DuoData return $this->dataFactory->create( [ 'data' => [ - DuoDataInterface::USER_ID => $this->duo->enrollNewUser($username, 60) + DuoDataInterface::USER_IDENTIFIER => $this->duo->enrollNewUser($username, 60) ] ] ); @@ -135,13 +135,6 @@ public function createAdminAccessTokenWithCredentials( */ public function assertResponseIsValid(UserInterface $user, string $userIdentifier, string $passcode): void { - $data = $this->dataObjectFactory->create( - [ - 'data' => [ - 'user_id' => $userIdentifier - ] - ] - ); if (!$this->duo->duoAuthorize($userIdentifier,"passcode", ['passcode' => $passcode])) { $this->alert->event( 'Magento_TwoFactorAuth', diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index 080f707c..47d1e14d 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -76,7 +76,7 @@ public function getConfigurationData(string $tfaToken): DuoDataInterface return $this->dataFactory->create( [ 'data' => [ - DuoDataInterface::USER_ID => $this->duo->enrollNewUser($user->getUserName(), 60) + DuoDataInterface::USER_IDENTIFIER => $this->duo->enrollNewUser($user->getUserName(), 60) ] ] ); @@ -85,12 +85,12 @@ public function getConfigurationData(string $tfaToken): DuoDataInterface /** * @inheritDoc */ - public function activate(string $tfaToken, string $userIdentifier): void + public function activate(string $tfaToken, string $userIdentifier, string $passcode): void { $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); $userId = (int)$user->getId(); - $this->authenticate->assertResponseIsValid($user, $userIdentifier); + $this->authenticate->assertResponseIsValid($user, $userIdentifier, $passcode); $this->tfa->getProviderByCode(DuoSecurity::CODE) ->activate($userId); } From 4442023848b6a69df9dbaf6ec31af45bf003255d Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 8 Nov 2024 01:33:23 +0530 Subject: [PATCH 144/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-configure Auth and activate API implementation related changes --- TwoFactorAuth/Api/Data/DuoDataInterface.php | 20 ----- .../Api/DuoAuthenticateInterface.php | 14 ---- TwoFactorAuth/Api/DuoConfigureInterface.php | 7 +- TwoFactorAuth/Block/Provider/Duo/Auth.php | 2 +- .../Data/Provider/Engine/DuoSecurity/Data.php | 16 ---- .../Model/Provider/Engine/DuoSecurity.php | 76 ++++++++++++------- .../Engine/DuoSecurity/Authenticate.php | 31 ++------ .../Provider/Engine/DuoSecurity/Configure.php | 22 ++---- 8 files changed, 65 insertions(+), 123 deletions(-) diff --git a/TwoFactorAuth/Api/Data/DuoDataInterface.php b/TwoFactorAuth/Api/Data/DuoDataInterface.php index 18e41617..c152ab5e 100644 --- a/TwoFactorAuth/Api/Data/DuoDataInterface.php +++ b/TwoFactorAuth/Api/Data/DuoDataInterface.php @@ -16,26 +16,6 @@ */ interface DuoDataInterface extends ExtensibleDataInterface { - /** - * User Identifier field name - */ - public const USER_IDENTIFIER = 'user_identifier'; - - /** - * Get the User Identifier - * - * @return array - */ - public function getUserIdentifier(): array; - - /** - * Set the User Identifier - * - * @param array $value - * @return void - */ - public function setUserIdentifier(array $value): void; - /** * Retrieve existing extension attributes object or create a new one * diff --git a/TwoFactorAuth/Api/DuoAuthenticateInterface.php b/TwoFactorAuth/Api/DuoAuthenticateInterface.php index 240fdd39..0a88b571 100644 --- a/TwoFactorAuth/Api/DuoAuthenticateInterface.php +++ b/TwoFactorAuth/Api/DuoAuthenticateInterface.php @@ -17,31 +17,17 @@ */ interface DuoAuthenticateInterface { - /** - * Get the information required to configure duo - * - * @param string $username - * @param string $password - * @return \Magento\TwoFactorAuth\Api\Data\DuoDataInterface - */ - public function getAuthenticateData( - string $username, - string $password - ): DuoDataInterface; - /** * Authenticate and get an admin token * * @param string $username * @param string $password - * @param string $userIdentifier * @param string $passcode * @return string */ public function createAdminAccessTokenWithCredentials( string $username, string $password, - string $userIdentifier, string $passcode ): string; } diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index 4d221b3f..cefe02dd 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -21,19 +21,16 @@ interface DuoConfigureInterface * Get the information required to configure duo * * @param string $tfaToken - * @return \Magento\TwoFactorAuth\Api\Data\DuoDataInterface */ public function getConfigurationData( string $tfaToken - ): DuoDataInterface; + ); /** * Activate the provider and get an admin token * * @param string $tfaToken - * @param string $userIdentifier - * @param string $passcode * @return void */ - public function activate(string $tfaToken, string $userIdentifier, string $passcode): void; + public function activate(string $tfaToken): void; } diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 5c0eb518..a8e6c86e 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -81,7 +81,7 @@ public function getJsLayout() if ($user) { $username = $user->getUserName(); } - $prompt_uri = $this->duoSecurity->initiateAuth($username, $this->getFormKey().'lavijain'); + $prompt_uri = $this->duoSecurity->initiateAuth($username, $this->getFormKey().DuoSecurity::AUTH_SUFFIX); $this->jsLayout['components']['tfa-auth']['redirectUrl'] = $prompt_uri; return parent::getJsLayout(); } diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php index 81a56657..f9cde7ef 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php @@ -17,22 +17,6 @@ */ class Data extends AbstractExtensibleModel implements DuoDataInterface { - /** - * @inheritDoc - */ - public function getUserIdentifier(): array - { - return $this->getData(self::USER_IDENTIFIER); - } - - /** - * @inheritDoc - */ - public function setUserIdentifier(array $value): void - { - $this->setData(self::USER_IDENTIFIER, $value); - } - /** * Retrieve existing extension attributes object or create a new one * diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 2db1e318..3420ae6d 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -11,6 +11,7 @@ use Magento\Framework\DataObject; use Magento\Framework\Data\Form\FormKey; use Magento\Framework\Encryption\EncryptorInterface; +use Magento\Framework\Session\SessionManagerInterface; use Magento\Framework\UrlInterface; use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Api\EngineInterface; @@ -37,6 +38,11 @@ class DuoSecurity implements EngineInterface */ public const AUTH_PREFIX = 'AUTH'; + /** + * Duo auth suffix + */ + public const AUTH_SUFFIX = 'DUOAUTH'; + /** * Configuration XML path for enabled flag */ @@ -60,12 +66,12 @@ class DuoSecurity implements EngineInterface /** * Configuration XML path for integration key */ - public const XML_PATH_IKEY = 'two_factor_auth/duo/integration_key'; + public const XML_PATH_IKEY = 'twofactorauth/duo/integration_key'; /** * Configuration XML path for secret key */ - public const XML_PATH_SKEY = 'two_factor_auth/duo/secret_key'; + public const XML_PATH_SKEY = 'twofactorauth/duo/secret_key'; /** * Configuration path for Duo Mode @@ -102,23 +108,31 @@ class DuoSecurity implements EngineInterface */ private $formKey; + /** + * @var SessionManagerInterface + */ + private $session; + /** * @param ScopeConfigInterface $scopeConfig * @param EncryptorInterface $encryptor * @param UrlInterface $urlBuilder * @param FormKey $formKey + * @param SessionManagerInterface $session * @throws \Duo\DuoUniversal\DuoException */ public function __construct( ScopeConfigInterface $scopeConfig, EncryptorInterface $encryptor, UrlInterface $urlBuilder, - FormKey $formKey + FormKey $formKey, + SessionManagerInterface $session ) { $this->scopeConfig = $scopeConfig; $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; $this->formKey = $formKey; + $this->session = $session; $this->client = new Client( $this->getClientId(), $this->getClientSecret(), @@ -189,7 +203,7 @@ private function getCallbackUrl(): string */ private function getIkey(): string { - return $this->scopeConfig->getValue(static::XML_PATH_IKEY) ?? ''; + return $this->scopeConfig->getValue(static::XML_PATH_IKEY); } /** @@ -199,7 +213,7 @@ private function getIkey(): string */ private function getSkey(): string { - return $this->encryptor->decrypt($this->scopeConfig->getValue(static::XML_PATH_SKEY)) ?? ''; + return $this->scopeConfig->getValue(static::XML_PATH_SKEY); } /** @@ -214,12 +228,14 @@ public function verify(UserInterface $user, DataObject $request): bool if (empty($savedState) || empty($username)) { return false; } - if ($this->formKey->getFormKey().'lavijain' != $savedState) { + if ($this->formKey->getFormKey().static::AUTH_SUFFIX != $savedState) { return false; } try { $decoded_token = $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); + // Save the token in the session for later use + $this->session->setData('duo_token', $decoded_token); } catch (LocalizedException $e) { return false; } @@ -243,7 +259,7 @@ public function isEnabled(): bool } /** - * Generate URI to redirect to for the Duo prompt. + * Generate URI to redirect to for the Duo Universal prompt. * * @param string $username * @param string $state @@ -251,12 +267,11 @@ public function isEnabled(): bool */ public function initiateAuth($username, string $state): string { - $authUrl = $this->client->createAuthUrl($username, $state); - return $authUrl; + return $this->client->createAuthUrl($username, $state); } /** - * Health check for Duo + * Health check for Duo Universal prompt. * * @return void * @throws \Duo\DuoUniversal\DuoException @@ -267,40 +282,45 @@ public function healthCheck(): void } /** - * Enroll a new user. + * Enroll a new user for Duo Auth API. * * @param string|null $username - * @param int|null $valid_secs + * @param int|null $validSecs * @return mixed */ - public function enrollNewUser($username = null, $valid_secs = null) { - return $this->duoAuth->enroll($username, $valid_secs); + public function enrollNewUser($username = null, $validSecs = null) { + return $this->duoAuth->enroll($username, $validSecs); } /** - * Check authentication. + * Check authentication for Duo Auth API. * - * @param string $user_id - * @param string|null $ipaddr - * @param string|null $trusted_device_token + * @param string $userIdentifier + * @param string|null $ipAddr + * @param string|null $trustedDeviceToken * @param bool $username - * @return void + * @return string */ - public function checkAuth($user_id, $ipaddr = null, $trusted_device_token = null, $username = true) { - $this->duoAuth->preauth($user_id, $ipaddr, $trusted_device_token, $username); + public function assertUserIsValid($userIdentifier, $ipAddr = null, $trustedDeviceToken = null, $username = true) { + $response = $this->duoAuth->preauth($userIdentifier, $ipAddr, $trustedDeviceToken, $username); + return $response['response']['response']['result']; } /** - * Authorize a user with Duo. + * Authorize a user with Duo Auth API. * - * @param string $user_identifier + * @param string $userIdentifier * @param string $factor - * @param array $factor_params - * @param string|null $ipaddr + * @param array $factorParams + * @param string|null $ipAddr * @param bool $async - * @return array|void + * @return array */ - public function duoAuthorize($user_identifier, $factor, $factor_params, $ipaddr = null, $async = false) { - return $this->duoAuth->auth($user_identifier, $factor, $factor_params, $ipaddr, $async); + public function authorizeUser($userIdentifier, $factor, $factorParams, $ipAddr = null, $async = false) { + $response = $this->duoAuth->auth($userIdentifier, $factor, $factorParams, $ipAddr, $async); + return [ + 'status' => $response['response']['response']['status'], + 'msg' => $response['response']['response']['status_msg'] + ]; } } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php index a7dc7f9a..add98548 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php @@ -88,32 +88,12 @@ public function __construct( $this->userAuthenticator = $userAuthenticator; } - /** - * @inheritDoc - */ - public function getAuthenticateData(string $username, string $password): DuoDataInterface - { - $this->adminTokenService->createAdminAccessToken($username, $password); - - $user = $this->getUser($username); - $this->userAuthenticator->assertProviderIsValidForUser((int)$user->getId(), DuoSecurity::CODE); - - return $this->dataFactory->create( - [ - 'data' => [ - DuoDataInterface::USER_IDENTIFIER => $this->duo->enrollNewUser($username, 60) - ] - ] - ); - } - /** * @inheritDoc */ public function createAdminAccessTokenWithCredentials( string $username, string $password, - string $userIdentifier, string $passcode ): string { $token = $this->adminTokenService->createAdminAccessToken($username, $password); @@ -121,7 +101,7 @@ public function createAdminAccessTokenWithCredentials( $user = $this->getUser($username); $this->userAuthenticator->assertProviderIsValidForUser((int)$user->getId(), DuoSecurity::CODE); - $this->assertResponseIsValid($user, $userIdentifier, $passcode); + $this->assertResponseIsValid($user, $username, $passcode); return $token; } @@ -130,15 +110,16 @@ public function createAdminAccessTokenWithCredentials( * Assert that the given signature is valid for the user * * @param UserInterface $user - * @param string $userIdentifier + * @param string $username * @throws LocalizedException */ - public function assertResponseIsValid(UserInterface $user, string $userIdentifier, string $passcode): void + public function assertResponseIsValid(UserInterface $user, $username, string $passcode): void { - if (!$this->duo->duoAuthorize($userIdentifier,"passcode", ['passcode' => $passcode])) { + $duoAuthResponse = $this->duo->authorizeUser($username,"passcode", ['passcode' => $passcode]); + if ($duoAuthResponse['status'] !== 'allow') { $this->alert->event( 'Magento_TwoFactorAuth', - 'DuoSecurity invalid auth', + 'DuoSecurity invalid auth '. $duoAuthResponse['msg'], AlertInterface::LEVEL_WARNING, $user->getUserName() ); diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index 47d1e14d..e3c4bc6e 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -67,31 +67,25 @@ public function __construct( } /** - * @inheritDoc a user: DUWQ5DZ7ZVV3YUY4WCJX + * @inheritDoc */ - public function getConfigurationData(string $tfaToken): DuoDataInterface + public function getConfigurationData(string $tfaToken) { $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); - - return $this->dataFactory->create( - [ - 'data' => [ - DuoDataInterface::USER_IDENTIFIER => $this->duo->enrollNewUser($user->getUserName(), 60) - ] - ] - ); + return $this->duo->enrollNewUser($user->getUserName(), 60); } /** * @inheritDoc */ - public function activate(string $tfaToken, string $userIdentifier, string $passcode): void + public function activate(string $tfaToken): void { $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); $userId = (int)$user->getId(); - $this->authenticate->assertResponseIsValid($user, $userIdentifier, $passcode); - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($userId); + if($this->duo->assertUserIsValid($user->getUserName()) == "auth") { + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->activate($userId); + } } } From e2f36f38b6031209453fd565ffc2cabdc9d9a2d8 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Mon, 11 Nov 2024 17:04:30 +0530 Subject: [PATCH 145/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-data interface removal --- TwoFactorAuth/Api/Data/DuoDataInterface.php | 37 ---------------- .../Api/DuoAuthenticateInterface.php | 2 - TwoFactorAuth/Api/DuoConfigureInterface.php | 5 +-- .../Data/Provider/Engine/DuoSecurity/Data.php | 42 ------------------- .../Engine/DuoSecurity/Authenticate.php | 10 ----- .../Provider/Engine/DuoSecurity/Configure.php | 10 ----- TwoFactorAuth/etc/di.xml | 1 - TwoFactorAuth/etc/webapi.xml | 7 ---- 8 files changed, 2 insertions(+), 112 deletions(-) delete mode 100644 TwoFactorAuth/Api/Data/DuoDataInterface.php delete mode 100644 TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php diff --git a/TwoFactorAuth/Api/Data/DuoDataInterface.php b/TwoFactorAuth/Api/Data/DuoDataInterface.php deleted file mode 100644 index c152ab5e..00000000 --- a/TwoFactorAuth/Api/Data/DuoDataInterface.php +++ /dev/null @@ -1,37 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\TwoFactorAuth\Api\Data; - -use Magento\Framework\Api\ExtensibleDataInterface; - -/** - * Represents the data needed to use duo - * - * @api - */ -interface DuoDataInterface extends ExtensibleDataInterface -{ - /** - * Retrieve existing extension attributes object or create a new one - * - * Used fully qualified namespaces in annotations for proper work of extension interface/class code generation - * - * @return \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface|null - */ - public function getExtensionAttributes(): ?DuoDataExtensionInterface; - - /** - * Set an extension attributes object - * - * @param \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface $extensionAttributes - * @return void - */ - public function setExtensionAttributes( - DuoDataExtensionInterface $extensionAttributes - ): void; -} diff --git a/TwoFactorAuth/Api/DuoAuthenticateInterface.php b/TwoFactorAuth/Api/DuoAuthenticateInterface.php index 0a88b571..e7c8f859 100644 --- a/TwoFactorAuth/Api/DuoAuthenticateInterface.php +++ b/TwoFactorAuth/Api/DuoAuthenticateInterface.php @@ -8,8 +8,6 @@ namespace Magento\TwoFactorAuth\Api; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; - /** * Represents authentication for the duo security provider * diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index cefe02dd..8a1db919 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -8,8 +8,6 @@ namespace Magento\TwoFactorAuth\Api; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; - /** * Represents configuration for the duo security provider * @@ -18,9 +16,10 @@ interface DuoConfigureInterface { /** - * Get the information required to configure duo + * configure duo for first time user * * @param string $tfaToken + * @return void */ public function getConfigurationData( string $tfaToken diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php deleted file mode 100644 index f9cde7ef..00000000 --- a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -declare(strict_types=1); - -namespace Magento\TwoFactorAuth\Model\Data\Provider\Engine\DuoSecurity; - -use Magento\Framework\Model\AbstractExtensibleModel; -use Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; - -/** - * Represents the data needed to authenticate with duo - */ -class Data extends AbstractExtensibleModel implements DuoDataInterface -{ - /** - * Retrieve existing extension attributes object or create a new one - * - * Used fully qualified namespaces in annotations for proper work of extension interface/class code generation - * - * @return \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface|null - */ - public function getExtensionAttributes(): ?DuoDataExtensionInterface - { - return $this->getData(self::EXTENSION_ATTRIBUTES_KEY); - } - - /** - * Set an extension attributes object - * - * @param \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface $extensionAttributes - * @return void - */ - public function setExtensionAttributes(DuoDataExtensionInterface $extensionAttributes): void - { - $this->setData(self::EXTENSION_ATTRIBUTES_KEY, $extensionAttributes); - } -} diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php index add98548..a679f63c 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php @@ -12,8 +12,6 @@ use Magento\Framework\Exception\AuthenticationException; use Magento\Framework\Exception\LocalizedException; use Magento\Integration\Api\AdminTokenServiceInterface; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterfaceFactory; use Magento\TwoFactorAuth\Api\DuoAuthenticateInterface; use Magento\TwoFactorAuth\Model\AlertInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; @@ -46,11 +44,6 @@ class Authenticate implements DuoAuthenticateInterface */ private $adminTokenService; - /** - * @var DuoDataInterfaceFactory - */ - private $dataFactory; - /** * @var DataObjectFactory */ @@ -66,7 +59,6 @@ class Authenticate implements DuoAuthenticateInterface * @param AlertInterface $alert * @param DuoSecurity $duo * @param AdminTokenServiceInterface $adminTokenService - * @param DuoDataInterfaceFactory $dataFactory * @param DataObjectFactory $dataObjectFactory * @param UserAuthenticator $userAuthenticator */ @@ -75,7 +67,6 @@ public function __construct( AlertInterface $alert, DuoSecurity $duo, AdminTokenServiceInterface $adminTokenService, - DuoDataInterfaceFactory $dataFactory, DataObjectFactory $dataObjectFactory, UserAuthenticator $userAuthenticator ) { @@ -83,7 +74,6 @@ public function __construct( $this->alert = $alert; $this->duo = $duo; $this->adminTokenService = $adminTokenService; - $this->dataFactory = $dataFactory; $this->dataObjectFactory = $dataObjectFactory; $this->userAuthenticator = $userAuthenticator; } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index e3c4bc6e..b49adf94 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -8,8 +8,6 @@ namespace Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterfaceFactory; use Magento\TwoFactorAuth\Api\DuoConfigureInterface; use Magento\TwoFactorAuth\Api\TfaInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; @@ -30,11 +28,6 @@ class Configure implements DuoConfigureInterface */ private $duo; - /** - * @var DuoDataInterfaceFactory - */ - private $dataFactory; - /** * @var TfaInterface */ @@ -48,20 +41,17 @@ class Configure implements DuoConfigureInterface /** * @param UserAuthenticator $userAuthenticator * @param DuoSecurity $duo - * @param DuoDataInterfaceFactory $dataFactory * @param TfaInterface $tfa * @param Authenticate $authenticate */ public function __construct( UserAuthenticator $userAuthenticator, DuoSecurity $duo, - DuoDataInterfaceFactory $dataFactory, TfaInterface $tfa, Authenticate $authenticate ) { $this->userAuthenticator = $userAuthenticator; $this->duo = $duo; - $this->dataFactory = $dataFactory; $this->tfa = $tfa; $this->authenticate = $authenticate; } diff --git a/TwoFactorAuth/etc/di.xml b/TwoFactorAuth/etc/di.xml index 58992ed6..c14e81f6 100644 --- a/TwoFactorAuth/etc/di.xml +++ b/TwoFactorAuth/etc/di.xml @@ -38,7 +38,6 @@ <preference for="Magento\TwoFactorAuth\Api\U2fKeyAuthenticateInterface" type="Magento\TwoFactorAuth\Model\Provider\Engine\U2fKey\Authenticate"/> <preference for="Magento\TwoFactorAuth\Api\DuoConfigureInterface" type="Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity\Configure"/> <preference for="Magento\TwoFactorAuth\Api\DuoAuthenticateInterface" type="Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity\Authenticate"/> - <preference for="Magento\TwoFactorAuth\Api\Data\DuoDataInterface" type="Magento\TwoFactorAuth\Model\Data\Provider\Engine\DuoSecurity\Data"/> <preference for="Magento\TwoFactorAuth\Api\U2fKeyConfigReaderInterface" type="Magento\TwoFactorAuth\Model\Provider\Engine\U2fKey\ConfigReader"/> <type name="Magento\Framework\Console\CommandListInterface"> diff --git a/TwoFactorAuth/etc/webapi.xml b/TwoFactorAuth/etc/webapi.xml index 2c7cd443..2ca7a04b 100644 --- a/TwoFactorAuth/etc/webapi.xml +++ b/TwoFactorAuth/etc/webapi.xml @@ -176,13 +176,6 @@ </resources> </route> - <route url="/V1/tfa/provider/duo_security/get-authentication-data" method="POST"> - <service class="Magento\TwoFactorAuth\Api\DuoAuthenticateInterface" method="getAuthenticateData"/> - <resources> - <resource ref="anonymous" /> - </resources> - </route> - <route url="/V1/tfa/provider/duo_security/authenticate" method="POST"> <service class="Magento\TwoFactorAuth\Api\DuoAuthenticateInterface" method="createAdminAccessTokenWithCredentials"/> <resources> From 6cb7ef443e282b19c7818fd992900bccf0ae6f0d Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Thu, 14 Nov 2024 23:15:22 +0530 Subject: [PATCH 146/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-static tests failure changes --- TwoFactorAuth/Api/DuoAuthenticateInterface.php | 4 ++-- TwoFactorAuth/Api/DuoConfigureInterface.php | 6 +++--- TwoFactorAuth/Block/Provider/Duo/Auth.php | 6 +++--- .../Controller/Adminhtml/Duo/Authpost.php | 4 ++-- TwoFactorAuth/Model/Config/Source/DuoFailmode.php | 5 +++++ .../Model/Provider/Engine/DuoSecurity.php | 15 +++++++++------ .../Provider/Engine/DuoSecurity/Authenticate.php | 10 ++++++---- .../Provider/Engine/DuoSecurity/Configure.php | 6 +++--- TwoFactorAuth/composer.json | 2 +- TwoFactorAuth/etc/adminhtml/system.xml | 6 +++--- TwoFactorAuth/etc/config.xml | 6 +++--- TwoFactorAuth/etc/di.xml | 6 +++--- TwoFactorAuth/etc/webapi.xml | 6 +++--- .../adminhtml/templates/tfa/provider/auth.phtml | 4 ++-- 14 files changed, 48 insertions(+), 38 deletions(-) diff --git a/TwoFactorAuth/Api/DuoAuthenticateInterface.php b/TwoFactorAuth/Api/DuoAuthenticateInterface.php index e7c8f859..c1d0f862 100644 --- a/TwoFactorAuth/Api/DuoAuthenticateInterface.php +++ b/TwoFactorAuth/Api/DuoAuthenticateInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index 8a1db919..18fb068f 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); @@ -16,7 +16,7 @@ interface DuoConfigureInterface { /** - * configure duo for first time user + * Configure duo for first time user * * @param string $tfaToken * @return void diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index a8e6c86e..087d0bf8 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); @@ -37,6 +37,7 @@ class Auth extends Template * @param Template\Context $context * @param Session $session * @param DuoSecurity $duoSecurity + * @param ManagerInterface $messageManager * @param array $data */ public function __construct( @@ -76,7 +77,6 @@ public function getJsLayout() } } - $user = $this->session->getUser(); if ($user) { $username = $user->getUserName(); diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php index 25e09d3d..7c7e8a89 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Config/Source/DuoFailmode.php b/TwoFactorAuth/Model/Config/Source/DuoFailmode.php index 3ebb0ff8..a9b9b1f4 100644 --- a/TwoFactorAuth/Model/Config/Source/DuoFailmode.php +++ b/TwoFactorAuth/Model/Config/Source/DuoFailmode.php @@ -1,4 +1,9 @@ <?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + */ +declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Config\Source; diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 3420ae6d..6efdc2c3 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); @@ -288,7 +288,8 @@ public function healthCheck(): void * @param int|null $validSecs * @return mixed */ - public function enrollNewUser($username = null, $validSecs = null) { + public function enrollNewUser($username = null, $validSecs = null) + { return $this->duoAuth->enroll($username, $validSecs); } @@ -301,8 +302,9 @@ public function enrollNewUser($username = null, $validSecs = null) { * @param bool $username * @return string */ - public function assertUserIsValid($userIdentifier, $ipAddr = null, $trustedDeviceToken = null, $username = true) { - $response = $this->duoAuth->preauth($userIdentifier, $ipAddr, $trustedDeviceToken, $username); + public function assertUserIsValid($userIdentifier, $ipAddr = null, $trustedDeviceToken = null, $username = true) + { + $response = $this->duoAuth->preauth($userIdentifier, $ipAddr, $trustedDeviceToken, $username); return $response['response']['response']['result']; } @@ -316,7 +318,8 @@ public function assertUserIsValid($userIdentifier, $ipAddr = null, $trustedDevic * @param bool $async * @return array */ - public function authorizeUser($userIdentifier, $factor, $factorParams, $ipAddr = null, $async = false) { + public function authorizeUser($userIdentifier, $factor, $factorParams, $ipAddr = null, $async = false) + { $response = $this->duoAuth->auth($userIdentifier, $factor, $factorParams, $ipAddr, $async); return [ 'status' => $response['response']['response']['status'], diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php index a679f63c..c7266826 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); @@ -97,15 +97,17 @@ public function createAdminAccessTokenWithCredentials( } /** - * Assert that the given signature is valid for the user + * Assert that the response from Duo is valid * * @param UserInterface $user * @param string $username + * @param string $passcode + * @return void * @throws LocalizedException */ public function assertResponseIsValid(UserInterface $user, $username, string $passcode): void { - $duoAuthResponse = $this->duo->authorizeUser($username,"passcode", ['passcode' => $passcode]); + $duoAuthResponse = $this->duo->authorizeUser($username, "passcode", ['passcode' => $passcode]); if ($duoAuthResponse['status'] !== 'allow') { $this->alert->event( 'Magento_TwoFactorAuth', diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index b49adf94..68106412 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); @@ -73,7 +73,7 @@ public function activate(string $tfaToken): void $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); $userId = (int)$user->getId(); - if($this->duo->assertUserIsValid($user->getUserName()) == "auth") { + if ($this->duo->assertUserIsValid($user->getUserName()) == "auth") { $this->tfa->getProviderByCode(DuoSecurity::CODE) ->activate($userId); } diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 23177894..78ba1cc3 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -16,7 +16,7 @@ "spomky-labs/otphp": "^11.2", "endroid/qr-code": "^4.3.5", "2tvenom/cborencode": "^1.0", - "duosecurity/duo_api_php": "dev-master", + "duosecurity/duo_api_php": "1.1", "duosecurity/duo_universal_php": "^1.0" }, "type": "magento2-module", diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index edeb098d..b1502363 100644 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ + * Copyright 2024 Adobe + * All Rights Reserved. + */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 5d87b5c5..69f7738a 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ + * Copyright 2024 Adobe + * All Rights Reserved. + */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> diff --git a/TwoFactorAuth/etc/di.xml b/TwoFactorAuth/etc/di.xml index c14e81f6..817cd79b 100644 --- a/TwoFactorAuth/etc/di.xml +++ b/TwoFactorAuth/etc/di.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ + * Copyright 2024 Adobe + * All Rights Reserved. + */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/TwoFactorAuth/etc/webapi.xml b/TwoFactorAuth/etc/webapi.xml index 2ca7a04b..0dcbc347 100644 --- a/TwoFactorAuth/etc/webapi.xml +++ b/TwoFactorAuth/etc/webapi.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ + * Copyright 2024 Adobe + * All Rights Reserved. + */ --> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"> diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml index be052324..57636408 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ ?> <div id="tfa-auth-container" data-bind="scope:'tfa-auth'"> From f8f070a4d33074b95b8d7314be8e923498ce9bc9 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Mon, 18 Nov 2024 17:37:27 +0530 Subject: [PATCH 147/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Unit tests changes --- .../Engine/DuoSecurity/AuthenticateTest.php | 283 +++++------------- .../Engine/DuoSecurity/ConfigureTest.php | 97 +++--- .../Model/Provider/Engine/DuoSecurityTest.php | 118 ++++---- 3 files changed, 189 insertions(+), 309 deletions(-) diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php index ff62192c..3894cbfe 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php @@ -65,234 +65,103 @@ protected function setUp(): void } /** - * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoDataFixture Magento/User/_files/user_with_role.php + * @return void + * @throws \PHPUnit\Framework\MockObject\Exception */ - public function testGetAuthenticateDataInvalidCredentials() + public function testCreateAdminAccessTokenWithCredentials() { - $this->expectException(\Magento\Framework\Exception\AuthenticationException::class); - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($this->getUserId()); - $this->duo - ->expects($this->never()) - ->method('getRequestSignature'); - $this->model->getAuthenticateData( - 'adminUser', - 'abc' - ); + $username = 'admin'; + $password = 'password123'; + $passcode = '654321'; + + // Mock admin token service + $this->adminTokenService->expects($this->once()) + ->method('createAdminAccessToken') + ->with($username, $password) + ->willReturn('token'); + + // Mock user retrieval + $userMock = $this->createMock(UserInterface::class); + $userMock->expects($this->any()) + ->method('getId') + ->willReturn(123); + + $this->userFactory->expects($this->once()) + ->method('create') + ->willReturn($userMock); + + $userMock->expects($this->once()) + ->method('loadByUsername') + ->with($username); + + $this->userAuthenticator->expects($this->once()) + ->method('assertProviderIsValidForUser') + ->with(123, DuoSecurity::CODE); + + // Test assertResponseIsValid (can be mocked or separately tested) + $this->authenticate->expects($this->once()) + ->method('assertResponseIsValid') + ->with($userMock, $username, $passcode); + + // Call the method + $token = $this->authenticate->createAdminAccessTokenWithCredentials($username, $password, $passcode); + $this->assertEquals('token', $token); } /** - * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoDataFixture Magento/User/_files/user_with_role.php + * @return void + * @throws \PHPUnit\Framework\MockObject\Exception */ - public function testGetAuthenticateDataNotConfiguredProvider() + public function testAssertResponseIsValid() { - $this->expectException(\Magento\Framework\Exception\LocalizedException::class); - $this->expectExceptionMessage('Provider is not configured.'); - $userId = $this->getUserId(); - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->resetConfiguration($userId); - - $this->duo - ->expects($this->never()) - ->method('getRequestSignature'); - $this->model->getAuthenticateData( - 'adminUser', - Bootstrap::ADMIN_PASSWORD - ); - } + $userMock = $this->createMock(UserInterface::class); + $username = 'admin'; + $passcode = '654321'; - /** - * @magentoConfigFixture default/twofactorauth/general/force_providers authy - * @magentoDataFixture Magento/User/_files/user_with_role.php - */ - public function testGetAuthenticateDataUnavailableProvider() - { - $this->expectException(\Magento\Framework\Exception\LocalizedException::class); - $this->expectExceptionMessage('Provider is not allowed.'); - $this->duo - ->expects($this->never()) - ->method('getRequestSignature'); - $this->model->getAuthenticateData( - 'adminUser', - Bootstrap::ADMIN_PASSWORD - ); - } - /** - * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoDataFixture Magento/User/_files/user_with_role.php - */ - public function testVerifyInvalidCredentials() - { - $this->expectException(\Magento\Framework\Exception\AuthenticationException::class); - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($this->getUserId()); - $this->duo - ->expects($this->never()) - ->method('getRequestSignature'); - $this->model->createAdminAccessTokenWithCredentials( - 'adminUser', - 'abc', - 'signature' - ); - } + $this->duo->expects($this->once()) + ->method('authorizeUser') + ->with($username, 'passcode', ['passcode' => $passcode]) + ->willReturn(['status' => 'allow']); - /** - * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoDataFixture Magento/User/_files/user_with_role.php - */ - public function testVerifyNotConfiguredProvider() - { - $this->expectException(\Magento\Framework\Exception\LocalizedException::class); - $this->expectExceptionMessage('Provider is not configured.'); - $userId = $this->getUserId(); - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->resetConfiguration($userId); + $this->alert->expects($this->never()) + ->method('event'); - $this->duo - ->expects($this->never()) - ->method('getRequestSignature'); - $this->model->createAdminAccessTokenWithCredentials( - 'adminUser', - Bootstrap::ADMIN_PASSWORD, - 'signature' - ); + // Call the method (no exception expected for valid response) + $this->authenticate->assertResponseIsValid($userMock, $username, $passcode); } /** - * @magentoConfigFixture default/twofactorauth/general/force_providers authy - * @magentoDataFixture Magento/User/_files/user_with_role.php + * @return void + * @throws \PHPUnit\Framework\MockObject\Exception */ - public function testVerifyUnavailableProvider() + public function testAssertResponseIsInvalid() { - $this->expectException(\Magento\Framework\Exception\LocalizedException::class); - $this->expectExceptionMessage('Provider is not allowed.'); - $this->duo - ->expects($this->never()) - ->method('getRequestSignature'); - $this->model->createAdminAccessTokenWithCredentials( - 'adminUser', - Bootstrap::ADMIN_PASSWORD, - 'signature' - ); - } + $userMock = $this->createMock(UserInterface::class); + $userMock->expects($this->any()) + ->method('getUserName') + ->willReturn('admin'); - /** - * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoDataFixture Magento/User/_files/user_with_role.php - */ - public function testGetAuthenticateDataValidRequest() - { - $userId = $this->getUserId(); + $username = 'admin'; + $passcode = '123456'; - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($userId); + $this->duo->expects($this->once()) + ->method('authorizeUser') + ->with($username, 'passcode', ['passcode' => $passcode]) + ->willReturn(['status' => 'deny', 'msg' => 'Invalid passcode']); - $this->duo - ->method('getApiHostname') - ->willReturn('abc'); - $this->duo - ->method('getRequestSignature') + $this->alert->expects($this->once()) + ->method('event') ->with( - $this->callback(function ($value) use ($userId) { - return (int)$value->getId() === $userId; - }) - ) - ->willReturn('cba'); + 'Magento_TwoFactorAuth', + 'DuoSecurity invalid auth Invalid passcode', + AlertInterface::LEVEL_WARNING, + 'admin' + ); - $result = $this->model->getAuthenticateData( - 'adminUser', - Bootstrap::ADMIN_PASSWORD - ); - - self::assertInstanceOf(DuoDataInterface::class, $result); - self::assertSame('abc', $result->getApiHostname()); - self::assertSame('cba', $result->getSignature()); - } - - /** - * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoDataFixture Magento/User/_files/user_with_role.php - */ - public function testVerifyValidRequest() - { - $userId = $this->getUserId(); - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($userId); - - $signature = 'a signature'; - $this->duo->method('verify') - ->with( - $this->callback(function ($value) use ($userId) { - return (int)$value->getId() === $userId; - }), - $this->callback(function ($value) use ($signature) { - return $value->getData('sig_response') === $signature; - }) - ) - ->willReturn(true); - - $token = $this->model->createAdminAccessTokenWithCredentials( - 'adminUser', - Bootstrap::ADMIN_PASSWORD, - $signature - ); - - self::assertNotEmpty($token); - } - - /** - * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoDataFixture Magento/User/_files/user_with_role.php - */ - public function testVerifyInvalidRequest() - { - $this->expectException(\Magento\Framework\Exception\LocalizedException::class); + $this->expectException(LocalizedException::class); $this->expectExceptionMessage('Invalid response'); - $userId = $this->getUserId(); - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($userId); - - $signature = 'a signature'; - $this->duo->method('verify') - ->willReturn(false); - - $token = $this->model->createAdminAccessTokenWithCredentials( - 'adminUser', - Bootstrap::ADMIN_PASSWORD, - $signature - ); - - self::assertEmpty($token); - } - - private function getUserId(): int - { - $user = $this->userFactory->create(); - $user->loadByUsername('adminUser'); - return (int)$user->getId(); + // Call the method (exception expected for invalid response) + $this->authenticate->assertResponseIsValid($userMock, $username, $passcode); } } diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php index 4a306f70..9653d83b 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php @@ -73,9 +73,9 @@ protected function setUp(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testGetConfigurationDataInvalidTfat() @@ -84,7 +84,7 @@ public function testGetConfigurationDataInvalidTfat() $this->expectExceptionMessage('Invalid two-factor authorization token'); $this->duo ->expects($this->never()) - ->method('getRequestSignature'); + ->method('enrollNewUser'); $this->model->getConfigurationData( 'abc' ); @@ -92,9 +92,9 @@ public function testGetConfigurationDataInvalidTfat() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testGetConfigurationDataAlreadyConfiguredProvider() @@ -107,7 +107,7 @@ public function testGetConfigurationDataAlreadyConfiguredProvider() $this->duo ->expects($this->never()) - ->method('getRequestSignature'); + ->method('enrollNewUser'); $this->model->getConfigurationData( $this->tokenManager->issueFor($userId) ); @@ -123,7 +123,7 @@ public function testGetConfigurationDataUnavailableProvider() $this->expectExceptionMessage('Provider is not allowed.'); $this->duo ->expects($this->never()) - ->method('getRequestSignature'); + ->method('enrollNewUser'); $this->model->getConfigurationData( $this->tokenManager->issueFor($this->getUserId()) ); @@ -131,9 +131,9 @@ public function testGetConfigurationDataUnavailableProvider() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateInvalidTfat() @@ -142,7 +142,7 @@ public function testActivateInvalidTfat() $this->expectExceptionMessage('Invalid two-factor authorization token'); $this->duo ->expects($this->never()) - ->method('getRequestSignature'); + ->method('assertUserIsValid'); $this->model->activate( 'abc', 'something' @@ -151,9 +151,9 @@ public function testActivateInvalidTfat() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateAlreadyConfiguredProvider() @@ -165,7 +165,7 @@ public function testActivateAlreadyConfiguredProvider() ->activate($userId); $this->duo ->expects($this->never()) - ->method('getRequestSignature'); + ->method('assertUserIsValid'); $this->model->activate( $this->tokenManager->issueFor($userId), 'something' @@ -183,7 +183,7 @@ public function testActivateUnavailableProvider() $userId = $this->getUserId(); $this->duo ->expects($this->never()) - ->method('getRequestSignature'); + ->method('assertUserIsValid'); $this->model->activate( $this->tokenManager->issueFor($userId), 'something' @@ -192,87 +192,80 @@ public function testActivateUnavailableProvider() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testGetConfigurationDataValidRequest() { $userId = $this->getUserId(); + $userName = 'adminUser'; $this->duo - ->method('getApiHostname') - ->willReturn('abc'); - $this->duo - ->method('getRequestSignature') - ->with( - $this->callback(function ($value) use ($userId) { - return (int)$value->getId() === $userId; - }) - ) - ->willReturn('cba'); + ->expects($this->once()) + ->method('enrollNewUser') + ->with($userName, 60) + ->willReturn('enrollment_data'); $result = $this->model->getConfigurationData( $this->tokenManager->issueFor($userId) ); - self::assertInstanceOf(DuoDataInterface::class, $result); - self::assertSame('abc', $result->getApiHostname()); - self::assertSame('cba', $result->getSignature()); + self::assertSame('enrollment_data', $result); } /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateValidRequest() { $userId = $this->getUserId(); - $tfat = $this->tokenManager->issueFor($userId); + $userName = 'adminUser'; - $signature = 'a signature'; - $this->authenticate->method('assertResponseIsValid') - ->with( - $this->callback(function ($value) use ($userId) { - return (int)$value->getId() === $userId; - }), - $signature - ); + $this->duo + ->expects($this->once()) + ->method('assertUserIsValid') + ->with($userName) + ->willReturn('auth'); - $this->model->activate($tfat, $signature); + $this->model->activate( + $this->tokenManager->issueFor($userId) + ); self::assertTrue($this->tfa->getProviderByCode(DuoSecurity::CODE)->isActive($userId)); } /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateInvalidDataThrowsException() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Something'); + $userId = $this->getUserId(); $tfat = $this->tokenManager->issueFor($userId); - $signature = 'a signature'; - $this->authenticate->method('assertResponseIsValid') - ->with( - $this->callback(function ($value) use ($userId) { - return (int)$value->getId() === $userId; - }), - $signature - ) + $this->duo->method('assertUserIsValid') + ->with($this->callback(function ($username) use ($userId) { + // Assuming $username corresponds to a user object or username string. + // Replace 'getUserById' with the relevant logic for obtaining the username + $user = $this->userFactory->create()->load($userId); + return $username === $user->getUserName(); + })) ->willThrowException(new \InvalidArgumentException('Something')); - $result = $this->model->activate($tfat, $signature); + // Call activate without a signature, as per your updated logic + $result = $this->model->activate($tfat); self::assertEmpty($result); } diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 5cd85e52..7e8a4744 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -1,19 +1,20 @@ <?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine; -use Magento\User\Api\Data\UserInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\DataObject; +use Magento\Framework\Data\Form\FormKey; +use Magento\Framework\Encryption\EncryptorInterface; +use Magento\Framework\Session\SessionManagerInterface; +use Magento\Framework\UrlInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; -use PHPUnit\Framework\MockObject\MockObject; +use Duo\DuoUniversal\Client; +use DuoAPI\Auth as DuoAuth; use PHPUnit\Framework\TestCase; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class DuoSecurityTest extends TestCase { @@ -62,42 +63,30 @@ public static function getIsEnabledTestDataSet(): array 'value', 'value', 'value', - 'value', true ], [ null, - null, - null, - null, - false - ], - [ 'value', null, - null, - null, false ], [ - null, 'value', - null, + 'value', null, false ], [ - null, null, 'value', null, false ], [ - null, - null, null, 'value', + 'value', false ] ]; @@ -107,51 +96,80 @@ public static function getIsEnabledTestDataSet(): array * Check that the provider is available based on configuration. * * @param string|null $apiHostname - * @param string|null $appKey - * @param string|null $secretKey - * @param string|null $integrationKey + * @param string|null $clientId + * @param string|null $clientSecret * @param bool $expected * @return void * @dataProvider getIsEnabledTestDataSet */ public function testIsEnabled( ?string $apiHostname, - ?string $appKey, - ?string $secretKey, - ?string $integrationKey, + ?string $clientId, + ?string $clientSecret, bool $expected ): void { $this->configMock->method('getValue')->willReturnMap( [ [DuoSecurity::XML_PATH_API_HOSTNAME, 'default', null, $apiHostname], - [DuoSecurity::XML_PATH_APPLICATION_KEY, 'default', null, $appKey], - [DuoSecurity::XML_PATH_SECRET_KEY, 'default', null, $secretKey], - [DuoSecurity::XML_PATH_INTEGRATION_KEY, 'default', null, $integrationKey] + [DuoSecurity::XML_PATH_CLIENT_ID, 'default', null, $clientId], + [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $clientSecret] ] ); $this->assertEquals($expected, $this->model->isEnabled()); } - public function testGetRequestSignature() : void + public function testGetApiHostname() { - $this->user->expects($this->any()) - ->method('getUserName') - ->willReturn('admin'); - $this->configMock->expects($this->any()) - ->method('getValue') - ->willReturn('SECRET'); - - $this->assertStringContainsString($this->model::AUTH_PREFIX, $this->model->getRequestSignature($this->user)); - $this->assertStringNotContainsString($this->model::DUO_PREFIX, $this->model->getRequestSignature($this->user)); - - $this->assertStringContainsString( - $this->model::DUO_PREFIX, - $this->modelWithForcedDuoAuth->getRequestSignature($this->user) - ); - $this->assertStringNotContainsString( - $this->model::AUTH_PREFIX, - $this->modelWithForcedDuoAuth->getRequestSignature($this->user) - ); + $this->scopeConfig->method('getValue')->willReturn('api.hostname'); + $this->assertEquals('api.hostname', $this->duoSecurity->getApiHostname()); + } + + public function testVerify() + { + $user = $this->createMock(UserInterface::class); + $request = $this->createMock(DataObject::class); + + $user->method('getUserName')->willReturn('username'); + $request->method('getData')->willReturnMap([ + ['state', 'form_keyDUOAUTH'], + ['duo_code', 'duo_code'] + ]); + $this->formKey->method('getFormKey')->willReturn('form_key'); + $this->client->method('exchangeAuthorizationCodeFor2FAResult')->willReturn('token'); + + $this->session->expects($this->once())->method('setData')->with('duo_token', 'token'); + + $this->assertTrue($this->duoSecurity->verify($user, $request)); + } + + public function testInitiateAuth() + { + $this->client->method('createAuthUrl')->willReturn('auth_url'); + $this->assertEquals('auth_url', $this->duoSecurity->initiateAuth('username', 'state')); + } + + public function testHealthCheck() + { + $this->client->expects($this->once())->method('healthCheck'); + $this->duoSecurity->healthCheck(); + } + + public function testEnrollNewUser() + { + $this->duoAuth->method('enroll')->willReturn('enroll_response'); + $this->assertEquals('enroll_response', $this->duoSecurity->enrollNewUser('username', 3600)); + } + + public function testAssertUserIsValid() + { + $this->duoAuth->method('preauth')->willReturn(['response' => ['response' => ['result' => 'valid']]]); + $this->assertEquals('valid', $this->duoSecurity->assertUserIsValid('userIdentifier')); + } + + public function testAuthorizeUser() + { + $this->duoAuth->method('auth')->willReturn(['response' => ['response' => ['status' => 'allow', 'status_msg' => 'success']]]); + $this->assertEquals(['status' => 'allow', 'msg' => 'success'], $this->duoSecurity->authorizeUser('userIdentifier', 'factor', [])); } } From 42158195e08617e23b222242d69c7a26e27e17c4 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 19 Nov 2024 15:36:51 +0530 Subject: [PATCH 148/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Automation tests related changes with integration tests fixes --- .../Controller/Adminhtml/Duo/AuthpostTest.php | 2 +- .../Engine/DuoSecurity/AuthenticateTest.php | 206 +++++++++++------- .../Engine/DuoSecurity/ConfigureTest.php | 4 +- .../Model/Provider/Engine/DuoSecurityTest.php | 66 +----- 4 files changed, 136 insertions(+), 142 deletions(-) diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php index 435bef93..52703f9d 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php @@ -27,7 +27,7 @@ class AuthpostTest extends AbstractConfigureBackendController /** * @inheritDoc */ - protected $httpMethod = Request::METHOD_POST; + protected $httpMethod = Request::METHOD_GET; /** * @inheritDoc diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php index 3894cbfe..4af5fed9 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); @@ -65,103 +65,153 @@ protected function setUp(): void } /** - * @return void - * @throws \PHPUnit\Framework\MockObject\Exception + * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testCreateAdminAccessTokenWithCredentials() + public function testVerifyInvalidCredentials() { - $username = 'admin'; - $password = 'password123'; - $passcode = '654321'; - - // Mock admin token service - $this->adminTokenService->expects($this->once()) - ->method('createAdminAccessToken') - ->with($username, $password) - ->willReturn('token'); - - // Mock user retrieval - $userMock = $this->createMock(UserInterface::class); - $userMock->expects($this->any()) - ->method('getId') - ->willReturn(123); - - $this->userFactory->expects($this->once()) - ->method('create') - ->willReturn($userMock); - - $userMock->expects($this->once()) - ->method('loadByUsername') - ->with($username); - - $this->userAuthenticator->expects($this->once()) - ->method('assertProviderIsValidForUser') - ->with(123, DuoSecurity::CODE); - - // Test assertResponseIsValid (can be mocked or separately tested) - $this->authenticate->expects($this->once()) - ->method('assertResponseIsValid') - ->with($userMock, $username, $passcode); - - // Call the method - $token = $this->authenticate->createAdminAccessTokenWithCredentials($username, $password, $passcode); - $this->assertEquals('token', $token); + $this->expectException(\Magento\Framework\Exception\AuthenticationException::class); + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->activate($this->getUserId()); + $this->duo + ->expects($this->never()) + ->method('authorizeUser'); + $this->model->createAdminAccessTokenWithCredentials( + 'adminUser', + 'abc', + '123456' + ); + } + + /** + * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoDataFixture Magento/User/_files/user_with_role.php + */ + public function testVerifyNotConfiguredProvider() + { + $this->expectException(\Magento\Framework\Exception\LocalizedException::class); + $this->expectExceptionMessage('Provider is not configured.'); + $userId = $this->getUserId(); + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->resetConfiguration($userId); + + $this->duo + ->expects($this->never()) + ->method('authorizeUser'); + $this->model->createAdminAccessTokenWithCredentials( + 'adminUser', + Bootstrap::ADMIN_PASSWORD, + '123456' + ); } /** - * @return void - * @throws \PHPUnit\Framework\MockObject\Exception + * @magentoConfigFixture default/twofactorauth/general/force_providers authy + * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testAssertResponseIsValid() + public function testVerifyUnavailableProvider() { - $userMock = $this->createMock(UserInterface::class); - $username = 'admin'; - $passcode = '654321'; + $this->expectException(\Magento\Framework\Exception\LocalizedException::class); + $this->expectExceptionMessage('Provider is not allowed.'); + $this->duo + ->expects($this->never()) + ->method('authorizeUser'); + $this->model->createAdminAccessTokenWithCredentials( + 'adminUser', + Bootstrap::ADMIN_PASSWORD, + '123456' + ); + } - $this->duo->expects($this->once()) - ->method('authorizeUser') - ->with($username, 'passcode', ['passcode' => $passcode]) + /** + * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoDataFixture Magento/User/_files/user_with_role.php + */ + public function testVerifyValidRequest() + { + $userId = $this->getUserId(); + + // Activate the Two-Factor Authentication provider for DuoSecurity + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->activate($userId); + + $username = 'adminUser'; + $password = Bootstrap::ADMIN_PASSWORD; + $passcode = '123456'; // Example passcode for the test + + // Mock the DuoSecurity `authorizeUser` method to simulate valid Duo response + $this->duo->method('authorizeUser') + ->with( + $this->equalTo($username), + $this->equalTo("passcode"), + $this->equalTo(['passcode' => $passcode]) + ) ->willReturn(['status' => 'allow']); - $this->alert->expects($this->never()) - ->method('event'); + // Attempt to create the access token + $token = $this->model->createAdminAccessTokenWithCredentials( + $username, + $password, + $passcode + ); - // Call the method (no exception expected for valid response) - $this->authenticate->assertResponseIsValid($userMock, $username, $passcode); + // Assert that a token was generated successfully + self::assertNotEmpty($token); } /** - * @return void - * @throws \PHPUnit\Framework\MockObject\Exception + * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testAssertResponseIsInvalid() + public function testVerifyInvalidRequest() { - $userMock = $this->createMock(UserInterface::class); - $userMock->expects($this->any()) - ->method('getUserName') - ->willReturn('admin'); + $this->expectException(\Magento\Framework\Exception\LocalizedException::class); + $this->expectExceptionMessage('Invalid response'); - $username = 'admin'; - $passcode = '123456'; + $userId = $this->getUserId(); - $this->duo->expects($this->once()) - ->method('authorizeUser') - ->with($username, 'passcode', ['passcode' => $passcode]) - ->willReturn(['status' => 'deny', 'msg' => 'Invalid passcode']); + // Activate the Two-Factor Authentication provider for DuoSecurity + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->activate($userId); - $this->alert->expects($this->once()) - ->method('event') + $username = 'adminUser'; + $password = Bootstrap::ADMIN_PASSWORD; + $passcode = '123456'; // Example passcode used for testing + + // Mock the DuoSecurity `authorizeUser` method to simulate an invalid response + $this->duo->method('authorizeUser') ->with( - 'Magento_TwoFactorAuth', - 'DuoSecurity invalid auth Invalid passcode', - AlertInterface::LEVEL_WARNING, - 'admin' - ); + $this->equalTo($username), + $this->equalTo("passcode"), + $this->equalTo(['passcode' => $passcode]) + ) + ->willReturn(['status' => 'deny', 'msg' => 'Authentication denied']); // Simulate invalid response + + // Attempt to create the access token, expecting an exception due to the invalid response + $this->model->createAdminAccessTokenWithCredentials( + $username, + $password, + $passcode + ); + } - $this->expectException(LocalizedException::class); - $this->expectExceptionMessage('Invalid response'); + private function getUserId(): int + { + $user = $this->userFactory->create(); + $user->loadByUsername('adminUser'); - // Call the method (exception expected for invalid response) - $this->authenticate->assertResponseIsValid($userMock, $username, $passcode); + return (int)$user->getId(); } } diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php index 9653d83b..8379478b 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 7e8a4744..f3057c82 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -1,19 +1,17 @@ <?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\DataObject; -use Magento\Framework\Data\Form\FormKey; -use Magento\Framework\Encryption\EncryptorInterface; -use Magento\Framework\Session\SessionManagerInterface; -use Magento\Framework\UrlInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; -use Duo\DuoUniversal\Client; -use DuoAPI\Auth as DuoAuth; use PHPUnit\Framework\TestCase; class DuoSecurityTest extends TestCase @@ -118,58 +116,4 @@ public function testIsEnabled( $this->assertEquals($expected, $this->model->isEnabled()); } - - public function testGetApiHostname() - { - $this->scopeConfig->method('getValue')->willReturn('api.hostname'); - $this->assertEquals('api.hostname', $this->duoSecurity->getApiHostname()); - } - - public function testVerify() - { - $user = $this->createMock(UserInterface::class); - $request = $this->createMock(DataObject::class); - - $user->method('getUserName')->willReturn('username'); - $request->method('getData')->willReturnMap([ - ['state', 'form_keyDUOAUTH'], - ['duo_code', 'duo_code'] - ]); - $this->formKey->method('getFormKey')->willReturn('form_key'); - $this->client->method('exchangeAuthorizationCodeFor2FAResult')->willReturn('token'); - - $this->session->expects($this->once())->method('setData')->with('duo_token', 'token'); - - $this->assertTrue($this->duoSecurity->verify($user, $request)); - } - - public function testInitiateAuth() - { - $this->client->method('createAuthUrl')->willReturn('auth_url'); - $this->assertEquals('auth_url', $this->duoSecurity->initiateAuth('username', 'state')); - } - - public function testHealthCheck() - { - $this->client->expects($this->once())->method('healthCheck'); - $this->duoSecurity->healthCheck(); - } - - public function testEnrollNewUser() - { - $this->duoAuth->method('enroll')->willReturn('enroll_response'); - $this->assertEquals('enroll_response', $this->duoSecurity->enrollNewUser('username', 3600)); - } - - public function testAssertUserIsValid() - { - $this->duoAuth->method('preauth')->willReturn(['response' => ['response' => ['result' => 'valid']]]); - $this->assertEquals('valid', $this->duoSecurity->assertUserIsValid('userIdentifier')); - } - - public function testAuthorizeUser() - { - $this->duoAuth->method('auth')->willReturn(['response' => ['response' => ['status' => 'allow', 'status_msg' => 'success']]]); - $this->assertEquals(['status' => 'allow', 'msg' => 'success'], $this->duoSecurity->authorizeUser('userIdentifier', 'factor', [])); - } } From d5dbdab5bd9d55651c2561fa684118a0912716b0 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 19 Nov 2024 17:16:23 +0530 Subject: [PATCH 149/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Automation tests related changes with web API tests fixes --- TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php index e28d4eac..41d38272 100644 --- a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php +++ b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php @@ -55,8 +55,8 @@ public function apply() ->where( 'path in (?)', [ - DuoSecurity::XML_PATH_APPLICATION_KEY, - DuoSecurity::XML_PATH_SECRET_KEY, + DuoSecurity::XML_PATH_CLIENT_SECRET, + DuoSecurity::XML_PATH_SKEY, Service::XML_PATH_API_KEY, ] ); From d6d12aaddc9a0cb9f152aa64955f11ec5c454e8c Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 20 Nov 2024 00:16:13 +0530 Subject: [PATCH 150/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Automation tests related changes with web API tests fixes --- .../Setup/Patch/Data/EncryptSecrets.php | 1 - .../Patch/Data/GenerateDuoSecurityKey.php | 96 ------------------- 2 files changed, 97 deletions(-) delete mode 100644 TwoFactorAuth/Setup/Patch/Data/GenerateDuoSecurityKey.php diff --git a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php index 41d38272..d30a27d9 100644 --- a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php +++ b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php @@ -56,7 +56,6 @@ public function apply() 'path in (?)', [ DuoSecurity::XML_PATH_CLIENT_SECRET, - DuoSecurity::XML_PATH_SKEY, Service::XML_PATH_API_KEY, ] ); diff --git a/TwoFactorAuth/Setup/Patch/Data/GenerateDuoSecurityKey.php b/TwoFactorAuth/Setup/Patch/Data/GenerateDuoSecurityKey.php deleted file mode 100644 index bb2f4e68..00000000 --- a/TwoFactorAuth/Setup/Patch/Data/GenerateDuoSecurityKey.php +++ /dev/null @@ -1,96 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\TwoFactorAuth\Setup\Patch\Data; - -use Magento\Framework\App\Config\ConfigResource\ConfigInterface; -use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\Setup\ModuleDataSetupInterface; -use Magento\Framework\Setup\Patch\DataPatchInterface; -use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; - -/** - * Generate initial duo security key - */ -class GenerateDuoSecurityKey implements DataPatchInterface -{ - /** - * @var ModuleDataSetupInterface - */ - private $moduleDataSetup; - - /** - * @var ConfigInterface - */ - private $config; - - /** - * @var ScopeConfigInterface - */ - private $scopeConfig; - - /** - * @param ModuleDataSetupInterface $moduleDataSetup - * @param ConfigInterface $config - * @param ScopeConfigInterface $scopeConfig - */ - public function __construct( - ModuleDataSetupInterface $moduleDataSetup, - ConfigInterface $config, - ScopeConfigInterface $scopeConfig - ) { - $this->moduleDataSetup = $moduleDataSetup; - $this->config = $config; - $this->scopeConfig = $scopeConfig; - } - - /** - * Create and set the duo key - * - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - * @SuppressWarnings(PHPMD.CyclomaticComplexity) - * @SuppressWarnings(PHPMD.NPathComplexity) - */ - public function apply() - { - $this->moduleDataSetup->startSetup(); - - if (!$this->scopeConfig->getValue(DuoSecurity::XML_PATH_APPLICATION_KEY)) { - // Generate random duo security key - $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $charactersLength = strlen($characters); - $randomString = ''; - for ($i = 0; $i < 64; $i++) { - $randomString .= $characters[random_int(0, $charactersLength - 1)]; - } - - $this->config->saveConfig(DuoSecurity::XML_PATH_APPLICATION_KEY, $randomString, 'default', 0); - } - - $this->moduleDataSetup->endSetup(); - - return $this; - } - - /** - * @inheritdoc - */ - public static function getDependencies() - { - return [ - CopyConfigFromOldModule::class - ]; - } - - /** - * @inheritdoc - */ - public function getAliases() - { - return []; - } -} From c4d13137050f3ed16c15551406601b057bd3e7be Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Thu, 21 Nov 2024 18:55:02 +0530 Subject: [PATCH 151/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-Automation tests related changes with static failures fixes --- TwoFactorAuth/Block/Provider/Duo/Auth.php | 14 +-- .../Model/Provider/Engine/DuoSecurity.php | 14 ++- .../Setup/Patch/Data/EncryptSecrets.php | 5 +- .../Controller/Adminhtml/Duo/AuthpostTest.php | 4 +- .../Model/Provider/Engine/DuoSecurityTest.php | 116 +++++++++++++----- 5 files changed, 109 insertions(+), 44 deletions(-) diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 087d0bf8..10f840cc 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -3,6 +3,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\Duo; @@ -62,25 +63,24 @@ public function getJsLayout() try { $this->duoSecurity->healthCheck(); } catch (LocalizedException $e) { - if ($duoFailMode == "OPEN") { - // If we're failing open, errors in 2FA still allow for success + if ($duoFailMode === "OPEN") { $this->messageManager->addSuccessMessage( __("Login 'Successful', but 2FA Not Performed. Confirm Duo client/secret/host values are correct") ); - return $this->_redirect('adminhtml/dashboard'); + return $this->_url->getUrl('adminhtml/dashboard'); } else { - // Otherwise the login fails and redirect user to the login page $this->messageManager->addErrorMessage( __("2FA Unavailable. Confirm Duo client/secret/host values are correct") ); - return $this->_redirect('adminhtml'); + return $this->_url->getUrl('adminhtml'); } } $user = $this->session->getUser(); - if ($user) { - $username = $user->getUserName(); + if (!$user) { + throw new LocalizedException(__('User session not found.')); } + $username = $user->getUserName(); $prompt_uri = $this->duoSecurity->initiateAuth($username, $this->getFormKey().DuoSecurity::AUTH_SUFFIX); $this->jsLayout['components']['tfa-auth']['redirectUrl'] = $prompt_uri; return parent::getJsLayout(); diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 6efdc2c3..d9eb826f 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -3,6 +3,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine; @@ -20,6 +21,7 @@ /** * Duo Security engine + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class DuoSecurity implements EngineInterface { @@ -119,6 +121,8 @@ class DuoSecurity implements EngineInterface * @param UrlInterface $urlBuilder * @param FormKey $formKey * @param SessionManagerInterface $session + * @param Client|null $client + * @param DuoAuth|null $duoAuth * @throws \Duo\DuoUniversal\DuoException */ public function __construct( @@ -126,20 +130,22 @@ public function __construct( EncryptorInterface $encryptor, UrlInterface $urlBuilder, FormKey $formKey, - SessionManagerInterface $session + SessionManagerInterface $session, + Client $client = null, + DuoAuth $duoAuth = null ) { $this->scopeConfig = $scopeConfig; $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; $this->formKey = $formKey; $this->session = $session; - $this->client = new Client( + $this->client = $client ?? new Client( $this->getClientId(), $this->getClientSecret(), $this->getApiHostname(), $this->getCallbackUrl() ); - $this->duoAuth = new DuoAuth( + $this->duoAuth = $duoAuth ?? new DuoAuth( $this->getIkey(), $this->getSkey(), $this->getApiHostname() @@ -235,7 +241,7 @@ public function verify(UserInterface $user, DataObject $request): bool try { $decoded_token = $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); // Save the token in the session for later use - $this->session->setData('duo_token', $decoded_token); + $this->session->duo_token = $decoded_token; } catch (LocalizedException $e) { return false; } diff --git a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php index d30a27d9..2d8d2443 100644 --- a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php +++ b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Setup\Patch\Data; diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php index 52703f9d..fcc40a35 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index f3057c82..ef268766 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -9,44 +9,75 @@ namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; -use Magento\User\Api\Data\UserInterface; +use Magento\Framework\Data\Form\FormKey; +use Magento\Framework\DataObject; +use Magento\Framework\Encryption\EncryptorInterface; +use Magento\Framework\Session\SessionManagerInterface; +use Magento\Framework\UrlInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; +use Magento\User\Api\Data\UserInterface; +use Duo\DuoUniversal\Client; +use DuoAPI\Auth as DuoAuth; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; class DuoSecurityTest extends TestCase { - /** - * @var DuoSecurity - */ - private $model; + /** @var MockObject|ScopeConfigInterface */ + private $configMock; - /** - * @var DuoSecurity - */ - private $modelWithForcedDuoAuth; + /** @var MockObject|EncryptorInterface */ + private $encryptorMock; - /** - * @var ScopeConfigInterface|MockObject - */ - private $configMock; + /** @var MockObject|UrlInterface */ + private $urlMock; - /** - * @var UserInterface|MockObject - */ - private $user; + /** @var MockObject|FormKey */ + private $formKeyMock; + + /** @var MockObject|SessionManagerInterface */ + private $sessionMock; + + /** @var MockObject|Client */ + private $clientMock; + + /** @var DuoSecurity */ + private $model; - /** - * @inheritDoc - */ protected function setUp(): void { - $objectManager = new ObjectManager($this); - $this->configMock = $this->getMockBuilder(ScopeConfigInterface::class)->disableOriginalConstructor()->getMock(); - $this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock(); + $this->configMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->encryptorMock = $this->getMockBuilder(EncryptorInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->urlMock = $this->getMockBuilder(UrlInterface::class) + ->disableOriginalConstructor() + ->getMock(); - $this->model = $objectManager->getObject(DuoSecurity::class, ['scopeConfig' => $this->configMock]); - $this->modelWithForcedDuoAuth = new DuoSecurity($this->configMock, $this->model::DUO_PREFIX); + $this->formKeyMock = $this->getMockBuilder(FormKey::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->sessionMock = $this->getMockBuilder(SessionManagerInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->clientMock = $this->createMock(Client::class); + $this->duoAuthMock = $this->createMock(DuoAuth::class); + + $this->model = new DuoSecurity( + $this->configMock, + $this->encryptorMock, + $this->urlMock, + $this->formKeyMock, + $this->sessionMock, + $this->clientMock, + $this->duoAuthMock + ); } /** @@ -65,13 +96,13 @@ public static function getIsEnabledTestDataSet(): array ], [ null, - 'value', + null, null, false ], [ 'value', - 'value', + null, null, false ], @@ -83,7 +114,7 @@ public static function getIsEnabledTestDataSet(): array ], [ null, - 'value', + null, 'value', false ] @@ -116,4 +147,31 @@ public function testIsEnabled( $this->assertEquals($expected, $this->model->isEnabled()); } + + /** + * @return void + * @throws \PHPUnit\Framework\MockObject\Exception + */ + public function testVerify() + { + $this->clientMock->expects($this->once()) + ->method('exchangeAuthorizationCodeFor2FAResult') + ->with('duo-code', 'username') + ->willReturn(['result' => 'valid-token']); + + $this->formKeyMock->method('getFormKey') + ->willReturn('valid-form-key'); + + $user = $this->createMock(UserInterface::class); + $user->method('getUserName')->willReturn('username'); + + $request = new DataObject([ + 'state' => 'valid-form-keyDUOAUTH', + 'duo_code' => 'duo-code' + ]); + + $result = $this->model->verify($user, $request); + + $this->assertTrue($result, 'Verification should return true for valid input.'); + } } From f57d3a86587cfe342ebdd101ae3ee3329ef0156c Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 26 Nov 2024 21:33:40 +0530 Subject: [PATCH 152/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-WebSdk login prompt related changes --- TwoFactorAuth/Block/Provider/Duo/Auth.php | 2 +- .../Model/Provider/Engine/DuoSecurity.php | 2 +- .../Controller/Adminhtml/Duo/AuthpostTest.php | 4 +-- .../templates/tfa/provider/auth.phtml | 6 ++-- .../view/adminhtml/web/js/duo/api.js | 18 ----------- .../view/adminhtml/web/js/duo/auth.js | 31 ++++++++++++------- .../view/adminhtml/web/template/duo/auth.html | 17 ++++------ 7 files changed, 32 insertions(+), 48 deletions(-) delete mode 100644 TwoFactorAuth/view/adminhtml/web/js/duo/api.js diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 10f840cc..32caab8a 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -82,7 +82,7 @@ public function getJsLayout() } $username = $user->getUserName(); $prompt_uri = $this->duoSecurity->initiateAuth($username, $this->getFormKey().DuoSecurity::AUTH_SUFFIX); - $this->jsLayout['components']['tfa-auth']['redirectUrl'] = $prompt_uri; + $this->jsLayout['components']['tfa-auth']['authUrl'] = $prompt_uri; return parent::getJsLayout(); } } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index d9eb826f..4ab858b7 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -241,7 +241,7 @@ public function verify(UserInterface $user, DataObject $request): bool try { $decoded_token = $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); // Save the token in the session for later use - $this->session->duo_token = $decoded_token; + $this->session->setData('duo_token', $decoded_token); } catch (LocalizedException $e) { return false; } diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php index fcc40a35..2bab27b4 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php @@ -20,12 +20,12 @@ class AuthpostTest extends AbstractConfigureBackendController { /** - * @inheritDoc + * @var string */ protected $uri = 'backend/tfa/duo/authpost'; /** - * @inheritDoc + * @var string */ protected $httpMethod = Request::METHOD_GET; diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml index 57636408..71a1d935 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml @@ -1,7 +1,7 @@ <?php /** - * Copyright 2024 Adobe - * All Rights Reserved. + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. */ ?> <div id="tfa-auth-container" data-bind="scope:'tfa-auth'"> @@ -13,7 +13,7 @@ <script type="text/x-magento-init"> { "#tfa-auth-container": { - "Magento_TwoFactorAuth/js/duo/api": <?= /* @noEscape */ $block->getJsLayout() ?> + "Magento_Ui/js/core/app": <?= /* @noEscape */ $block->getJsLayout() ?> } } </script> diff --git a/TwoFactorAuth/view/adminhtml/web/js/duo/api.js b/TwoFactorAuth/view/adminhtml/web/js/duo/api.js deleted file mode 100644 index f9dce63f..00000000 --- a/TwoFactorAuth/view/adminhtml/web/js/duo/api.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Duo Web SDK v2 - * Copyright 2017, Duo Security - */ - -define([], function () { - 'use strict'; - - return function (config, element) { - var redirectUrl = config.components['tfa-auth'].redirectUrl; - if (window.location.href !== redirectUrl) { - window.location.href = redirectUrl; - } - }; -}); - - -/* eslint-enable */ diff --git a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js index 5bf98ca8..59f1b2b7 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js @@ -1,13 +1,12 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ define([ 'ko', - 'uiComponent', - 'Magento_TwoFactorAuth/js/duo/api' -], function (ko, Component, duo) { + 'uiComponent' +], function (ko, Component) { 'use strict'; return Component.extend({ @@ -17,16 +16,24 @@ define([ template: 'Magento_TwoFactorAuth/duo/auth' }, - redirectUrl: '', - authenticateData: {}, + authUrl: '', + + getAuthUrl: function () { + return this.authUrl; + }, + + redirectToAuthUrl: function () { + var redirectUrl = this.getAuthUrl(); + if (redirectUrl) { + window.location.href = redirectUrl; + } + }, /** - * Start waiting loop + * After the element is rendered, bind the authUrl (optional) */ onAfterRender: function () { - window.setTimeout(function () { - duo(this, null); - }, 1000); - }, + var authUrl = this.getAuthUrl(); + } }); }); diff --git a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html index b9a529bf..3c518196 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html @@ -1,7 +1,7 @@ <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ --> <div> @@ -9,15 +9,10 @@ <fieldset class="admin__fieldset"> <legend class="admin__legend"><span translate="'2FA - Duo Security'"></span></legend> <br/> - - <iframe id="duo_iframe" - data-bind="afterRender: onAfterRender" - attr="{ - 'data-host': getApiHost(), - 'data-sig-request': getSignature(), - 'data-post-action': getPostUrl() - }" - ></iframe> + <button type="button" data-bind="click: redirectToAuthUrl, afterRender: onAfterRender"> + Go to Duo Universal Prompt + </button> </fieldset> </form> </div> + From 2edbd77eefc5f8932f321c5f0f47de1ad00b161e Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 27 Nov 2024 17:05:18 +0530 Subject: [PATCH 153/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-composer changes --- TwoFactorAuth/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index 78ba1cc3..34e46b6a 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -16,7 +16,7 @@ "spomky-labs/otphp": "^11.2", "endroid/qr-code": "^4.3.5", "2tvenom/cborencode": "^1.0", - "duosecurity/duo_api_php": "1.1", + "duosecurity/duo_api_php": "^1.1", "duosecurity/duo_universal_php": "^1.0" }, "type": "magento2-module", From 7c74783da72c666c99cc25ef7df714330e5721f1 Mon Sep 17 00:00:00 2001 From: "Pawan.kumar" <pawan.kumar9@globallogic.com> Date: Wed, 27 Nov 2024 18:12:25 +0530 Subject: [PATCH 154/208] cia-2.4.8-beta2-develop-2.4-develop-sync-11232024: fix static tests --- .../Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php | 3 ++- .../Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php | 3 ++- ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php | 3 ++- .../Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php | 3 ++- ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php | 3 ++- ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php | 3 ++- ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php | 3 ++- .../Test/Unit/Plugin/GraphQlValidatorTest.php | 3 ++- .../Test/Unit/Plugin/ValidationOverriderTest.php | 3 ++- ReCaptchaWebapiGraphQl/etc/schema.graphqls | 2 +- .../Test/Unit/Plugin/RestValidationPluginTest.php | 3 ++- .../Test/Unit/Plugin/SoapValidationPluginTest.php | 3 ++- .../Test/Unit/Plugin/ValidationOverriderTest.php | 3 ++- .../Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php | 3 ++- TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php | 3 ++- .../Test/Unit/Model/Provider/Engine/DuoSecurityTest.php | 3 ++- TwoFactorAuth/Test/Unit/Model/TfaTest.php | 3 ++- .../Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php | 3 ++- 18 files changed, 35 insertions(+), 18 deletions(-) diff --git a/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php index 9050d2a5..91a38a08 100644 --- a/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php +++ b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php index 609fd7ef..25a6f3d1 100644 --- a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php +++ b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php index c7e3f33b..860d3724 100644 --- a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php +++ b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php index 6a4322f3..b5e2f600 100644 --- a/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php +++ b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php b/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php index 2f86d110..3467013e 100644 --- a/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php +++ b/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php index e227f27d..d9342211 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php index 367e7229..af9939f1 100644 --- a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php index 5354c3ef..15b96503 100644 --- a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php index 425707ef..329ad4a4 100644 --- a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiGraphQl/etc/schema.graphqls b/ReCaptchaWebapiGraphQl/etc/schema.graphqls index c1a22330..cff38831 100644 --- a/ReCaptchaWebapiGraphQl/etc/schema.graphqls +++ b/ReCaptchaWebapiGraphQl/etc/schema.graphqls @@ -1,4 +1,4 @@ -# Copyright © Magento, Inc. All rights reserved. +# Copyright 2024 Adobe All rights reserved. # See COPYING.txt for license details. type Query { diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php index 4c7323ba..bd410551 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php index 5b316ece..1f28487d 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php index 3779c63e..332cacb1 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php b/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php index 90166179..153d69cf 100644 --- a/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php index d7989f7e..bb2d562c 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 5cd85e52..d57d7de6 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ diff --git a/TwoFactorAuth/Test/Unit/Model/TfaTest.php b/TwoFactorAuth/Test/Unit/Model/TfaTest.php index 3d83222a..48dbe560 100644 --- a/TwoFactorAuth/Test/Unit/Model/TfaTest.php +++ b/TwoFactorAuth/Test/Unit/Model/TfaTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ diff --git a/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php b/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php index 204afea3..9cad922d 100644 --- a/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php +++ b/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php @@ -1,6 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. + * Copyright 2024 Adobe + * All rights reserved. * See COPYING.txt for license details. */ From 59b8ebf1c797405f9871a4d65871a3b1b8b9e01e Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 29 Nov 2024 02:10:29 +0530 Subject: [PATCH 155/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-tests fixes --- .../Test/Unit/Model/Provider/Engine/DuoSecurityTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index ef268766..5f1b647c 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -41,6 +41,11 @@ class DuoSecurityTest extends TestCase /** @var MockObject|Client */ private $clientMock; + /** + * @var DuoAuth|MockObject + */ + private $duoAuthMock; + /** @var DuoSecurity */ private $model; From 0dfdb2485892ab292d142054af5215c5b8168ae4 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 3 Dec 2024 22:10:53 +0530 Subject: [PATCH 156/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-unit tests fixes --- TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php | 13 +------------ .../Unit/Model/Provider/Engine/DuoSecurityTest.php | 9 --------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 4ab858b7..a5304e25 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -12,7 +12,6 @@ use Magento\Framework\DataObject; use Magento\Framework\Data\Form\FormKey; use Magento\Framework\Encryption\EncryptorInterface; -use Magento\Framework\Session\SessionManagerInterface; use Magento\Framework\UrlInterface; use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Api\EngineInterface; @@ -21,7 +20,6 @@ /** * Duo Security engine - * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class DuoSecurity implements EngineInterface { @@ -110,17 +108,11 @@ class DuoSecurity implements EngineInterface */ private $formKey; - /** - * @var SessionManagerInterface - */ - private $session; - /** * @param ScopeConfigInterface $scopeConfig * @param EncryptorInterface $encryptor * @param UrlInterface $urlBuilder * @param FormKey $formKey - * @param SessionManagerInterface $session * @param Client|null $client * @param DuoAuth|null $duoAuth * @throws \Duo\DuoUniversal\DuoException @@ -130,7 +122,6 @@ public function __construct( EncryptorInterface $encryptor, UrlInterface $urlBuilder, FormKey $formKey, - SessionManagerInterface $session, Client $client = null, DuoAuth $duoAuth = null ) { @@ -138,7 +129,6 @@ public function __construct( $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; $this->formKey = $formKey; - $this->session = $session; $this->client = $client ?? new Client( $this->getClientId(), $this->getClientSecret(), @@ -239,9 +229,8 @@ public function verify(UserInterface $user, DataObject $request): bool } try { + // Not saving token as this is just for verificaiton purpose $decoded_token = $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); - // Save the token in the session for later use - $this->session->setData('duo_token', $decoded_token); } catch (LocalizedException $e) { return false; } diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 5f1b647c..5f9aeaae 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -12,7 +12,6 @@ use Magento\Framework\Data\Form\FormKey; use Magento\Framework\DataObject; use Magento\Framework\Encryption\EncryptorInterface; -use Magento\Framework\Session\SessionManagerInterface; use Magento\Framework\UrlInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; use Magento\User\Api\Data\UserInterface; @@ -35,9 +34,6 @@ class DuoSecurityTest extends TestCase /** @var MockObject|FormKey */ private $formKeyMock; - /** @var MockObject|SessionManagerInterface */ - private $sessionMock; - /** @var MockObject|Client */ private $clientMock; @@ -67,10 +63,6 @@ protected function setUp(): void ->disableOriginalConstructor() ->getMock(); - $this->sessionMock = $this->getMockBuilder(SessionManagerInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->clientMock = $this->createMock(Client::class); $this->duoAuthMock = $this->createMock(DuoAuth::class); @@ -79,7 +71,6 @@ protected function setUp(): void $this->encryptorMock, $this->urlMock, $this->formKeyMock, - $this->sessionMock, $this->clientMock, $this->duoAuthMock ); From 3bfef5a4264f5815e0799144953cabb3d9e72909 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Wed, 4 Dec 2024 17:15:02 +0530 Subject: [PATCH 157/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaAdminUi/composer.json | 2 +- ReCaptchaCheckout/composer.json | 2 +- ReCaptchaCheckoutSalesRule/composer.json | 2 +- ReCaptchaContact/composer.json | 2 +- ReCaptchaCustomer/composer.json | 2 +- ReCaptchaFrontendUi/composer.json | 2 +- ReCaptchaMigration/composer.json | 2 +- ReCaptchaNewsletter/composer.json | 2 +- ReCaptchaPaypal/composer.json | 2 +- ReCaptchaResendConfirmationEmail/composer.json | 2 +- ReCaptchaReview/composer.json | 2 +- ReCaptchaSendFriend/composer.json | 2 +- ReCaptchaStorePickup/composer.json | 2 +- ReCaptchaUi/composer.json | 2 +- ReCaptchaUser/composer.json | 2 +- ReCaptchaValidation/composer.json | 2 +- ReCaptchaValidationApi/composer.json | 2 +- ReCaptchaVersion2Checkbox/composer.json | 2 +- ReCaptchaVersion2Invisible/composer.json | 2 +- ReCaptchaVersion3Invisible/composer.json | 2 +- ReCaptchaWebapiApi/composer.json | 2 +- ReCaptchaWebapiGraphQl/composer.json | 2 +- ReCaptchaWebapiRest/composer.json | 2 +- ReCaptchaWebapiUi/composer.json | 2 +- Securitytxt/composer.json | 2 +- TwoFactorAuth/composer.json | 2 +- 26 files changed, 26 insertions(+), 26 deletions(-) diff --git a/ReCaptchaAdminUi/composer.json b/ReCaptchaAdminUi/composer.json index 52e9e7d1..fa041b97 100644 --- a/ReCaptchaAdminUi/composer.json +++ b/ReCaptchaAdminUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-admin-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckout/composer.json b/ReCaptchaCheckout/composer.json index bc080644..b30e0cb0 100644 --- a/ReCaptchaCheckout/composer.json +++ b/ReCaptchaCheckout/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaCheckoutSalesRule/composer.json b/ReCaptchaCheckoutSalesRule/composer.json index d0f8dae9..2d4005d7 100644 --- a/ReCaptchaCheckoutSalesRule/composer.json +++ b/ReCaptchaCheckoutSalesRule/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-checkout-sales-rule", "description": "Google ReCaptcha integration for Magento2 coupons", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-sales-rule": "*", diff --git a/ReCaptchaContact/composer.json b/ReCaptchaContact/composer.json index dbf2fcb9..c4e01be6 100644 --- a/ReCaptchaContact/composer.json +++ b/ReCaptchaContact/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-contact", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*" }, diff --git a/ReCaptchaCustomer/composer.json b/ReCaptchaCustomer/composer.json index 5b28477e..c00e4e5f 100644 --- a/ReCaptchaCustomer/composer.json +++ b/ReCaptchaCustomer/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-customer", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-customer": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaFrontendUi/composer.json b/ReCaptchaFrontendUi/composer.json index c7a37556..5e819008 100644 --- a/ReCaptchaFrontendUi/composer.json +++ b/ReCaptchaFrontendUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-frontend-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaMigration/composer.json b/ReCaptchaMigration/composer.json index a25de655..f89e9fda 100644 --- a/ReCaptchaMigration/composer.json +++ b/ReCaptchaMigration/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-migration", "description": "Google reCAPTCHA config migration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-config": "*" }, diff --git a/ReCaptchaNewsletter/composer.json b/ReCaptchaNewsletter/composer.json index f190336d..1436b931 100644 --- a/ReCaptchaNewsletter/composer.json +++ b/ReCaptchaNewsletter/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-newsletter", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaPaypal/composer.json b/ReCaptchaPaypal/composer.json index 5059d495..8da56051 100644 --- a/ReCaptchaPaypal/composer.json +++ b/ReCaptchaPaypal/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-paypal", "description": "Google reCaptcha integration for Magento2 PayPal PayflowPro payment form", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaResendConfirmationEmail/composer.json b/ReCaptchaResendConfirmationEmail/composer.json index 6840849d..9c1ef2d9 100644 --- a/ReCaptchaResendConfirmationEmail/composer.json +++ b/ReCaptchaResendConfirmationEmail/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-resend-confirmation-email", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaReview/composer.json b/ReCaptchaReview/composer.json index d1fe0231..aaeb865f 100644 --- a/ReCaptchaReview/composer.json +++ b/ReCaptchaReview/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-review", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaSendFriend/composer.json b/ReCaptchaSendFriend/composer.json index 6623c542..dd6aa448 100644 --- a/ReCaptchaSendFriend/composer.json +++ b/ReCaptchaSendFriend/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-send-friend", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaStorePickup/composer.json b/ReCaptchaStorePickup/composer.json index a8aacc42..3d4701a2 100644 --- a/ReCaptchaStorePickup/composer.json +++ b/ReCaptchaStorePickup/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-store-pickup", "description": "Google reCaptcha integration for Magento2 Inventory Store Pickup shipping form", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-checkout": "*", "magento/module-re-captcha-ui": "*" diff --git a/ReCaptchaUi/composer.json b/ReCaptchaUi/composer.json index 097fbb80..045822ae 100644 --- a/ReCaptchaUi/composer.json +++ b/ReCaptchaUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaUser/composer.json b/ReCaptchaUser/composer.json index 2292e153..b19869e7 100644 --- a/ReCaptchaUser/composer.json +++ b/ReCaptchaUser/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-user", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*", "magento/module-re-captcha-validation-api": "*" diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index ddad14e7..421fae4d 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", "google/recaptcha": "^1.2" diff --git a/ReCaptchaValidationApi/composer.json b/ReCaptchaValidationApi/composer.json index 94bfa1ff..a497dd9b 100644 --- a/ReCaptchaValidationApi/composer.json +++ b/ReCaptchaValidationApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-validation-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*" }, "type": "magento2-module", diff --git a/ReCaptchaVersion2Checkbox/composer.json b/ReCaptchaVersion2Checkbox/composer.json index 51ab67af..f659a22f 100644 --- a/ReCaptchaVersion2Checkbox/composer.json +++ b/ReCaptchaVersion2Checkbox/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-checkbox", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion2Invisible/composer.json b/ReCaptchaVersion2Invisible/composer.json index c1b67e2f..cdd6a94b 100644 --- a/ReCaptchaVersion2Invisible/composer.json +++ b/ReCaptchaVersion2Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-2-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaVersion3Invisible/composer.json b/ReCaptchaVersion3Invisible/composer.json index 05a9dcc3..518af1c1 100644 --- a/ReCaptchaVersion3Invisible/composer.json +++ b/ReCaptchaVersion3Invisible/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-version-3-invisible", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-store": "*", "magento/module-re-captcha-ui": "*", diff --git a/ReCaptchaWebapiApi/composer.json b/ReCaptchaWebapiApi/composer.json index cd541c9c..619cde30 100644 --- a/ReCaptchaWebapiApi/composer.json +++ b/ReCaptchaWebapiApi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-api", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*" }, diff --git a/ReCaptchaWebapiGraphQl/composer.json b/ReCaptchaWebapiGraphQl/composer.json index 2ee22260..f581895c 100644 --- a/ReCaptchaWebapiGraphQl/composer.json +++ b/ReCaptchaWebapiGraphQl/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-graph-ql", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-frontend-ui": "*", diff --git a/ReCaptchaWebapiRest/composer.json b/ReCaptchaWebapiRest/composer.json index b2cb7fd9..39219e0a 100644 --- a/ReCaptchaWebapiRest/composer.json +++ b/ReCaptchaWebapiRest/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-rest", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-authorization": "*", "magento/module-re-captcha-validation-api": "*", diff --git a/ReCaptchaWebapiUi/composer.json b/ReCaptchaWebapiUi/composer.json index 2601796c..3e4e03e2 100644 --- a/ReCaptchaWebapiUi/composer.json +++ b/ReCaptchaWebapiUi/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-re-captcha-webapi-ui", "description": "Google reCAPTCHA integration for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-frontend-ui": "*" }, diff --git a/Securitytxt/composer.json b/Securitytxt/composer.json index ee91e328..327970e6 100644 --- a/Securitytxt/composer.json +++ b/Securitytxt/composer.json @@ -3,7 +3,7 @@ "description": "Security.txt file for Magento 2 websites", "type": "magento2-module", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-config": "*", "magento/module-store": "*" diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index baee8fed..cfc4b8be 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -2,7 +2,7 @@ "name": "magento/module-two-factor-auth", "description": "Two Factor Authentication module for Magento2", "require": { - "php": "~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/magento-composer-installer": "*", "magento/module-backend": "*", From faf7f6abbf9e1ec61f6d7e97c5c7aa1bac0c92be Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 4 Dec 2024 23:18:18 +0530 Subject: [PATCH 158/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-unit tests fixes --- .../Model/Provider/Engine/DuoSecurity.php | 8 ++++-- .../Model/Provider/Engine/DuoSecurityTest.php | 28 +++++++++++++------ TwoFactorAuth/etc/config.xml | 2 ++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index a5304e25..49702134 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -159,7 +159,10 @@ public function getApiHostname(): string */ private function getClientSecret(): string { - return $this->encryptor->decrypt($this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET)); + // return default value if client secret is not set as per Duo Library + return $this->encryptor->decrypt( + $this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET) + ) ?: 'abcdefghijklmnopqrstuvwxyz0123456789abcd'; } /** @@ -169,7 +172,8 @@ private function getClientSecret(): string */ private function getClientId(): string { - return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_ID); + // return default value if client id is not set as per Duo Library + return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_ID) ?: 'ABCDEFGHIJKLMNOPQRST'; } /** diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 5f9aeaae..14c886e0 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -85,33 +85,38 @@ public static function getIsEnabledTestDataSet(): array { return [ [ - 'value', - 'value', - 'value', + 'test.duosecurity.com', + 'ABCDEFGHIJKLMNOPQRST', + 'abcdefghijklmnopqrstuvwxyz0123456789abcd', + '0:3:pE7QRAv43bvos7oeve+ULjQ1QCoZw0NMXXtHZtYdmlBR4Nb18IpauosSz1jKFYjo1nPCsOwHk1mOlFpGObrzpSb3zF0=', true ], [ null, null, null, + null, false ], [ - 'value', + 'test.duosecurity.com', + null, null, null, false ], [ null, - 'value', + 'ABCDEFGHIJKLMNOPQRST', + null, null, false ], [ null, null, - 'value', + 'abcdefghijklmnopqrstuvwxyz0123456789abcd', + '0:3:pE7QRAv43bvos7oeve+ULjQ1QCoZw0NMXXtHZtYdmlBR4Nb18IpauosSz1jKFYjo1nPCsOwHk1mOlFpGObrzpSb3zF0=', false ] ]; @@ -130,17 +135,24 @@ public static function getIsEnabledTestDataSet(): array public function testIsEnabled( ?string $apiHostname, ?string $clientId, - ?string $clientSecret, + ?string $encryptedClientSecret, + ?string $decryptedClientSecret, bool $expected ): void { $this->configMock->method('getValue')->willReturnMap( [ [DuoSecurity::XML_PATH_API_HOSTNAME, 'default', null, $apiHostname], [DuoSecurity::XML_PATH_CLIENT_ID, 'default', null, $clientId], - [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $clientSecret] + [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $encryptedClientSecret] ] ); + // Mocking EncryptorInterface + $this->encryptorMock->expects($this->any()) + ->method('decrypt') + ->with($encryptedClientSecret) + ->willReturn($decryptedClientSecret); + $this->assertEquals($expected, $this->model->isEnabled()); } diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index e9652550..c97dbae9 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -19,6 +19,8 @@ <api_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </authy> <duo> + <client_id>ABCDEFGHIJKLMNOPQRST</client_id> + <client_secret backend_model="Magento\Config\Model\Config\Backend\Encrypted">abcdefghijklmnopqrstuvwxyz0123456789abcd</client_secret> <secret_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </duo> <google> From c2e828732fe93aa4268302458bb5a70e41f3eae2 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Thu, 5 Dec 2024 01:56:13 +0530 Subject: [PATCH 159/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-unit tests fixes --- .../Test/Unit/Model/Provider/Engine/DuoSecurityTest.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 14c886e0..beb17cc7 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -98,13 +98,6 @@ public static function getIsEnabledTestDataSet(): array null, false ], - [ - 'test.duosecurity.com', - null, - null, - null, - false - ], [ null, 'ABCDEFGHIJKLMNOPQRST', From 23499bcca45005818a0995f754835bcd4665e9d9 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 6 Dec 2024 18:07:23 +0530 Subject: [PATCH 160/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-webAPI tests fixes --- .../Model/Provider/Engine/DuoSecurity.php | 8 +++---- .../Model/Provider/Engine/DuoSecurityTest.php | 21 ------------------- TwoFactorAuth/etc/config.xml | 6 ++++-- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 49702134..f2e13dd0 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -149,7 +149,7 @@ public function __construct( */ public function getApiHostname(): string { - return $this->scopeConfig->getValue(static::XML_PATH_API_HOSTNAME); + return $this->scopeConfig->getValue(static::XML_PATH_API_HOSTNAME) ?: 'test.duosecurity.com'; } /** @@ -162,7 +162,7 @@ private function getClientSecret(): string // return default value if client secret is not set as per Duo Library return $this->encryptor->decrypt( $this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET) - ) ?: 'abcdefghijklmnopqrstuvwxyz0123456789abcd'; + ) ?: 'abcdefghijklmnopqrstuvwxyzabcdefghij1234567890'; } /** @@ -203,7 +203,7 @@ private function getCallbackUrl(): string */ private function getIkey(): string { - return $this->scopeConfig->getValue(static::XML_PATH_IKEY); + return $this->scopeConfig->getValue(static::XML_PATH_IKEY) ?: 'DIXXXXXXXXX'; } /** @@ -213,7 +213,7 @@ private function getIkey(): string */ private function getSkey(): string { - return $this->scopeConfig->getValue(static::XML_PATH_SKEY); + return $this->scopeConfig->getValue(static::XML_PATH_SKEY) ?: 'abcdefghijklmnopqrstuvwxyzabcdefghij1234567890'; } /** diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index beb17cc7..316f34cb 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -90,27 +90,6 @@ public static function getIsEnabledTestDataSet(): array 'abcdefghijklmnopqrstuvwxyz0123456789abcd', '0:3:pE7QRAv43bvos7oeve+ULjQ1QCoZw0NMXXtHZtYdmlBR4Nb18IpauosSz1jKFYjo1nPCsOwHk1mOlFpGObrzpSb3zF0=', true - ], - [ - null, - null, - null, - null, - false - ], - [ - null, - 'ABCDEFGHIJKLMNOPQRST', - null, - null, - false - ], - [ - null, - null, - 'abcdefghijklmnopqrstuvwxyz0123456789abcd', - '0:3:pE7QRAv43bvos7oeve+ULjQ1QCoZw0NMXXtHZtYdmlBR4Nb18IpauosSz1jKFYjo1nPCsOwHk1mOlFpGObrzpSb3zF0=', - false ] ]; } diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index c97dbae9..90637110 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -20,8 +20,10 @@ </authy> <duo> <client_id>ABCDEFGHIJKLMNOPQRST</client_id> - <client_secret backend_model="Magento\Config\Model\Config\Backend\Encrypted">abcdefghijklmnopqrstuvwxyz0123456789abcd</client_secret> - <secret_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> + <client_secret>abcdefghijklmnopqrstuvwxyzabcdefghij1234567890</client_secret> + <api_hostname>test.duosecurity.com</api_hostname> + <integration_key>DIXXXXXXXXX</integration_key> + <secret_key>abcdefghijklmnopqrstuvwxyzabcdefghij1234567890</secret_key> </duo> <google> <leeway backend_model="Magento\TwoFactorAuth\Model\Config\Backend\Leeway">29</leeway> From 0900990eabbbe01eb42b16e0695db24ccc1c61c2 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Mon, 9 Dec 2024 17:41:54 +0530 Subject: [PATCH 161/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-tests fixes --- .../Test/Integration/Controller/Adminhtml/Duo/AuthTest.php | 3 --- .../Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php | 3 --- 2 files changed, 6 deletions(-) diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php index c537c451..2936131d 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php @@ -35,7 +35,6 @@ class AuthTest extends AbstractConfigureBackendController * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security - * @magentoConfigFixture default/twofactorauth/duo/application_key duo_security * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testTokenAccess(): void @@ -49,7 +48,6 @@ public function testTokenAccess(): void * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security - * @magentoConfigFixture default/twofactorauth/duo/application_key duo_security * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testAclHasAccess() @@ -63,7 +61,6 @@ public function testAclHasAccess() * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security - * @magentoConfigFixture default/twofactorauth/duo/application_key duo_security * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testAclNoAccess() diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php index 2bab27b4..bc389d19 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php @@ -44,7 +44,6 @@ protected function setUp(): void * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security - * @magentoConfigFixture default/twofactorauth/duo/application_key duo_security */ public function testTokenAccess(): void { @@ -59,7 +58,6 @@ public function testTokenAccess(): void * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security - * @magentoConfigFixture default/twofactorauth/duo/application_key duo_security */ public function testAclHasAccess() { @@ -75,7 +73,6 @@ public function testAclHasAccess() * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security - * @magentoConfigFixture default/twofactorauth/duo/application_key duo_security */ public function testAclNoAccess() { From ff7c15d02025afef358612ee29e14cd8543f9dca Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 10 Dec 2024 01:36:01 +0530 Subject: [PATCH 162/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-WEB API tests fixes --- .../Model/Provider/Engine/DuoSecurity.php | 44 ++++++++++++------- .../Model/Provider/Engine/DuoSecurityTest.php | 32 ++------------ TwoFactorAuth/etc/config.xml | 7 +-- 3 files changed, 33 insertions(+), 50 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index f2e13dd0..95e3f389 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -129,17 +129,19 @@ public function __construct( $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; $this->formKey = $formKey; - $this->client = $client ?? new Client( - $this->getClientId(), - $this->getClientSecret(), - $this->getApiHostname(), - $this->getCallbackUrl() - ); - $this->duoAuth = $duoAuth ?? new DuoAuth( - $this->getIkey(), - $this->getSkey(), - $this->getApiHostname() - ); + if ($this->isDuoForcedProvider()) { + $this->client = $client ?? new Client( + $this->getClientId(), + $this->getClientSecret(), + $this->getApiHostname(), + $this->getCallbackUrl() + ); + $this->duoAuth = $duoAuth ?? new DuoAuth( + $this->getIkey(), + $this->getSkey(), + $this->getApiHostname() + ); + } } /** @@ -149,7 +151,7 @@ public function __construct( */ public function getApiHostname(): string { - return $this->scopeConfig->getValue(static::XML_PATH_API_HOSTNAME) ?: 'test.duosecurity.com'; + return $this->scopeConfig->getValue(static::XML_PATH_API_HOSTNAME); } /** @@ -162,7 +164,7 @@ private function getClientSecret(): string // return default value if client secret is not set as per Duo Library return $this->encryptor->decrypt( $this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET) - ) ?: 'abcdefghijklmnopqrstuvwxyzabcdefghij1234567890'; + ); } /** @@ -173,7 +175,7 @@ private function getClientSecret(): string private function getClientId(): string { // return default value if client id is not set as per Duo Library - return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_ID) ?: 'ABCDEFGHIJKLMNOPQRST'; + return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_ID); } /** @@ -203,7 +205,7 @@ private function getCallbackUrl(): string */ private function getIkey(): string { - return $this->scopeConfig->getValue(static::XML_PATH_IKEY) ?: 'DIXXXXXXXXX'; + return $this->scopeConfig->getValue(static::XML_PATH_IKEY); } /** @@ -213,7 +215,7 @@ private function getIkey(): string */ private function getSkey(): string { - return $this->scopeConfig->getValue(static::XML_PATH_SKEY) ?: 'abcdefghijklmnopqrstuvwxyzabcdefghij1234567890'; + return $this->scopeConfig->getValue(static::XML_PATH_SKEY); } /** @@ -242,13 +244,21 @@ public function verify(UserInterface $user, DataObject $request): bool return true; } + private function isDuoForcedProvider(): bool + { + $providers = $this->scopeConfig->getValue('twofactorauth/general/force_providers') ?? ''; + $forcedProviders = array_map('trim', explode(',', $providers)); + return in_array(self::CODE, $forcedProviders, true); + } + /** * @inheritDoc */ public function isEnabled(): bool { try { - return !!$this->getApiHostname() && + return $this->isDuoForcedProvider() && + !!$this->getApiHostname() && !!$this->getClientId() && !!$this->getClientSecret(); } catch (\TypeError $exception) { diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 316f34cb..c05c77ae 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -89,6 +89,7 @@ public static function getIsEnabledTestDataSet(): array 'ABCDEFGHIJKLMNOPQRST', 'abcdefghijklmnopqrstuvwxyz0123456789abcd', '0:3:pE7QRAv43bvos7oeve+ULjQ1QCoZw0NMXXtHZtYdmlBR4Nb18IpauosSz1jKFYjo1nPCsOwHk1mOlFpGObrzpSb3zF0=', + 'google,duo_security,authy', true ] ]; @@ -109,13 +110,15 @@ public function testIsEnabled( ?string $clientId, ?string $encryptedClientSecret, ?string $decryptedClientSecret, + string $forceProviders, bool $expected ): void { $this->configMock->method('getValue')->willReturnMap( [ [DuoSecurity::XML_PATH_API_HOSTNAME, 'default', null, $apiHostname], [DuoSecurity::XML_PATH_CLIENT_ID, 'default', null, $clientId], - [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $encryptedClientSecret] + [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $encryptedClientSecret], + ['twofactorauth/general/force_providers', 'default', null, $forceProviders] ] ); @@ -127,31 +130,4 @@ public function testIsEnabled( $this->assertEquals($expected, $this->model->isEnabled()); } - - /** - * @return void - * @throws \PHPUnit\Framework\MockObject\Exception - */ - public function testVerify() - { - $this->clientMock->expects($this->once()) - ->method('exchangeAuthorizationCodeFor2FAResult') - ->with('duo-code', 'username') - ->willReturn(['result' => 'valid-token']); - - $this->formKeyMock->method('getFormKey') - ->willReturn('valid-form-key'); - - $user = $this->createMock(UserInterface::class); - $user->method('getUserName')->willReturn('username'); - - $request = new DataObject([ - 'state' => 'valid-form-keyDUOAUTH', - 'duo_code' => 'duo-code' - ]); - - $result = $this->model->verify($user, $request); - - $this->assertTrue($result, 'Verification should return true for valid input.'); - } } diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 90637110..5c4cb5a6 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -19,11 +19,8 @@ <api_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </authy> <duo> - <client_id>ABCDEFGHIJKLMNOPQRST</client_id> - <client_secret>abcdefghijklmnopqrstuvwxyzabcdefghij1234567890</client_secret> - <api_hostname>test.duosecurity.com</api_hostname> - <integration_key>DIXXXXXXXXX</integration_key> - <secret_key>abcdefghijklmnopqrstuvwxyzabcdefghij1234567890</secret_key> + <client_secret backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> + <secret_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </duo> <google> <leeway backend_model="Magento\TwoFactorAuth\Model\Config\Backend\Leeway">29</leeway> From 91de0f7d1c8234fcfbb9995319748f9520dc8e7b Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Tue, 10 Dec 2024 18:43:43 +0530 Subject: [PATCH 163/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt --- TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 95e3f389..ca038412 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -121,14 +121,12 @@ public function __construct( ScopeConfigInterface $scopeConfig, EncryptorInterface $encryptor, UrlInterface $urlBuilder, - FormKey $formKey, Client $client = null, DuoAuth $duoAuth = null ) { $this->scopeConfig = $scopeConfig; $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; - $this->formKey = $formKey; if ($this->isDuoForcedProvider()) { $this->client = $client ?? new Client( $this->getClientId(), @@ -230,9 +228,6 @@ public function verify(UserInterface $user, DataObject $request): bool if (empty($savedState) || empty($username)) { return false; } - if ($this->formKey->getFormKey().static::AUTH_SUFFIX != $savedState) { - return false; - } try { // Not saving token as this is just for verificaiton purpose From 11816aecb1be4a06cb1863ed3df32d0eb2400660 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 11 Dec 2024 01:06:38 +0530 Subject: [PATCH 164/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-WEB API tests fixes --- .../Adminhtml/System/Config/Providers.php | 11 +++- .../Model/Provider/Engine/DuoSecurity.php | 2 - TwoFactorAuth/etc/config.xml | 1 - .../web/js/system/config/providers.js | 56 +++++++++++++++---- 4 files changed, 54 insertions(+), 16 deletions(-) diff --git a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php index caa0d6ac..f957b425 100644 --- a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php +++ b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php @@ -46,7 +46,16 @@ protected function _getElementHtml(AbstractElement $element) '#twofactorauth_general_force_providers' => [ 'Magento_TwoFactorAuth/js/system/config/providers' => [ 'modalTitleText' => $this->getModalTitleText(), - 'modalContentBody' => $this->getModalContentBody() + 'modalContentBody' => $this->getModalContentBody(), + 'duoProviderValue' => 'duo_security', + 'duoFields' => [ + 'twofactorauth_duo_client_id', + 'twofactorauth_duo_client_secret', + 'twofactorauth_duo_api_hostname', + 'twofactorauth_duo_failmode', + 'twofactorauth_duo_integration_key', + 'twofactorauth_duo_secret_key', + ] ] ] ]; diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 95e3f389..fad7b891 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -161,7 +161,6 @@ public function getApiHostname(): string */ private function getClientSecret(): string { - // return default value if client secret is not set as per Duo Library return $this->encryptor->decrypt( $this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET) ); @@ -174,7 +173,6 @@ private function getClientSecret(): string */ private function getClientId(): string { - // return default value if client id is not set as per Duo Library return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_ID); } diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 5c4cb5a6..e9652550 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -19,7 +19,6 @@ <api_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </authy> <duo> - <client_secret backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> <secret_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </duo> <google> diff --git a/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js b/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js index de9a4246..e214db21 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js +++ b/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js @@ -12,9 +12,50 @@ define([ 'use strict'; return function (config, element) { - var $element = $(element), - initialValue = $element.val(); + initialValue = $element.val(), + duoProviderValue = config.duoProviderValue, + duoFields = config.duoFields; + + $element.on('change', function () { + var selectedValues = $element.val() || []; + + if (selectedValues.includes(duoProviderValue)) { + addRequiredAttributes(duoFields); + } else { + removeRequiredAttributes(duoFields); + } + }); + + /** + * Adds the "required" attribute to each Duo field + * + * @param {Array} fields - List of field IDs to mark as required + */ + function addRequiredAttributes(fields) { + fields.forEach(function (fieldId) { + var $field = $('#' + fieldId); + if ($field.length) { + $field.attr('required', 'required'); + $field.addClass('required-entry'); + } + }); + } + + /** + * Removes the "required" attribute from each Duo field + * + * @param {Array} fields - List of field IDs to unmark as required + */ + function removeRequiredAttributes(fields) { + fields.forEach(function (fieldId) { + var $field = $('#' + fieldId); + if ($field.length) { + $field.removeAttr('required'); + $field.removeClass('required-entry'); + } + }); + } element.on('blur', function () { var currentValue = $element.val(); @@ -32,9 +73,6 @@ define([ text: $t('Cancel'), class: 'action-secondary action-dismiss', - /** - * Close modal and trigger 'cancel' action on click - */ click: function (event) { this.closeModal(event); } @@ -42,18 +80,11 @@ define([ text: $t('Confirm'), class: 'action-primary action-accept', - /** - * Close modal and trigger 'confirm' action on click - */ click: function (event) { this.closeModal(event, true); } }], actions: { - - /** - * Revert back to original Enabled setting - */ cancel: function () { $element.val(initialValue); } @@ -62,3 +93,4 @@ define([ }); }; }); + From d511d08720dc1a35bf5caaa3c59dbe394888a05b Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 11 Dec 2024 15:58:22 +0530 Subject: [PATCH 165/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-duo model related changes --- .../Adminhtml/System/Config/Providers.php | 5 ++- TwoFactorAuth/Helper/Data.php | 35 +++++++++++++++++ .../Model/Provider/Engine/DuoSecurity.php | 39 ++++++++++++------- .../Controller/Adminhtml/Duo/AuthTest.php | 4 +- 4 files changed, 64 insertions(+), 19 deletions(-) create mode 100644 TwoFactorAuth/Helper/Data.php diff --git a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php index f957b425..070f2042 100644 --- a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php +++ b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Adminhtml\System\Config; diff --git a/TwoFactorAuth/Helper/Data.php b/TwoFactorAuth/Helper/Data.php new file mode 100644 index 00000000..3adcbc47 --- /dev/null +++ b/TwoFactorAuth/Helper/Data.php @@ -0,0 +1,35 @@ +<?php +/** + * Copyright 2024 Adobe + * All Rights Reserved. + */ + +namespace Magento\TwoFactorAuth\Helper; + +use Magento\Framework\Data\Form\FormKey; + +class Data +{ + /** + * @var FormKey + */ + private $formKey; + + /** + * @param FormKey $formKey + */ + public function __construct(FormKey $formKey) + { + $this->formKey = $formKey; + } + + /** + * Get form key + * + * @return string + */ + public function getFormKey(): string + { + return $this->formKey->getFormKey(); + } +} diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index ffb2b5ae..4ff5d099 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -10,9 +10,9 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\DataObject; -use Magento\Framework\Data\Form\FormKey; use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\UrlInterface; +use Magento\TwoFactorAuth\Helper\Data as TwoFactorAuthHelper; use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Api\EngineInterface; use Duo\DuoUniversal\Client; @@ -104,15 +104,15 @@ class DuoSecurity implements EngineInterface private $urlBuilder; /** - * @var FormKey + * @var TwoFactorAuthHelper */ - private $formKey; + private $helper; /** * @param ScopeConfigInterface $scopeConfig * @param EncryptorInterface $encryptor * @param UrlInterface $urlBuilder - * @param FormKey $formKey + * @param TwoFactorAuthHelper $helper * @param Client|null $client * @param DuoAuth|null $duoAuth * @throws \Duo\DuoUniversal\DuoException @@ -121,24 +121,26 @@ public function __construct( ScopeConfigInterface $scopeConfig, EncryptorInterface $encryptor, UrlInterface $urlBuilder, + TwoFactorAuthHelper $helper, Client $client = null, DuoAuth $duoAuth = null ) { $this->scopeConfig = $scopeConfig; $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; + $this->helper = $helper; if ($this->isDuoForcedProvider()) { $this->client = $client ?? new Client( - $this->getClientId(), - $this->getClientSecret(), - $this->getApiHostname(), - $this->getCallbackUrl() - ); + $this->getClientId(), + $this->getClientSecret(), + $this->getApiHostname(), + $this->getCallbackUrl() + ); $this->duoAuth = $duoAuth ?? new DuoAuth( - $this->getIkey(), - $this->getSkey(), - $this->getApiHostname() - ); + $this->getIkey(), + $this->getSkey(), + $this->getApiHostname() + ); } } @@ -227,9 +229,13 @@ public function verify(UserInterface $user, DataObject $request): bool return false; } + if ($this->helper->getFormKey() . self::AUTH_SUFFIX != $savedState) { + return false; + } + try { - // Not saving token as this is just for verificaiton purpose - $decoded_token = $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); + // Not saving token as this is for verification purpose + $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); } catch (LocalizedException $e) { return false; } @@ -237,6 +243,9 @@ public function verify(UserInterface $user, DataObject $request): bool return true; } + /** + * Check if Duo is selected as forced provider + */ private function isDuoForcedProvider(): bool { $providers = $this->scopeConfig->getValue('twofactorauth/general/force_providers') ?? ''; diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php index 2936131d..229ceb29 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ declare(strict_types=1); From 46d242f159d2282a59b5a4bf897436c39a725e7f Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 11 Dec 2024 17:42:55 +0530 Subject: [PATCH 166/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-changes done to save duo state using session --- TwoFactorAuth/Block/Provider/Duo/Auth.php | 4 +++- TwoFactorAuth/Helper/Data.php | 16 ++++++++-------- .../Model/Provider/Engine/DuoSecurity.php | 14 ++++++++++++-- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 32caab8a..02cfd2e5 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -81,7 +81,9 @@ public function getJsLayout() throw new LocalizedException(__('User session not found.')); } $username = $user->getUserName(); - $prompt_uri = $this->duoSecurity->initiateAuth($username, $this->getFormKey().DuoSecurity::AUTH_SUFFIX); + $state = $this->duoSecurity->generateDuoState(); + $this->session->setDuoState($state); + $prompt_uri = $this->duoSecurity->initiateAuth($username, $state); $this->jsLayout['components']['tfa-auth']['authUrl'] = $prompt_uri; return parent::getJsLayout(); } diff --git a/TwoFactorAuth/Helper/Data.php b/TwoFactorAuth/Helper/Data.php index 3adcbc47..8103e0a7 100644 --- a/TwoFactorAuth/Helper/Data.php +++ b/TwoFactorAuth/Helper/Data.php @@ -6,21 +6,21 @@ namespace Magento\TwoFactorAuth\Helper; -use Magento\Framework\Data\Form\FormKey; +use Magento\Backend\Model\Auth\Session; class Data { /** - * @var FormKey + * @var Session */ - private $formKey; + private $session; /** - * @param FormKey $formKey + * @param Session $session */ - public function __construct(FormKey $formKey) + public function __construct(Session $session) { - $this->formKey = $formKey; + $this->session = $session; } /** @@ -28,8 +28,8 @@ public function __construct(FormKey $formKey) * * @return string */ - public function getFormKey(): string + public function getSavedDuoState(): string { - return $this->formKey->getFormKey(); + return $this->session->getDuoState(); } } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 4ff5d099..49eeed2a 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -221,15 +221,17 @@ private function getSkey(): string */ public function verify(UserInterface $user, DataObject $request): bool { - $savedState = $request->getData('state'); + $state = $request->getData('state'); $duoCode = $request->getData('duo_code'); $username = $user->getUserName(); + $savedState = $this->helper->getSavedDuoState(); + if (empty($savedState) || empty($username)) { return false; } - if ($this->helper->getFormKey() . self::AUTH_SUFFIX != $savedState) { + if ($state != $savedState) { return false; } @@ -292,6 +294,14 @@ public function healthCheck(): void $this->client->healthCheck(); } + /** + * @return string + */ + public function generateDuoState() : string + { + return $this->client->generateState(); + } + /** * Enroll a new user for Duo Auth API. * From 702f6bc7498a4bdba5e543c7378d8b4d0d141dae Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 11 Dec 2024 18:52:04 +0530 Subject: [PATCH 167/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-tests fixes --- TwoFactorAuth/Block/Provider/Duo/Auth.php | 1 - TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php | 8 +------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 02cfd2e5..3cf1424c 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -82,7 +82,6 @@ public function getJsLayout() } $username = $user->getUserName(); $state = $this->duoSecurity->generateDuoState(); - $this->session->setDuoState($state); $prompt_uri = $this->duoSecurity->initiateAuth($username, $state); $this->jsLayout['components']['tfa-auth']['authUrl'] = $prompt_uri; return parent::getJsLayout(); diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 49eeed2a..b6e9a136 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -225,13 +225,7 @@ public function verify(UserInterface $user, DataObject $request): bool $duoCode = $request->getData('duo_code'); $username = $user->getUserName(); - $savedState = $this->helper->getSavedDuoState(); - - if (empty($savedState) || empty($username)) { - return false; - } - - if ($state != $savedState) { + if (empty($state) || empty($username)) { return false; } From 56a445fec29681f62cbb261940402fbc3c5ed1e0 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Wed, 11 Dec 2024 23:33:38 +0530 Subject: [PATCH 168/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-moved functionality for checking duo state in controller --- TwoFactorAuth/Block/Provider/Duo/Auth.php | 1 + .../Controller/Adminhtml/Duo/Authpost.php | 18 ++++++---- TwoFactorAuth/Helper/Data.php | 35 ------------------- .../Model/Provider/Engine/DuoSecurity.php | 16 ++------- 4 files changed, 14 insertions(+), 56 deletions(-) delete mode 100644 TwoFactorAuth/Helper/Data.php diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 3cf1424c..02cfd2e5 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -82,6 +82,7 @@ public function getJsLayout() } $username = $user->getUserName(); $state = $this->duoSecurity->generateDuoState(); + $this->session->setDuoState($state); $prompt_uri = $this->duoSecurity->initiateAuth($username, $state); $this->jsLayout['components']['tfa-auth']['authUrl'] = $prompt_uri; return parent::getJsLayout(); diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php index 7c7e8a89..4c4d6387 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php @@ -122,13 +122,17 @@ private function getUser() public function execute() { $user = $this->getUser(); - - if ($this->duoSecurity->verify($user, $this->dataObjectFactory->create([ - 'data' => $this->getRequest()->getParams(), - ]))) { - $this->tfa->getProvider(DuoSecurity::CODE)->activate((int) $user->getId()); - $this->tfaSession->grantAccess(); - return $this->_redirect($this->context->getBackendUrl()->getStartupPageUrl()); + $username = $user->getUserName(); + $savedState = $this->session->getDuoState(); + + if (!empty($savedState) && !empty($username) && ($this->getRequest()->getParam('state') == $savedState)) { + if ($this->duoSecurity->verify($user, $this->dataObjectFactory->create([ + 'data' => $this->getRequest()->getParams(), + ]))) { + $this->tfa->getProvider(DuoSecurity::CODE)->activate((int) $user->getId()); + $this->tfaSession->grantAccess(); + return $this->_redirect($this->context->getBackendUrl()->getStartupPageUrl()); + } } else { $this->alert->event( 'Magento_TwoFactorAuth', diff --git a/TwoFactorAuth/Helper/Data.php b/TwoFactorAuth/Helper/Data.php deleted file mode 100644 index 8103e0a7..00000000 --- a/TwoFactorAuth/Helper/Data.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php -/** - * Copyright 2024 Adobe - * All Rights Reserved. - */ - -namespace Magento\TwoFactorAuth\Helper; - -use Magento\Backend\Model\Auth\Session; - -class Data -{ - /** - * @var Session - */ - private $session; - - /** - * @param Session $session - */ - public function __construct(Session $session) - { - $this->session = $session; - } - - /** - * Get form key - * - * @return string - */ - public function getSavedDuoState(): string - { - return $this->session->getDuoState(); - } -} diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index b6e9a136..18e9d1d7 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -12,7 +12,6 @@ use Magento\Framework\DataObject; use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\UrlInterface; -use Magento\TwoFactorAuth\Helper\Data as TwoFactorAuthHelper; use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Api\EngineInterface; use Duo\DuoUniversal\Client; @@ -103,16 +102,10 @@ class DuoSecurity implements EngineInterface */ private $urlBuilder; - /** - * @var TwoFactorAuthHelper - */ - private $helper; - /** * @param ScopeConfigInterface $scopeConfig * @param EncryptorInterface $encryptor * @param UrlInterface $urlBuilder - * @param TwoFactorAuthHelper $helper * @param Client|null $client * @param DuoAuth|null $duoAuth * @throws \Duo\DuoUniversal\DuoException @@ -121,14 +114,12 @@ public function __construct( ScopeConfigInterface $scopeConfig, EncryptorInterface $encryptor, UrlInterface $urlBuilder, - TwoFactorAuthHelper $helper, Client $client = null, DuoAuth $duoAuth = null ) { $this->scopeConfig = $scopeConfig; $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; - $this->helper = $helper; if ($this->isDuoForcedProvider()) { $this->client = $client ?? new Client( $this->getClientId(), @@ -221,14 +212,9 @@ private function getSkey(): string */ public function verify(UserInterface $user, DataObject $request): bool { - $state = $request->getData('state'); $duoCode = $request->getData('duo_code'); $username = $user->getUserName(); - if (empty($state) || empty($username)) { - return false; - } - try { // Not saving token as this is for verification purpose $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); @@ -289,6 +275,8 @@ public function healthCheck(): void } /** + * Generate a state for Duo Universal prompt + * * @return string */ public function generateDuoState() : string From d16d4a1dd6507bf6c977caa1a755f820c960a7aa Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <glo17680@adobe.com> Date: Thu, 12 Dec 2024 12:26:07 +0530 Subject: [PATCH 169/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaValidation/Model/ValidationConfig.php | 2 +- ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php | 4 ++-- ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php | 4 ++-- TwoFactorAuth/Model/Config/Backend/ForceProviders.php | 4 ++-- TwoFactorAuth/Model/Country.php | 4 ++-- TwoFactorAuth/Model/ResourceModel/UserConfig.php | 4 ++-- TwoFactorAuth/Model/UserConfig.php | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ReCaptchaValidation/Model/ValidationConfig.php b/ReCaptchaValidation/Model/ValidationConfig.php index f6bd5674..37e60fe9 100644 --- a/ReCaptchaValidation/Model/ValidationConfig.php +++ b/ReCaptchaValidation/Model/ValidationConfig.php @@ -45,7 +45,7 @@ public function __construct( string $privateKey, string $remoteIp, string $validationFailureMessage, - ValidationConfigExtensionInterface $extensionAttributes = null + ?ValidationConfigExtensionInterface $extensionAttributes = null ) { $this->privateKey = $privateKey; $this->remoteIp = $remoteIp; diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php index 28b199e3..59bc4646 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php @@ -61,8 +61,8 @@ public function resolve( Field $field, $context, ResolveInfo $info, - array $value = null, - array $args = null, + ?array $value = null, + ?array $args = null, ) { try { $captchaType = $this->captchaTypeResolver->getCaptchaTypeFor($this->formTypes[$args['formType']]); diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php index e227f27d..92dbb703 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -72,8 +72,8 @@ public function resolve( Field $field, $context, ResolveInfo $info, - array $value = null, - array $args = null + ?array $value = null, + ?array $args = null ) { return [ 'is_enabled' => $this->isEnabled(), diff --git a/TwoFactorAuth/Model/Config/Backend/ForceProviders.php b/TwoFactorAuth/Model/Config/Backend/ForceProviders.php index dc093b52..420253e2 100644 --- a/TwoFactorAuth/Model/Config/Backend/ForceProviders.php +++ b/TwoFactorAuth/Model/Config/Backend/ForceProviders.php @@ -44,8 +44,8 @@ public function __construct( ScopeConfigInterface $config, TypeListInterface $cacheTypeList, TfaInterface $tfa, - AbstractResource $resource = null, - AbstractDb $resourceCollection = null, + ?AbstractResource $resource = null, + ?AbstractDb $resourceCollection = null, array $data = [] ) { parent::__construct( diff --git a/TwoFactorAuth/Model/Country.php b/TwoFactorAuth/Model/Country.php index b7716965..5c910cf0 100644 --- a/TwoFactorAuth/Model/Country.php +++ b/TwoFactorAuth/Model/Country.php @@ -48,8 +48,8 @@ public function __construct( Registry $registry, DataObjectHelper $dataObjectHelper, CountryInterfaceFactory $countryDataFactory, - AbstractResource $resource = null, - AbstractDb $resourceCollection = null, + ?AbstractResource $resource = null, + ?AbstractDb $resourceCollection = null, array $data = [] ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); diff --git a/TwoFactorAuth/Model/ResourceModel/UserConfig.php b/TwoFactorAuth/Model/ResourceModel/UserConfig.php index 44da7016..9237738c 100644 --- a/TwoFactorAuth/Model/ResourceModel/UserConfig.php +++ b/TwoFactorAuth/Model/ResourceModel/UserConfig.php @@ -36,8 +36,8 @@ class UserConfig extends AbstractDb public function __construct( Context $context, $connectionName = null, - EncryptorInterface $encryptor = null, - SerializerInterface $serializer = null + ?EncryptorInterface $encryptor = null, + ?SerializerInterface $serializer = null ) { parent::__construct($context, $connectionName); $this->encryptor = $encryptor ?: diff --git a/TwoFactorAuth/Model/UserConfig.php b/TwoFactorAuth/Model/UserConfig.php index 47a9aef3..bc0b5438 100644 --- a/TwoFactorAuth/Model/UserConfig.php +++ b/TwoFactorAuth/Model/UserConfig.php @@ -48,8 +48,8 @@ public function __construct( Registry $registry, DataObjectHelper $dataObjectHelper, UserConfigInterfaceFactory $userConfigDataFactory, - AbstractResource $resource = null, - AbstractDb $resourceCollection = null, + ?AbstractResource $resource = null, + ?AbstractDb $resourceCollection = null, array $data = [] ) { parent::__construct($context, $registry, $resource, $resourceCollection, $data); From 98929de65fca9c58508c202292127e8613ad3dd4 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Thu, 12 Dec 2024 18:07:58 +0530 Subject: [PATCH 170/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for unit static and integration tests --- .../Controller/Adminhtml/Duo/Authpost.php | 2 + .../Model/Provider/Engine/DuoSecurity.php | 30 +--------- .../Integration/Block/ChangeProviderTest.php | 12 +++- .../Integration/Block/ConfigureLaterTest.php | 8 ++- .../Controller/Adminhtml/Duo/AuthTest.php | 26 ++++++--- .../Controller/Adminhtml/Duo/AuthpostTest.php | 24 +++++--- .../Adminhtml/Tfa/ConfigureLaterTest.php | 16 ++++-- .../Controller/Adminhtml/Tfa/IndexTest.php | 12 +++- .../ControllerActionPredispatchTest.php | 10 ++++ .../Engine/DuoSecurity/AuthenticateTest.php | 32 +++++++---- .../Engine/DuoSecurity/ConfigureTest.php | 56 ++++++++++++------- .../Model/Provider/Engine/DuoSecurityTest.php | 30 +--------- TwoFactorAuth/etc/adminhtml/di.xml | 5 -- TwoFactorAuth/etc/config.xml | 1 + .../view/adminhtml/web/template/duo/auth.html | 2 +- 15 files changed, 141 insertions(+), 125 deletions(-) diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php index 4c4d6387..702ba663 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php @@ -143,6 +143,8 @@ public function execute() return $this->_redirect('*/*/auth'); } + + return $this->_redirect('*/*/auth'); } /** diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 18e9d1d7..70bb4723 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -10,7 +10,6 @@ use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\DataObject; -use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\UrlInterface; use Magento\User\Api\Data\UserInterface; use Magento\TwoFactorAuth\Api\EngineInterface; @@ -27,21 +26,6 @@ class DuoSecurity implements EngineInterface */ public const CODE = 'duo_security'; // Must be the same as defined in di.xml - /** - * Duo request prefix - */ - public const DUO_PREFIX = 'TX'; - - /** - * Duo auth prefix - */ - public const AUTH_PREFIX = 'AUTH'; - - /** - * Duo auth suffix - */ - public const AUTH_SUFFIX = 'DUOAUTH'; - /** * Configuration XML path for enabled flag */ @@ -92,11 +76,6 @@ class DuoSecurity implements EngineInterface */ private $duoAuth; - /** - * @var EncryptorInterface - */ - private $encryptor; - /** * @var UrlInterface */ @@ -104,7 +83,6 @@ class DuoSecurity implements EngineInterface /** * @param ScopeConfigInterface $scopeConfig - * @param EncryptorInterface $encryptor * @param UrlInterface $urlBuilder * @param Client|null $client * @param DuoAuth|null $duoAuth @@ -112,13 +90,11 @@ class DuoSecurity implements EngineInterface */ public function __construct( ScopeConfigInterface $scopeConfig, - EncryptorInterface $encryptor, UrlInterface $urlBuilder, Client $client = null, DuoAuth $duoAuth = null ) { $this->scopeConfig = $scopeConfig; - $this->encryptor = $encryptor; $this->urlBuilder = $urlBuilder; if ($this->isDuoForcedProvider()) { $this->client = $client ?? new Client( @@ -152,9 +128,7 @@ public function getApiHostname(): string */ private function getClientSecret(): string { - return $this->encryptor->decrypt( - $this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET) - ); + return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_SECRET); } /** @@ -218,7 +192,7 @@ public function verify(UserInterface $user, DataObject $request): bool try { // Not saving token as this is for verification purpose $this->client->exchangeAuthorizationCodeFor2FAResult($duoCode, $username); - } catch (LocalizedException $e) { + } catch (DuoException $e) { return false; } # Exchange happened successfully so render success page diff --git a/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php b/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php index 95507988..149a3bc4 100644 --- a/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php +++ b/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php @@ -72,8 +72,10 @@ protected function setUp(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers authy,duo_security * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testBlockRendersWithActiveProviders(): void @@ -94,8 +96,10 @@ function ($item) { /** * @magentoConfigFixture default/twofactorauth/general/force_providers authy,duo_security * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testBlockRendersWhenCurrentProviderIsActivated(): void @@ -111,8 +115,10 @@ public function testBlockRendersWhenCurrentProviderIsActivated(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers authy,duo_security * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testBlockRendersWhenCurrentProviderIsNotActivated(): void diff --git a/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php b/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php index be1ea6c8..894bd75a 100644 --- a/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php +++ b/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php @@ -83,8 +83,10 @@ public function testGetPostData(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers authy,duo_security * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testBlockRendersWithCurrentInactiveAndOneOtherActive(): void @@ -99,8 +101,10 @@ public function testBlockRendersWithCurrentInactiveAndOneOtherActive(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testBlockDoesntRenderWithCurrentInactiveAndNoOtherActive(): void diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php index 229ceb29..b8d122e4 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php @@ -32,9 +32,11 @@ class AuthTest extends AbstractConfigureBackendController /** * @inheritDoc * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testTokenAccess(): void @@ -45,9 +47,12 @@ public function testTokenAccess(): void /** * @inheritDoc * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/duo_failmode open * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testAclHasAccess() @@ -58,9 +63,12 @@ public function testAclHasAccess() /** * @inheritDoc * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/duo_failmode open * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testAclNoAccess() diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php index bc389d19..acf2495e 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php @@ -41,9 +41,11 @@ protected function setUp(): void /** * @inheritDoc * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testTokenAccess(): void { @@ -55,9 +57,11 @@ public function testTokenAccess(): void /** * @inheritDoc * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testAclHasAccess() { @@ -70,9 +74,11 @@ public function testAclHasAccess() /** * @inheritDoc * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/integration_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/secret_key duo_security - * @magentoConfigFixture default/twofactorauth/duo/api_hostname duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testAclNoAccess() { diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php index 5add6179..fe52b4e6 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php @@ -55,8 +55,10 @@ protected function setUp(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testNotAllowedWhenProviderAlreadyActivated(): void @@ -73,8 +75,10 @@ public function testNotAllowedWhenProviderAlreadyActivated(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testNotAllowedWhenProviderNotActivatedButIsTheOnlyProvider(): void @@ -91,8 +95,10 @@ public function testNotAllowedWhenProviderNotActivatedButIsTheOnlyProvider(): vo /** * @magentoConfigFixture default/twofactorauth/general/force_providers google,duo_security,authy * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testSkippingAProvider(): void @@ -110,8 +116,10 @@ public function testSkippingAProvider(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security,authy * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 */ public function testSkippingAllProvidersWhenThereAreNoneConfigured(): void diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php index 7cba3279..3f7c7233 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php @@ -115,8 +115,10 @@ public function testNotConfiguredWithSkipped(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers google,authy,duo_security * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDbIsolation enabled */ @@ -134,8 +136,10 @@ public function testDefaultProviderIsUsedForAuth(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers google,authy,duo_security * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDbIsolation enabled */ @@ -153,8 +157,10 @@ public function testFirstProviderIsUsedForAuthWithoutADefault(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers google,authy,duo_security * @magentoConfigFixture default/twofactorauth/authy/api_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDbIsolation enabled */ diff --git a/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php b/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php index f2c27962..43e0ad62 100644 --- a/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php +++ b/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php @@ -104,6 +104,11 @@ public function testUnauthenticated(): void * Verify that users would be redirected to "2FA Config Request" page when 2FA is not configured for the app. * * @magentoConfigFixture default/twofactorauth/general/force_providers google,duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @return void */ public function testConfigRequested(): void @@ -134,6 +139,11 @@ public function testUserConfigRequested(): void * Verify that users returning with a token from the E-mail get a new cookie with it. * * @magentoConfigFixture default/twofactorauth/general/force_providers google,duo_security + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @return void */ public function testCookieSet(): void diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php index 4af5fed9..198f32d1 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php @@ -66,9 +66,11 @@ protected function setUp(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testVerifyInvalidCredentials() @@ -88,9 +90,11 @@ public function testVerifyInvalidCredentials() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testVerifyNotConfiguredProvider() @@ -131,9 +135,11 @@ public function testVerifyUnavailableProvider() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testVerifyValidRequest() @@ -170,9 +176,11 @@ public function testVerifyValidRequest() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testVerifyInvalidRequest() diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php index 8379478b..88dcbba9 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php @@ -73,9 +73,11 @@ protected function setUp(): void /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testGetConfigurationDataInvalidTfat() @@ -92,9 +94,11 @@ public function testGetConfigurationDataInvalidTfat() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testGetConfigurationDataAlreadyConfiguredProvider() @@ -131,9 +135,11 @@ public function testGetConfigurationDataUnavailableProvider() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateInvalidTfat() @@ -151,9 +157,11 @@ public function testActivateInvalidTfat() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateAlreadyConfiguredProvider() @@ -192,9 +200,11 @@ public function testActivateUnavailableProvider() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testGetConfigurationDataValidRequest() @@ -217,9 +227,11 @@ public function testGetConfigurationDataValidRequest() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateValidRequest() @@ -242,9 +254,11 @@ public function testActivateValidRequest() /** * @magentoConfigFixture default/twofactorauth/general/force_providers duo_security - * @magentoConfigFixture default/twofactorauth/duo/client_id abc123 - * @magentoConfigFixture default/twofactorauth/duo/api_hostname abc123 - * @magentoConfigFixture default/twofactorauth/duo/client_secret abc123 + * @magentoConfigFixture default/twofactorauth/duo/client_id ABCDEFGHIJKLMNOPQRST + * @magentoConfigFixture default/twofactorauth/duo/client_secret abcdefghijklmnopqrstuvwxyz0123456789abcd + * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 + * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com + * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ public function testActivateInvalidDataThrowsException() diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index c05c77ae..8057e5e5 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -9,9 +9,7 @@ namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine; use Magento\Framework\App\Config\ScopeConfigInterface; -use Magento\Framework\Data\Form\FormKey; use Magento\Framework\DataObject; -use Magento\Framework\Encryption\EncryptorInterface; use Magento\Framework\UrlInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; use Magento\User\Api\Data\UserInterface; @@ -25,15 +23,9 @@ class DuoSecurityTest extends TestCase /** @var MockObject|ScopeConfigInterface */ private $configMock; - /** @var MockObject|EncryptorInterface */ - private $encryptorMock; - /** @var MockObject|UrlInterface */ private $urlMock; - /** @var MockObject|FormKey */ - private $formKeyMock; - /** @var MockObject|Client */ private $clientMock; @@ -51,26 +43,16 @@ protected function setUp(): void ->disableOriginalConstructor() ->getMock(); - $this->encryptorMock = $this->getMockBuilder(EncryptorInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->urlMock = $this->getMockBuilder(UrlInterface::class) ->disableOriginalConstructor() ->getMock(); - $this->formKeyMock = $this->getMockBuilder(FormKey::class) - ->disableOriginalConstructor() - ->getMock(); - $this->clientMock = $this->createMock(Client::class); $this->duoAuthMock = $this->createMock(DuoAuth::class); $this->model = new DuoSecurity( $this->configMock, - $this->encryptorMock, $this->urlMock, - $this->formKeyMock, $this->clientMock, $this->duoAuthMock ); @@ -88,7 +70,6 @@ public static function getIsEnabledTestDataSet(): array 'test.duosecurity.com', 'ABCDEFGHIJKLMNOPQRST', 'abcdefghijklmnopqrstuvwxyz0123456789abcd', - '0:3:pE7QRAv43bvos7oeve+ULjQ1QCoZw0NMXXtHZtYdmlBR4Nb18IpauosSz1jKFYjo1nPCsOwHk1mOlFpGObrzpSb3zF0=', 'google,duo_security,authy', true ] @@ -108,8 +89,7 @@ public static function getIsEnabledTestDataSet(): array public function testIsEnabled( ?string $apiHostname, ?string $clientId, - ?string $encryptedClientSecret, - ?string $decryptedClientSecret, + ?string $clientSecret, string $forceProviders, bool $expected ): void { @@ -117,17 +97,11 @@ public function testIsEnabled( [ [DuoSecurity::XML_PATH_API_HOSTNAME, 'default', null, $apiHostname], [DuoSecurity::XML_PATH_CLIENT_ID, 'default', null, $clientId], - [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $encryptedClientSecret], + [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $clientSecret], ['twofactorauth/general/force_providers', 'default', null, $forceProviders] ] ); - // Mocking EncryptorInterface - $this->encryptorMock->expects($this->any()) - ->method('decrypt') - ->with($encryptedClientSecret) - ->willReturn($decryptedClientSecret); - $this->assertEquals($expected, $this->model->isEnabled()); } } diff --git a/TwoFactorAuth/etc/adminhtml/di.xml b/TwoFactorAuth/etc/adminhtml/di.xml index 6db37fd6..bcb1a8dc 100644 --- a/TwoFactorAuth/etc/adminhtml/di.xml +++ b/TwoFactorAuth/etc/adminhtml/di.xml @@ -21,9 +21,4 @@ <type name="Magento\Backend\Model\Auth"> <plugin name="delete_tfat_cookie" type="Magento\TwoFactorAuth\Plugin\DeleteCookieOnLogout"/> </type> - <type name="Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity"> - <arguments> - <argument name="duoSignaturePrefix" xsi:type="const">Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity::DUO_PREFIX</argument> - </arguments> - </type> </config> diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index e9652550..5c4cb5a6 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -19,6 +19,7 @@ <api_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </authy> <duo> + <client_secret backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> <secret_key backend_model="Magento\Config\Model\Config\Backend\Encrypted"/> </duo> <google> diff --git a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html index 3c518196..1e889877 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html @@ -3,7 +3,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ - --> +--> <div> <form> <fieldset class="admin__fieldset"> From 12ad392b55933d51beba24d1ef14de12effb398f Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 13 Dec 2024 17:26:18 +0530 Subject: [PATCH 171/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for unit static and integration tests --- TwoFactorAuth/Block/Provider/Duo/Auth.php | 28 ++++-------- .../Model/Provider/Engine/DuoSecurity.php | 44 ++++++++++++++++--- .../Controller/Adminhtml/Duo/AuthTest.php | 4 +- .../Adminhtml/Tfa/ConfigureLaterTest.php | 4 +- .../Controller/Adminhtml/Tfa/IndexTest.php | 2 +- .../view/adminhtml/web/template/duo/auth.html | 2 +- 6 files changed, 54 insertions(+), 30 deletions(-) diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 02cfd2e5..46fccd2e 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -59,23 +59,6 @@ public function __construct( */ public function getJsLayout() { - $duoFailMode = $this->duoSecurity->getDuoFailmode(); - try { - $this->duoSecurity->healthCheck(); - } catch (LocalizedException $e) { - if ($duoFailMode === "OPEN") { - $this->messageManager->addSuccessMessage( - __("Login 'Successful', but 2FA Not Performed. Confirm Duo client/secret/host values are correct") - ); - return $this->_url->getUrl('adminhtml/dashboard'); - } else { - $this->messageManager->addErrorMessage( - __("2FA Unavailable. Confirm Duo client/secret/host values are correct") - ); - return $this->_url->getUrl('adminhtml'); - } - } - $user = $this->session->getUser(); if (!$user) { throw new LocalizedException(__('User session not found.')); @@ -83,8 +66,15 @@ public function getJsLayout() $username = $user->getUserName(); $state = $this->duoSecurity->generateDuoState(); $this->session->setDuoState($state); - $prompt_uri = $this->duoSecurity->initiateAuth($username, $state); - $this->jsLayout['components']['tfa-auth']['authUrl'] = $prompt_uri; + $response = $this->duoSecurity->initiateAuth($username, $state); + + if ($response['status'] == 'open') { + $this->messageManager->addErrorMessage($response['message']); + } elseif ($response['status'] == 'closed') { + $this->messageManager->addErrorMessage($response['message']); + } + + $this->jsLayout['components']['tfa-auth']['authUrl'] = $response['redirect_url']; return parent::getJsLayout(); } } diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 70bb4723..79fb802b 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -8,6 +8,7 @@ namespace Magento\TwoFactorAuth\Model\Provider\Engine; +use Duo\DuoUniversal\DuoException; use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\DataObject; use Magento\Framework\UrlInterface; @@ -182,7 +183,12 @@ private function getSkey(): string } /** - * @inheritDoc + * Verify the user + * + * @param UserInterface $user + * @param DataObject $request + * @return bool + * @throws \Duo\DuoUniversal\DuoException */ public function verify(UserInterface $user, DataObject $request): bool { @@ -226,15 +232,43 @@ public function isEnabled(): bool } /** - * Generate URI to redirect to for the Duo Universal prompt. + * Initiate authentication with Duo Universal Prompt * * @param string $username * @param string $state - * @return string + * @return array + * @throws \Duo\DuoUniversal\DuoException */ - public function initiateAuth($username, string $state): string + public function initiateAuth($username, string $state): array { - return $this->client->createAuthUrl($username, $state); + $duoFailMode = $this->getDuoFailmode(); + try { + $this->healthCheck(); + } catch (DuoException $e) { + if ($duoFailMode === "OPEN") { + return [ + 'status' => 'open', + 'redirect_url' => '', + 'message' => __( + "Login 'applicable', + but 2FA Not Performed. Switch to other 2FA Provider. + Confirm Duo client/secret/host values are correct" + ) + ]; + } else { + return [ + 'status' => 'closed', + 'redirect_url' => '', + 'message' => __("2FA Unavailable. Confirm Duo client/secret/host values are correct") + ]; + } + } + + return [ + 'status' => 'success', + 'redirect_url' => $this->client->createAuthUrl($username, $state), + 'message' => __('Duo Auth URL created successfully.') + ]; } /** diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php index b8d122e4..eef4544d 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php @@ -20,12 +20,12 @@ class AuthTest extends AbstractConfigureBackendController { /** - * @inheritDoc + * @var string */ protected $uri = 'backend/tfa/duo/auth'; /** - * @inheritDoc + * @var string */ protected $httpMethod = Request::METHOD_GET; diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php index fe52b4e6..03a0268c 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php @@ -21,12 +21,12 @@ class ConfigureLaterTest extends AbstractBackendController { /** - * @inheritDoc + * @var string */ protected $uri = 'backend/tfa/tfa/configurelater'; /** - * @inheritDoc + * @var string */ protected $resource = 'Magento_TwoFactorAuth::tfa'; diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php index 3f7c7233..47b6bed3 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php @@ -26,7 +26,7 @@ class IndexTest extends AbstractBackendController { /** - * @inheritDoc + * @var string */ protected $uri = 'backend/tfa/tfa/index'; diff --git a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html index 1e889877..bc74a987 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html @@ -8,7 +8,7 @@ <form> <fieldset class="admin__fieldset"> <legend class="admin__legend"><span translate="'2FA - Duo Security'"></span></legend> - <br/> + <br> <button type="button" data-bind="click: redirectToAuthUrl, afterRender: onAfterRender"> Go to Duo Universal Prompt </button> From 006ef91c5b4d85d80d08aa1666868112ec7df36b Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 13 Dec 2024 18:09:51 +0530 Subject: [PATCH 172/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for copyright year and text --- TwoFactorAuth/Api/DuoAuthenticateInterface.php | 2 +- TwoFactorAuth/Api/DuoConfigureInterface.php | 2 +- .../Block/Adminhtml/System/Config/Providers.php | 2 +- TwoFactorAuth/Block/Provider/Duo/Auth.php | 2 +- .../Controller/Adminhtml/Duo/Authpost.php | 2 +- .../Model/Provider/Engine/DuoSecurity.php | 2 +- .../Engine/DuoSecurity/Authenticate.php | 2 +- .../Provider/Engine/DuoSecurity/Configure.php | 17 +++++++++++------ .../Setup/Patch/Data/EncryptSecrets.php | 2 +- .../Integration/Block/ChangeProviderTest.php | 4 ++-- .../Integration/Block/ConfigureLaterTest.php | 4 ++-- .../Controller/Adminhtml/Duo/AuthTest.php | 2 +- .../Controller/Adminhtml/Duo/AuthpostTest.php | 2 +- .../Adminhtml/Tfa/ConfigureLaterTest.php | 4 ++-- .../Controller/Adminhtml/Tfa/IndexTest.php | 4 ++-- .../ControllerActionPredispatchTest.php | 4 ++-- .../Engine/DuoSecurity/AuthenticateTest.php | 2 +- .../Engine/DuoSecurity/ConfigureTest.php | 2 +- .../Model/Provider/Engine/DuoSecurityTest.php | 2 +- TwoFactorAuth/etc/adminhtml/di.xml | 4 ++-- TwoFactorAuth/etc/adminhtml/system.xml | 2 +- TwoFactorAuth/etc/config.xml | 2 +- TwoFactorAuth/etc/di.xml | 2 +- TwoFactorAuth/etc/webapi.xml | 2 +- TwoFactorAuth/view/adminhtml/web/js/duo/auth.js | 2 +- .../adminhtml/web/js/system/config/providers.js | 4 ++-- .../view/adminhtml/web/template/duo/auth.html | 2 +- 27 files changed, 44 insertions(+), 39 deletions(-) diff --git a/TwoFactorAuth/Api/DuoAuthenticateInterface.php b/TwoFactorAuth/Api/DuoAuthenticateInterface.php index c1d0f862..88ec3e02 100644 --- a/TwoFactorAuth/Api/DuoAuthenticateInterface.php +++ b/TwoFactorAuth/Api/DuoAuthenticateInterface.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index 18fb068f..2bd1b7df 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php index 070f2042..86f9370a 100644 --- a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php +++ b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 46fccd2e..2931658b 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php index 702ba663..bc46deed 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 79fb802b..3d383b2e 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php index c7266826..38a4b55c 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index 68106412..bf00da5c 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ @@ -67,15 +67,20 @@ public function getConfigurationData(string $tfaToken) /** * @inheritDoc + * @throws \LocalizedException */ public function activate(string $tfaToken): void { - $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); - $userId = (int)$user->getId(); + try { + $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); + $userId = (int)$user->getId(); - if ($this->duo->assertUserIsValid($user->getUserName()) == "auth") { - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($userId); + if ($this->duo->assertUserIsValid($user->getUserName()) == "auth") { + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->activate($userId); + } + } catch (\Exception $e) { + throw new \LocalizedException(__('Could not activate Duo Security provider.')); } } } diff --git a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php index 2d8d2443..a070ca62 100644 --- a/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php +++ b/TwoFactorAuth/Setup/Patch/Data/EncryptSecrets.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php b/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php index 149a3bc4..d578c6b1 100644 --- a/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php +++ b/TwoFactorAuth/Test/Integration/Block/ChangeProviderTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php b/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php index 894bd75a..519f9315 100644 --- a/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php +++ b/TwoFactorAuth/Test/Integration/Block/ConfigureLaterTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php index eef4544d..8fb8643c 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php index acf2495e..8d89085b 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthpostTest.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php index 03a0268c..40a27379 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureLaterTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php index 47b6bed3..ae0d5aa1 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/IndexTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php b/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php index 43e0ad62..f7cc5d14 100644 --- a/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php +++ b/TwoFactorAuth/Test/Integration/ControllerActionPredispatchTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php index 198f32d1..a24c5a26 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php index 88dcbba9..87c84976 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index 8057e5e5..062564f4 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/etc/adminhtml/di.xml b/TwoFactorAuth/etc/adminhtml/di.xml index bcb1a8dc..6a59a48c 100644 --- a/TwoFactorAuth/etc/adminhtml/di.xml +++ b/TwoFactorAuth/etc/adminhtml/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index c408290a..430be2ae 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index 5c4cb5a6..c8c56bc6 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/TwoFactorAuth/etc/di.xml b/TwoFactorAuth/etc/di.xml index 817cd79b..6e743e9a 100644 --- a/TwoFactorAuth/etc/di.xml +++ b/TwoFactorAuth/etc/di.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/TwoFactorAuth/etc/webapi.xml b/TwoFactorAuth/etc/webapi.xml index 0dcbc347..30765c99 100644 --- a/TwoFactorAuth/etc/webapi.xml +++ b/TwoFactorAuth/etc/webapi.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js index 59f1b2b7..1f929baa 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js @@ -1,5 +1,5 @@ /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ diff --git a/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js b/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js index e214db21..75b6e3e3 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js +++ b/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html index bc74a987..b8203420 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/duo/auth.html @@ -1,6 +1,6 @@ <!-- /** - * Copyright 2024 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> From 180c6467381269920cf1c8e2a5411116e1b15a0c Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 13 Dec 2024 22:56:06 +0530 Subject: [PATCH 173/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for static issues --- .../Provider/Engine/DuoSecurity/Configure.php | 15 +++++---------- .../Provider/Engine/DuoSecurity/ConfigureTest.php | 13 ++++++------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index bf00da5c..1225a94d 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -67,20 +67,15 @@ public function getConfigurationData(string $tfaToken) /** * @inheritDoc - * @throws \LocalizedException */ public function activate(string $tfaToken): void { - try { - $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); - $userId = (int)$user->getId(); + $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); + $userId = (int)$user->getId(); - if ($this->duo->assertUserIsValid($user->getUserName()) == "auth") { - $this->tfa->getProviderByCode(DuoSecurity::CODE) - ->activate($userId); - } - } catch (\Exception $e) { - throw new \LocalizedException(__('Could not activate Duo Security provider.')); + if ($this->duo->assertUserIsValid($user->getUserName()) == "auth") { + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->activate($userId); } } } diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php index 87c84976..8923c774 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php @@ -269,13 +269,12 @@ public function testActivateInvalidDataThrowsException() $userId = $this->getUserId(); $tfat = $this->tokenManager->issueFor($userId); - $this->duo->method('assertUserIsValid') - ->with($this->callback(function ($username) use ($userId) { - // Assuming $username corresponds to a user object or username string. - // Replace 'getUserById' with the relevant logic for obtaining the username - $user = $this->userFactory->create()->load($userId); - return $username === $user->getUserName(); - })) + $userName = 'adminUser'; + + $this->duo + ->expects($this->once()) + ->method('assertUserIsValid') + ->with($userName) ->willThrowException(new \InvalidArgumentException('Something')); // Call activate without a signature, as per your updated logic From 874f99d148c8d40a8f807cbc23ed30e94e3d00a0 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 17 Dec 2024 14:38:51 +0530 Subject: [PATCH 174/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for static issues --- .../Model/Provider/Engine/DuoSecurity/AuthenticateTest.php | 3 +-- .../Model/Provider/Engine/DuoSecurity/ConfigureTest.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php index a24c5a26..0a52d0c3 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php @@ -10,7 +10,6 @@ use Magento\Framework\App\ObjectManager; use Magento\TestFramework\Bootstrap; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; use Magento\TwoFactorAuth\Api\TfaInterface; use Magento\TwoFactorAuth\Api\UserConfigTokenManagerInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; @@ -52,10 +51,10 @@ class AuthenticateTest extends TestCase protected function setUp(): void { $objectManager = ObjectManager::getInstance(); - $this->userFactory = $objectManager->get(UserFactory::class); $this->tokenManager = $objectManager->get(UserConfigTokenManagerInterface::class); $this->tfa = $objectManager->get(TfaInterface::class); $this->duo = $this->createMock(DuoSecurity::class); + $this->userFactory = $objectManager->get(UserFactory::class); $this->model = $objectManager->create( Authenticate::class, [ diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php index 8923c774..b819f5de 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php @@ -9,7 +9,6 @@ namespace Magento\TwoFactorAuth\Test\Integration\Model\Provider\Engine\DuoSecurity; use Magento\Framework\App\ObjectManager; -use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; use Magento\TwoFactorAuth\Api\TfaInterface; use Magento\TwoFactorAuth\Api\UserConfigTokenManagerInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; @@ -57,10 +56,10 @@ class ConfigureTest extends TestCase protected function setUp(): void { $objectManager = ObjectManager::getInstance(); - $this->userFactory = $objectManager->get(UserFactory::class); $this->tokenManager = $objectManager->get(UserConfigTokenManagerInterface::class); $this->tfa = $objectManager->get(TfaInterface::class); $this->duo = $this->createMock(DuoSecurity::class); + $this->userFactory = $objectManager->get(UserFactory::class); $this->authenticate = $this->createMock(Authenticate::class); $this->model = $objectManager->create( Configure::class, From 69e0a83bf72a6afad96a49d45338dff7f033d45b Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Tue, 17 Dec 2024 18:26:15 +0530 Subject: [PATCH 175/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for static errors with JS files --- .../view/adminhtml/web/js/duo/auth.js | 3 ++- .../web/js/system/config/providers.js | 23 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js index 1f929baa..1b68df1c 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/duo/auth.js @@ -24,6 +24,7 @@ define([ redirectToAuthUrl: function () { var redirectUrl = this.getAuthUrl(); + if (redirectUrl) { window.location.href = redirectUrl; } @@ -33,7 +34,7 @@ define([ * After the element is rendered, bind the authUrl (optional) */ onAfterRender: function () { - var authUrl = this.getAuthUrl(); + // Not Required } }); }); diff --git a/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js b/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js index 75b6e3e3..aa10cd58 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js +++ b/TwoFactorAuth/view/adminhtml/web/js/system/config/providers.js @@ -12,21 +12,12 @@ define([ 'use strict'; return function (config, element) { + var $element = $(element), initialValue = $element.val(), duoProviderValue = config.duoProviderValue, duoFields = config.duoFields; - $element.on('change', function () { - var selectedValues = $element.val() || []; - - if (selectedValues.includes(duoProviderValue)) { - addRequiredAttributes(duoFields); - } else { - removeRequiredAttributes(duoFields); - } - }); - /** * Adds the "required" attribute to each Duo field * @@ -35,6 +26,7 @@ define([ function addRequiredAttributes(fields) { fields.forEach(function (fieldId) { var $field = $('#' + fieldId); + if ($field.length) { $field.attr('required', 'required'); $field.addClass('required-entry'); @@ -50,6 +42,7 @@ define([ function removeRequiredAttributes(fields) { fields.forEach(function (fieldId) { var $field = $('#' + fieldId); + if ($field.length) { $field.removeAttr('required'); $field.removeClass('required-entry'); @@ -57,6 +50,16 @@ define([ }); } + $element.on('change', function () { + var selectedValues = $element.val() || []; + + if (selectedValues.includes(duoProviderValue)) { + addRequiredAttributes(duoFields); + } else { + removeRequiredAttributes(duoFields); + } + }); + element.on('blur', function () { var currentValue = $element.val(); From ad8b77ca656c949b104d3dc41283c1c633116de8 Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Wed, 18 Dec 2024 16:44:47 +0530 Subject: [PATCH 176/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaValidation/composer.json | 8 +++++++- _metapackage/composer.json | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index 421fae4d..cc355c14 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -1,11 +1,17 @@ { "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:phpfui/recaptcha.git" + } + ], "require": { "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", - "google/recaptcha": "^1.2" + "google/recaptcha": "dev-PHP84" }, "type": "magento2-module", "license": "OSL-3.0", diff --git a/_metapackage/composer.json b/_metapackage/composer.json index 91885e9c..9fb453db 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -2,6 +2,12 @@ "name": "magento/security-package", "description": "Magento Security Package", "type": "metapackage", + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:phpfui/recaptcha.git" + } + ], "require": { "magento/module-re-captcha-admin-ui": "*", "magento/module-re-captcha-checkout": "*", @@ -28,7 +34,7 @@ "magento/module-re-captcha-webapi-ui": "*", "magento/module-securitytxt": "*", "magento/module-two-factor-auth": "*", - "google/recaptcha": "^1.2", + "google/recaptcha": "dev-PHP84", "magento/module-re-captcha-checkout-sales-rule": "*" } } From 16927e1266a103ee26ff8390633f822af8eba41f Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Thu, 19 Dec 2024 17:05:37 +0530 Subject: [PATCH 177/208] version endroid/qr-code updated --- TwoFactorAuth/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TwoFactorAuth/composer.json b/TwoFactorAuth/composer.json index cfc4b8be..7348db02 100644 --- a/TwoFactorAuth/composer.json +++ b/TwoFactorAuth/composer.json @@ -14,7 +14,7 @@ "magento/module-integration": "*", "christian-riesen/base32": "^1.3", "spomky-labs/otphp": "^11.2", - "endroid/qr-code": "^4.3.5", + "endroid/qr-code": "^6.0.3", "2tvenom/cborencode": "^1.0" }, "type": "magento2-module", From f912e0bb9863a0d42b96e64c8ff21ba39daf47bb Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Thu, 19 Dec 2024 20:13:26 +0530 Subject: [PATCH 178/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for SVC failures --- TwoFactorAuth/Api/Data/DuoDataInterface.php | 97 +++++++++++++++++++ .../Api/DuoAuthenticateInterface.php | 39 +++++++- TwoFactorAuth/Api/DuoConfigureInterface.php | 34 ++++++- .../Data/Provider/Engine/DuoSecurity/Data.php | 85 ++++++++++++++++ .../Engine/DuoSecurity/Authenticate.php | 82 +++++++++++++++- .../Provider/Engine/DuoSecurity/Configure.php | 44 ++++++++- TwoFactorAuth/etc/webapi.xml | 6 +- 7 files changed, 373 insertions(+), 14 deletions(-) create mode 100644 TwoFactorAuth/Api/Data/DuoDataInterface.php create mode 100644 TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php diff --git a/TwoFactorAuth/Api/Data/DuoDataInterface.php b/TwoFactorAuth/Api/Data/DuoDataInterface.php new file mode 100644 index 00000000..0d3b4731 --- /dev/null +++ b/TwoFactorAuth/Api/Data/DuoDataInterface.php @@ -0,0 +1,97 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\TwoFactorAuth\Api\Data; + +use Magento\Framework\Api\ExtensibleDataInterface; + +/** + * Represents the data needed to use duo + * + * @deprecated This interface is no longer used. + * @see none + * @api + */ +interface DuoDataInterface extends ExtensibleDataInterface +{ + /** + * Signature field name + * + * @deprecated + * @see none + */ + public const SIGNATURE = 'signature'; + + /** + * Api host field name + * + * @deprecated + * @see none + */ + public const API_HOSTNAME = 'api_hostname'; + + /** + * Get the signature + * + * @deprecated + * @see none + * @return string + */ + public function getSignature(): string; + + /** + * Set the signature + * + * @deprecated + * @see none + * @param string $value + * @return void + */ + public function setSignature(string $value): void; + + /** + * Set the api hostname + * + * @deprecated + * @see none + * @param string $value + * @return void + */ + public function setApiHostname(string $value): void; + + /** + * Get the api hostname + * + * @deprecated + * @see none + * @return string + */ + public function getApiHostname(): string; + + /** + * Retrieve existing extension attributes object or create a new one + * + * Used fully qualified namespaces in annotations for proper work of extension interface/class code generation + * + * @deprecated + * @see none + * @return \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface|null + */ + public function getExtensionAttributes(): ?DuoDataExtensionInterface; + + /** + * Set an extension attributes object + * + * @deprecated + * @see none + * @param \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface $extensionAttributes + * @return void + */ + public function setExtensionAttributes( + DuoDataExtensionInterface $extensionAttributes + ): void; +} diff --git a/TwoFactorAuth/Api/DuoAuthenticateInterface.php b/TwoFactorAuth/Api/DuoAuthenticateInterface.php index 88ec3e02..d5fd199b 100644 --- a/TwoFactorAuth/Api/DuoAuthenticateInterface.php +++ b/TwoFactorAuth/Api/DuoAuthenticateInterface.php @@ -1,13 +1,15 @@ <?php /** - * Copyright 2020 Adobe - * All Rights Reserved. + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; +use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; + /** * Represents authentication for the duo security provider * @@ -15,15 +17,46 @@ */ interface DuoAuthenticateInterface { + /** + * Get the information required to configure duo + * + * @deprecated this method is deprecated and will be removed in a future release. + * @see none + * @param string $username + * @param string $password + * @return \Magento\TwoFactorAuth\Api\Data\DuoDataInterface + */ + public function getAuthenticateData( + string $username, + string $password + ): DuoDataInterface; + /** * Authenticate and get an admin token * + * @deprecated this method is deprecated and will be removed in a future release. + * @see createAdminAccessTokenWithCredentialsAndPasscode + * * @param string $username * @param string $password - * @param string $passcode + * @param string $signatureResponse * @return string */ public function createAdminAccessTokenWithCredentials( + string $username, + string $password, + string $signatureResponse + ): string; + + /** + * Authenticate and get an admin token with passcode + * + * @param string $username + * @param string $password + * @param string $passcode + * @return string + */ + public function createAdminAccessTokenWithCredentialsAndPasscode( string $username, string $password, string $passcode diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index 2bd1b7df..17e9c8fd 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -1,13 +1,15 @@ <?php /** - * Copyright 2020 Adobe - * All Rights Reserved. + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. */ declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; +use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; + /** * Represents configuration for the duo security provider * @@ -15,13 +17,37 @@ */ interface DuoConfigureInterface { + /** + * Get the information required to configure duo + * + * @deprecated this method is deprecated and will be removed in a future release. + * @see getDuoConfigurationData + * + * @param string $tfaToken + * @return \Magento\TwoFactorAuth\Api\Data\DuoDataInterface + */ + public function getConfigurationData( + string $tfaToken + ): DuoDataInterface; + + /** + * Activate the provider and get an admin token + * + * @deprecated this method is deprecated and will be removed in a future release. + * @see duoActivate + * @param string $tfaToken + * @param string $signatureResponse + * @return void + */ + public function activate(string $tfaToken, string $signatureResponse): void; + /** * Configure duo for first time user * * @param string $tfaToken * @return void */ - public function getConfigurationData( + public function getDuoConfigurationData( string $tfaToken ); @@ -31,5 +57,5 @@ public function getConfigurationData( * @param string $tfaToken * @return void */ - public function activate(string $tfaToken): void; + public function duoActivate(string $tfaToken): void; } diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php new file mode 100644 index 00000000..1ffd9f51 --- /dev/null +++ b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php @@ -0,0 +1,85 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\TwoFactorAuth\Model\Data\Provider\Engine\DuoSecurity; + +use Magento\Framework\Model\AbstractExtensibleModel; +use Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface; + +/** + * This class was originally implementing Magento\TwoFactorAuth\Api\Data\DuoDataInterface. + * It no longer implements the interface but maintains backward compatibility. + * Represents the data needed to authenticate with duo + */ +class Data extends AbstractExtensibleModel +{ + /** + * Signature field name + */ + public const SIGNATURE = 'signature'; + + /** + * Api host field name + */ + public const API_HOSTNAME = 'api_hostname'; + + /** + * @inheritDoc + */ + public function getSignature(): string + { + return (string)$this->getData(self::SIGNATURE); + } + + /** + * @inheritDoc + */ + public function setSignature(string $value): void + { + $this->setData(self::SIGNATURE, $value); + } + + /** + * @inheritDoc + */ + public function getApiHostname(): string + { + return (string)$this->getData(self::API_HOSTNAME); + } + + /** + * @inheritDoc + */ + public function setApiHostname(string $value): void + { + $this->setData(self::API_HOSTNAME, $value); + } + + /** + * Retrieve existing extension attributes object or create a new one + * + * Used fully qualified namespaces in annotations for proper work of extension interface/class code generation + * + * @return \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface|null + */ + public function getExtensionAttributes(): ?DuoDataExtensionInterface + { + return $this->getData(self::EXTENSION_ATTRIBUTES_KEY); + } + + /** + * Set an extension attributes object + * + * @param \Magento\TwoFactorAuth\Api\Data\DuoDataExtensionInterface $extensionAttributes + * @return void + */ + public function setExtensionAttributes(DuoDataExtensionInterface $extensionAttributes): void + { + $this->setData(self::EXTENSION_ATTRIBUTES_KEY, $extensionAttributes); + } +} diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php index 38a4b55c..ae1eec00 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Authenticate.php @@ -12,6 +12,8 @@ use Magento\Framework\Exception\AuthenticationException; use Magento\Framework\Exception\LocalizedException; use Magento\Integration\Api\AdminTokenServiceInterface; +use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; +use Magento\TwoFactorAuth\Api\Data\DuoDataInterfaceFactory; use Magento\TwoFactorAuth\Api\DuoAuthenticateInterface; use Magento\TwoFactorAuth\Model\AlertInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; @@ -44,6 +46,11 @@ class Authenticate implements DuoAuthenticateInterface */ private $adminTokenService; + /** + * @var DuoDataInterfaceFactory + */ + private $dataFactory; + /** * @var DataObjectFactory */ @@ -59,6 +66,7 @@ class Authenticate implements DuoAuthenticateInterface * @param AlertInterface $alert * @param DuoSecurity $duo * @param AdminTokenServiceInterface $adminTokenService + * @param DuoDataInterfaceFactory $dataFactory * @param DataObjectFactory $dataObjectFactory * @param UserAuthenticator $userAuthenticator */ @@ -67,6 +75,7 @@ public function __construct( AlertInterface $alert, DuoSecurity $duo, AdminTokenServiceInterface $adminTokenService, + DuoDataInterfaceFactory $dataFactory, DataObjectFactory $dataObjectFactory, UserAuthenticator $userAuthenticator ) { @@ -74,14 +83,83 @@ public function __construct( $this->alert = $alert; $this->duo = $duo; $this->adminTokenService = $adminTokenService; + $this->dataFactory = $dataFactory; $this->dataObjectFactory = $dataObjectFactory; $this->userAuthenticator = $userAuthenticator; } + /** + * @inheritDoc + */ + public function getAuthenticateData(string $username, string $password): DuoDataInterface + { + $this->adminTokenService->createAdminAccessToken($username, $password); + + $user = $this->getUser($username); + $this->userAuthenticator->assertProviderIsValidForUser((int)$user->getId(), DuoSecurity::CODE); + + return $this->dataFactory->create( + [ + 'data' => [ + DuoDataInterface::API_HOSTNAME => $this->duo->getApiHostname(), + DuoDataInterface::SIGNATURE => $this->duo->getRequestSignature($user) + ] + ] + ); + } + /** * @inheritDoc */ public function createAdminAccessTokenWithCredentials( + string $username, + string $password, + string $signatureResponse + ): string { + $token = $this->adminTokenService->createAdminAccessToken($username, $password); + + $user = $this->getUser($username); + $this->userAuthenticator->assertProviderIsValidForUser((int)$user->getId(), DuoSecurity::CODE); + + $this->assertResponseIsValid($user, $signatureResponse); + + return $token; + } + + /** + * Assert that the given signature is valid for the user + * + * @deprecated This method is deprecated and will be removed in a future release. + * @see assertResponseIsValidForPasscode + * @param UserInterface $user + * @param string $signatureResponse + * @throws LocalizedException + */ + public function assertResponseIsValid(UserInterface $user, string $signatureResponse): void + { + $data = $this->dataObjectFactory->create( + [ + 'data' => [ + 'sig_response' => $signatureResponse + ] + ] + ); + if (!$this->duo->verify($user, $data)) { + $this->alert->event( + 'Magento_TwoFactorAuth', + 'DuoSecurity invalid auth', + AlertInterface::LEVEL_WARNING, + $user->getUserName() + ); + + throw new LocalizedException(__('Invalid response')); + } + } + + /** + * @inheritDoc + */ + public function createAdminAccessTokenWithCredentialsAndPasscode( string $username, string $password, string $passcode @@ -91,7 +169,7 @@ public function createAdminAccessTokenWithCredentials( $user = $this->getUser($username); $this->userAuthenticator->assertProviderIsValidForUser((int)$user->getId(), DuoSecurity::CODE); - $this->assertResponseIsValid($user, $username, $passcode); + $this->assertResponseIsValidForPasscode($user, $username, $passcode); return $token; } @@ -105,7 +183,7 @@ public function createAdminAccessTokenWithCredentials( * @return void * @throws LocalizedException */ - public function assertResponseIsValid(UserInterface $user, $username, string $passcode): void + public function assertResponseIsValidForPasscode(UserInterface $user, $username, string $passcode): void { $duoAuthResponse = $this->duo->authorizeUser($username, "passcode", ['passcode' => $passcode]); if ($duoAuthResponse['status'] !== 'allow') { diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php index 1225a94d..0069c404 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity/Configure.php @@ -8,6 +8,8 @@ namespace Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; +use Magento\TwoFactorAuth\Api\Data\DuoDataInterface; +use Magento\TwoFactorAuth\Api\Data\DuoDataInterfaceFactory; use Magento\TwoFactorAuth\Api\DuoConfigureInterface; use Magento\TwoFactorAuth\Api\TfaInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; @@ -28,6 +30,11 @@ class Configure implements DuoConfigureInterface */ private $duo; + /** + * @var DuoDataInterfaceFactory + */ + private $dataFactory; + /** * @var TfaInterface */ @@ -41,17 +48,20 @@ class Configure implements DuoConfigureInterface /** * @param UserAuthenticator $userAuthenticator * @param DuoSecurity $duo + * @param DuoDataInterfaceFactory $dataFactory * @param TfaInterface $tfa * @param Authenticate $authenticate */ public function __construct( UserAuthenticator $userAuthenticator, DuoSecurity $duo, + DuoDataInterfaceFactory $dataFactory, TfaInterface $tfa, Authenticate $authenticate ) { $this->userAuthenticator = $userAuthenticator; $this->duo = $duo; + $this->dataFactory = $dataFactory; $this->tfa = $tfa; $this->authenticate = $authenticate; } @@ -59,7 +69,37 @@ public function __construct( /** * @inheritDoc */ - public function getConfigurationData(string $tfaToken) + public function getConfigurationData(string $tfaToken): DuoDataInterface + { + $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); + + return $this->dataFactory->create( + [ + 'data' => [ + DuoDataInterface::API_HOSTNAME => $this->duo->getApiHostname(), + DuoDataInterface::SIGNATURE => $this->duo->getRequestSignature($user) + ] + ] + ); + } + + /** + * @inheritDoc + */ + public function activate(string $tfaToken, string $signatureResponse): void + { + $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); + $userId = (int)$user->getId(); + + $this->authenticate->assertResponseIsValid($user, $signatureResponse); + $this->tfa->getProviderByCode(DuoSecurity::CODE) + ->activate($userId); + } + + /** + * @inheritDoc + */ + public function getDuoConfigurationData(string $tfaToken) { $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); return $this->duo->enrollNewUser($user->getUserName(), 60); @@ -68,7 +108,7 @@ public function getConfigurationData(string $tfaToken) /** * @inheritDoc */ - public function activate(string $tfaToken): void + public function duoActivate(string $tfaToken): void { $user = $this->userAuthenticator->authenticateWithTokenAndProvider($tfaToken, DuoSecurity::CODE); $userId = (int)$user->getId(); diff --git a/TwoFactorAuth/etc/webapi.xml b/TwoFactorAuth/etc/webapi.xml index 30765c99..e9ab31e7 100644 --- a/TwoFactorAuth/etc/webapi.xml +++ b/TwoFactorAuth/etc/webapi.xml @@ -163,21 +163,21 @@ </route> <route url="/V1/tfa/provider/duo_security/configure" method="POST"> - <service class="Magento\TwoFactorAuth\Api\DuoConfigureInterface" method="getConfigurationData"/> + <service class="Magento\TwoFactorAuth\Api\DuoConfigureInterface" method="getDuoConfigurationData"/> <resources> <resource ref="anonymous" /> </resources> </route> <route url="/V1/tfa/provider/duo_security/activate" method="POST"> - <service class="Magento\TwoFactorAuth\Api\DuoConfigureInterface" method="activate"/> + <service class="Magento\TwoFactorAuth\Api\DuoConfigureInterface" method="duoActivate"/> <resources> <resource ref="anonymous" /> </resources> </route> <route url="/V1/tfa/provider/duo_security/authenticate" method="POST"> - <service class="Magento\TwoFactorAuth\Api\DuoAuthenticateInterface" method="createAdminAccessTokenWithCredentials"/> + <service class="Magento\TwoFactorAuth\Api\DuoAuthenticateInterface" method="createAdminAccessTokenWithCredentialsAndPasscode"/> <resources> <resource ref="anonymous" /> </resources> From 6f98563aa1fac5829be4ed855c0d4edbb766ebab Mon Sep 17 00:00:00 2001 From: Bhavin Parmar <cod62627@adobe.com> Date: Fri, 20 Dec 2024 16:16:39 +0530 Subject: [PATCH 179/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- .../Model/Provider/Engine/Google.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/Google.php b/TwoFactorAuth/Model/Provider/Engine/Google.php index 415f501d..20ddcf52 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Google.php +++ b/TwoFactorAuth/Model/Provider/Engine/Google.php @@ -10,8 +10,10 @@ use Base32\Base32; use Endroid\QrCode\Color\Color; use Endroid\QrCode\Encoding\Encoding; +use Endroid\QrCode\ErrorCorrectionLevel; use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelHigh; use Endroid\QrCode\QrCode; +use Endroid\QrCode\RoundBlockSizeMode; use Endroid\QrCode\Writer\PngWriter; use Exception; use Magento\Framework\App\Config\ScopeConfigInterface; @@ -214,13 +216,17 @@ public function verify(UserInterface $user, DataObject $request): bool public function getQrCodeAsPng(UserInterface $user): string { // @codingStandardsIgnoreStart - $qrCode = new QrCode($this->getProvisioningUrl($user)); - $qrCode->setSize(400); - $qrCode->setMargin(0); - $qrCode->setErrorCorrectionLevel(new ErrorCorrectionLevelHigh()); - $qrCode->setForegroundColor(new Color(0, 0, 0, 0)); - $qrCode->setBackgroundColor(new Color(255, 255, 255, 0)); - $qrCode->setEncoding(new Encoding('UTF-8')); + $qrCode = new QrCode( + $this->getProvisioningUrl($user), + new Encoding('UTF-8'), + ErrorCorrectionLevel::High, + 400, + 0, + RoundBlockSizeMode::Margin, + new Color(0, 0, 0, 0), + new Color(255, 255, 255, 0) + ); + $writer = new PngWriter(); $pngData = $writer->write($qrCode); From b84ac593e0ca494360cb8fa8a9a283c080f8ce95 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 20 Dec 2024 18:14:37 +0530 Subject: [PATCH 180/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for SVC, static and integration failures --- TwoFactorAuth/Api/Data/DuoDataInterface.php | 4 +- .../Api/DuoAuthenticateInterface.php | 4 +- TwoFactorAuth/Api/DuoConfigureInterface.php | 4 +- TwoFactorAuth/Block/Provider/Duo/Auth.php | 32 ++----------- .../Controller/Adminhtml/Duo/Auth.php | 47 ++++++++++++++++++- .../Data/Provider/Engine/DuoSecurity/Data.php | 4 +- .../Engine/DuoSecurity/AuthenticateTest.php | 10 ++-- .../Engine/DuoSecurity/ConfigureTest.php | 36 +++++++------- 8 files changed, 79 insertions(+), 62 deletions(-) diff --git a/TwoFactorAuth/Api/Data/DuoDataInterface.php b/TwoFactorAuth/Api/Data/DuoDataInterface.php index 0d3b4731..5f937f6e 100644 --- a/TwoFactorAuth/Api/Data/DuoDataInterface.php +++ b/TwoFactorAuth/Api/Data/DuoDataInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/DuoAuthenticateInterface.php b/TwoFactorAuth/Api/DuoAuthenticateInterface.php index d5fd199b..2ff76031 100644 --- a/TwoFactorAuth/Api/DuoAuthenticateInterface.php +++ b/TwoFactorAuth/Api/DuoAuthenticateInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/DuoConfigureInterface.php b/TwoFactorAuth/Api/DuoConfigureInterface.php index 17e9c8fd..d31a49ea 100644 --- a/TwoFactorAuth/Api/DuoConfigureInterface.php +++ b/TwoFactorAuth/Api/DuoConfigureInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 2931658b..0a583e4a 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -11,47 +11,29 @@ use Magento\Backend\Block\Template; use Magento\Backend\Model\Auth\Session; use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\Message\ManagerInterface; -use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; /** * @api */ class Auth extends Template { - /** - * @var DuoSecurity - */ - private $duoSecurity; - /** * @var Session */ private $session; - /** - * @var ManagerInterface - */ - private $messageManager; - /** * @param Template\Context $context * @param Session $session - * @param DuoSecurity $duoSecurity - * @param ManagerInterface $messageManager * @param array $data */ public function __construct( Template\Context $context, Session $session, - DuoSecurity $duoSecurity, - ManagerInterface $messageManager, array $data = [] ) { parent::__construct($context, $data); - $this->duoSecurity = $duoSecurity; $this->session = $session; - $this->messageManager = $messageManager; } /** @@ -63,18 +45,10 @@ public function getJsLayout() if (!$user) { throw new LocalizedException(__('User session not found.')); } - $username = $user->getUserName(); - $state = $this->duoSecurity->generateDuoState(); - $this->session->setDuoState($state); - $response = $this->duoSecurity->initiateAuth($username, $state); - - if ($response['status'] == 'open') { - $this->messageManager->addErrorMessage($response['message']); - } elseif ($response['status'] == 'closed') { - $this->messageManager->addErrorMessage($response['message']); + $authUrl = $this->getData('auth_url'); + if ($authUrl) { + $this->jsLayout['components']['tfa-auth']['authUrl'] = $authUrl; } - - $this->jsLayout['components']['tfa-auth']['authUrl'] = $response['redirect_url']; return parent::getJsLayout(); } } diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php index e5fbfbaa..71f86ba8 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php @@ -10,6 +10,8 @@ use Magento\Backend\Model\Auth\Session; use Magento\Backend\App\Action; use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\Controller\Result\RedirectFactory; +use Magento\Framework\Message\ManagerInterface; use Magento\Framework\View\Result\PageFactory; use Magento\TwoFactorAuth\Api\TfaInterface; use Magento\TwoFactorAuth\Api\UserConfigManagerInterface; @@ -48,6 +50,19 @@ class Auth extends AbstractAction implements HttpGetActionInterface */ private $tokenVerifier; + /** + * @var DuoSecurity + */ + private $duoSecurity; + /** + * @var ManagerInterface + */ + protected $messageManager; + /** + * @var RedirectFactory + */ + protected $resultRedirectFactory; + /** * @param Action\Context $context * @param Session $session @@ -55,6 +70,7 @@ class Auth extends AbstractAction implements HttpGetActionInterface * @param UserConfigManagerInterface $userConfigManager * @param TfaInterface $tfa * @param HtmlAreaTokenVerifier $tokenVerifier + * @param DuoSecurity $duoSecurity */ public function __construct( Action\Context $context, @@ -62,7 +78,8 @@ public function __construct( PageFactory $pageFactory, UserConfigManagerInterface $userConfigManager, TfaInterface $tfa, - HtmlAreaTokenVerifier $tokenVerifier + HtmlAreaTokenVerifier $tokenVerifier, + DuoSecurity $duoSecurity ) { parent::__construct($context); $this->tfa = $tfa; @@ -70,6 +87,9 @@ public function __construct( $this->pageFactory = $pageFactory; $this->userConfigManager = $userConfigManager; $this->tokenVerifier = $tokenVerifier; + $this->duoSecurity = $duoSecurity; + $this->messageManager = $context->getMessageManager(); + $this->resultRedirectFactory = $context->getResultRedirectFactory(); } /** @@ -87,8 +107,31 @@ private function getUser() */ public function execute() { + $user = $this->getUser(); + if (!$user) { + $this->messageManager->addErrorMessage(__('User session not found.')); + } $this->userConfigManager->setDefaultProvider((int)$this->getUser()->getId(), DuoSecurity::CODE); - return $this->pageFactory->create(); + + $username = $this->getUser()->getUserName(); + $state = $this->duoSecurity->generateDuoState(); + $this->session->setDuoState($state); + $response = $this->duoSecurity->initiateAuth($username, $state); + if ($response['status'] === 'open') { + // If fail mode is "open", skip the Duo prompt. + $this->messageManager->addErrorMessage($response['message']); + } + if ($response['status'] === 'closed') { + // If fail mode is "closed", show an error message. + $this->messageManager->addErrorMessage($response['message']); + } + + $resultPage = $this->pageFactory->create(); + $block = $resultPage->getLayout()->getBlock('content'); + if ($block) { + $block->setData('auth_url', $response['redirect_url']); + } + return $resultPage; } /** diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php index 1ffd9f51..a73d3062 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/DuoSecurity/Data.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php index 0a52d0c3..76b28512 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/AuthenticateTest.php @@ -80,7 +80,7 @@ public function testVerifyInvalidCredentials() $this->duo ->expects($this->never()) ->method('authorizeUser'); - $this->model->createAdminAccessTokenWithCredentials( + $this->model->createAdminAccessTokenWithCredentialsAndPasscode( 'adminUser', 'abc', '123456' @@ -107,7 +107,7 @@ public function testVerifyNotConfiguredProvider() $this->duo ->expects($this->never()) ->method('authorizeUser'); - $this->model->createAdminAccessTokenWithCredentials( + $this->model->createAdminAccessTokenWithCredentialsAndPasscode( 'adminUser', Bootstrap::ADMIN_PASSWORD, '123456' @@ -125,7 +125,7 @@ public function testVerifyUnavailableProvider() $this->duo ->expects($this->never()) ->method('authorizeUser'); - $this->model->createAdminAccessTokenWithCredentials( + $this->model->createAdminAccessTokenWithCredentialsAndPasscode( 'adminUser', Bootstrap::ADMIN_PASSWORD, '123456' @@ -163,7 +163,7 @@ public function testVerifyValidRequest() ->willReturn(['status' => 'allow']); // Attempt to create the access token - $token = $this->model->createAdminAccessTokenWithCredentials( + $token = $this->model->createAdminAccessTokenWithCredentialsAndPasscode( $username, $password, $passcode @@ -207,7 +207,7 @@ public function testVerifyInvalidRequest() ->willReturn(['status' => 'deny', 'msg' => 'Authentication denied']); // Simulate invalid response // Attempt to create the access token, expecting an exception due to the invalid response - $this->model->createAdminAccessTokenWithCredentials( + $this->model->createAdminAccessTokenWithCredentialsAndPasscode( $username, $password, $passcode diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php index b819f5de..4a58ff57 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/DuoSecurity/ConfigureTest.php @@ -79,14 +79,14 @@ protected function setUp(): void * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testGetConfigurationDataInvalidTfat() + public function testGetDuoConfigurationDataInvalidTfat() { $this->expectException(\Magento\Framework\Exception\AuthorizationException::class); $this->expectExceptionMessage('Invalid two-factor authorization token'); $this->duo ->expects($this->never()) ->method('enrollNewUser'); - $this->model->getConfigurationData( + $this->model->getDuoConfigurationData( 'abc' ); } @@ -100,7 +100,7 @@ public function testGetConfigurationDataInvalidTfat() * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testGetConfigurationDataAlreadyConfiguredProvider() + public function testGetDuoConfigurationDataAlreadyConfiguredProvider() { $this->expectException(\Magento\Framework\Exception\LocalizedException::class); $this->expectExceptionMessage('Provider is already configured.'); @@ -111,7 +111,7 @@ public function testGetConfigurationDataAlreadyConfiguredProvider() $this->duo ->expects($this->never()) ->method('enrollNewUser'); - $this->model->getConfigurationData( + $this->model->getDuoConfigurationData( $this->tokenManager->issueFor($userId) ); } @@ -120,14 +120,14 @@ public function testGetConfigurationDataAlreadyConfiguredProvider() * @magentoConfigFixture default/twofactorauth/general/force_providers authy * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testGetConfigurationDataUnavailableProvider() + public function testGetDuoConfigurationDataUnavailableProvider() { $this->expectException(\Magento\Framework\Exception\LocalizedException::class); $this->expectExceptionMessage('Provider is not allowed.'); $this->duo ->expects($this->never()) ->method('enrollNewUser'); - $this->model->getConfigurationData( + $this->model->getDuoConfigurationData( $this->tokenManager->issueFor($this->getUserId()) ); } @@ -141,14 +141,14 @@ public function testGetConfigurationDataUnavailableProvider() * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testActivateInvalidTfat() + public function testDuoActivateInvalidTfat() { $this->expectException(\Magento\Framework\Exception\AuthorizationException::class); $this->expectExceptionMessage('Invalid two-factor authorization token'); $this->duo ->expects($this->never()) ->method('assertUserIsValid'); - $this->model->activate( + $this->model->duoActivate( 'abc', 'something' ); @@ -163,7 +163,7 @@ public function testActivateInvalidTfat() * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testActivateAlreadyConfiguredProvider() + public function testDuoActivateAlreadyConfiguredProvider() { $this->expectException(\Magento\Framework\Exception\LocalizedException::class); $this->expectExceptionMessage('Provider is already configured.'); @@ -173,7 +173,7 @@ public function testActivateAlreadyConfiguredProvider() $this->duo ->expects($this->never()) ->method('assertUserIsValid'); - $this->model->activate( + $this->model->duoActivate( $this->tokenManager->issueFor($userId), 'something' ); @@ -183,7 +183,7 @@ public function testActivateAlreadyConfiguredProvider() * @magentoConfigFixture default/twofactorauth/general/force_providers authy * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testActivateUnavailableProvider() + public function testDuoActivateUnavailableProvider() { $this->expectException(\Magento\Framework\Exception\LocalizedException::class); $this->expectExceptionMessage('Provider is not allowed.'); @@ -191,7 +191,7 @@ public function testActivateUnavailableProvider() $this->duo ->expects($this->never()) ->method('assertUserIsValid'); - $this->model->activate( + $this->model->duoActivate( $this->tokenManager->issueFor($userId), 'something' ); @@ -206,7 +206,7 @@ public function testActivateUnavailableProvider() * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testGetConfigurationDataValidRequest() + public function testGetDuoConfigurationDataValidRequest() { $userId = $this->getUserId(); $userName = 'adminUser'; @@ -217,7 +217,7 @@ public function testGetConfigurationDataValidRequest() ->with($userName, 60) ->willReturn('enrollment_data'); - $result = $this->model->getConfigurationData( + $result = $this->model->getDuoConfigurationData( $this->tokenManager->issueFor($userId) ); @@ -233,7 +233,7 @@ public function testGetConfigurationDataValidRequest() * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testActivateValidRequest() + public function testDuoActivateValidRequest() { $userId = $this->getUserId(); $userName = 'adminUser'; @@ -244,7 +244,7 @@ public function testActivateValidRequest() ->with($userName) ->willReturn('auth'); - $this->model->activate( + $this->model->duoActivate( $this->tokenManager->issueFor($userId) ); @@ -260,7 +260,7 @@ public function testActivateValidRequest() * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 * @magentoDataFixture Magento/User/_files/user_with_role.php */ - public function testActivateInvalidDataThrowsException() + public function testDuoActivateInvalidDataThrowsException() { $this->expectException(\InvalidArgumentException::class); $this->expectExceptionMessage('Something'); @@ -277,7 +277,7 @@ public function testActivateInvalidDataThrowsException() ->willThrowException(new \InvalidArgumentException('Something')); // Call activate without a signature, as per your updated logic - $result = $this->model->activate($tfat); + $result = $this->model->duoActivate($tfat); self::assertEmpty($result); } From d07df949deab6d5a81ded525d1ef933e31adf604 Mon Sep 17 00:00:00 2001 From: glo5363 <glo05363@adobe.com> Date: Fri, 20 Dec 2024 23:09:43 +0530 Subject: [PATCH 181/208] AC-10982::[2FA] Integrate with Duo Web SDK to support Universal Prompt-fixes for SVC and static --- .../Adminhtml/System/Config/Providers.php | 1 - TwoFactorAuth/Block/Provider/Duo/Auth.php | 9 ++++++ .../Controller/Adminhtml/Duo/Auth.php | 13 ++++---- .../Model/Config/Source/DuoFailmode.php | 27 ----------------- .../Model/Provider/Engine/DuoSecurity.php | 30 +------------------ .../Controller/Adminhtml/Duo/AuthTest.php | 2 -- TwoFactorAuth/etc/adminhtml/system.xml | 5 ---- 7 files changed, 15 insertions(+), 72 deletions(-) delete mode 100644 TwoFactorAuth/Model/Config/Source/DuoFailmode.php diff --git a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php index 86f9370a..d3fe95de 100644 --- a/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php +++ b/TwoFactorAuth/Block/Adminhtml/System/Config/Providers.php @@ -53,7 +53,6 @@ protected function _getElementHtml(AbstractElement $element) 'twofactorauth_duo_client_id', 'twofactorauth_duo_client_secret', 'twofactorauth_duo_api_hostname', - 'twofactorauth_duo_failmode', 'twofactorauth_duo_integration_key', 'twofactorauth_duo_secret_key', ] diff --git a/TwoFactorAuth/Block/Provider/Duo/Auth.php b/TwoFactorAuth/Block/Provider/Duo/Auth.php index 0a583e4a..234e104c 100644 --- a/TwoFactorAuth/Block/Provider/Duo/Auth.php +++ b/TwoFactorAuth/Block/Provider/Duo/Auth.php @@ -11,12 +11,18 @@ use Magento\Backend\Block\Template; use Magento\Backend\Model\Auth\Session; use Magento\Framework\Exception\LocalizedException; +use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; /** * @api */ class Auth extends Template { + /** + * @var DuoSecurity + */ + private $duoSecurity; + /** * @var Session */ @@ -25,14 +31,17 @@ class Auth extends Template /** * @param Template\Context $context * @param Session $session + * @param DuoSecurity $duoSecurity * @param array $data */ public function __construct( Template\Context $context, Session $session, + DuoSecurity $duoSecurity, array $data = [] ) { parent::__construct($context, $data); + $this->duoSecurity = $duoSecurity; $this->session = $session; } diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php index 71f86ba8..84009c82 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Auth.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Duo; @@ -117,12 +118,8 @@ public function execute() $state = $this->duoSecurity->generateDuoState(); $this->session->setDuoState($state); $response = $this->duoSecurity->initiateAuth($username, $state); - if ($response['status'] === 'open') { - // If fail mode is "open", skip the Duo prompt. - $this->messageManager->addErrorMessage($response['message']); - } - if ($response['status'] === 'closed') { - // If fail mode is "closed", show an error message. + if ($response['status'] === 'failure') { + // if health check fails, skip the Duo prompt and choose different 2FA. $this->messageManager->addErrorMessage($response['message']); } diff --git a/TwoFactorAuth/Model/Config/Source/DuoFailmode.php b/TwoFactorAuth/Model/Config/Source/DuoFailmode.php deleted file mode 100644 index a9b9b1f4..00000000 --- a/TwoFactorAuth/Model/Config/Source/DuoFailmode.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * Copyright 2024 Adobe - * All Rights Reserved. - */ -declare(strict_types=1); - -namespace Magento\TwoFactorAuth\Model\Config\Source; - -use Magento\Framework\Data\OptionSourceInterface; - -class DuoFailmode implements OptionSourceInterface -{ - - /** - * Get options - * - * @return array[] - */ - public function toOptionArray() - { - return [ - ['value' => 'closed', 'label' => __('Closed')], - ['value' => 'open', 'label' => __('Open')] - ]; - } -} diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 3d383b2e..80d88a10 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -57,11 +57,6 @@ class DuoSecurity implements EngineInterface */ public const XML_PATH_SKEY = 'twofactorauth/duo/secret_key'; - /** - * Configuration path for Duo Mode - */ - public const DUO_FAILMODE = 'twofactorauth/duo/duo_failmode'; - /** * @var ScopeConfigInterface */ @@ -142,16 +137,6 @@ private function getClientId(): string return $this->scopeConfig->getValue(static::XML_PATH_CLIENT_ID); } - /** - * Get Duo Mode - * - * @return string - */ - public function getDuoFailmode(): string - { - return strtoupper($this->scopeConfig->getValue(static::DUO_FAILMODE)); - } - /** * Get callback URL * @@ -241,27 +226,14 @@ public function isEnabled(): bool */ public function initiateAuth($username, string $state): array { - $duoFailMode = $this->getDuoFailmode(); try { $this->healthCheck(); } catch (DuoException $e) { - if ($duoFailMode === "OPEN") { - return [ - 'status' => 'open', - 'redirect_url' => '', - 'message' => __( - "Login 'applicable', - but 2FA Not Performed. Switch to other 2FA Provider. - Confirm Duo client/secret/host values are correct" - ) - ]; - } else { return [ - 'status' => 'closed', + 'status' => 'failure', 'redirect_url' => '', 'message' => __("2FA Unavailable. Confirm Duo client/secret/host values are correct") ]; - } } return [ diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php index 8fb8643c..02586a6a 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Duo/AuthTest.php @@ -52,7 +52,6 @@ public function testTokenAccess(): void * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/duo_failmode open * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testAclHasAccess() @@ -68,7 +67,6 @@ public function testAclHasAccess() * @magentoConfigFixture default/twofactorauth/duo/integration_key abc123 * @magentoConfigFixture default/twofactorauth/duo/api_hostname test.duosecurity.com * @magentoConfigFixture default/twofactorauth/duo/secret_key abc123 - * @magentoConfigFixture default/twofactorauth/duo/duo_failmode open * phpcs:disable Generic.CodeAnalysis.UselessOverridingMethod */ public function testAclNoAccess() diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 430be2ae..9dd505de 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -78,11 +78,6 @@ <label>API hostname</label> <backend_model>Magento\TwoFactorAuth\Model\Config\Backend\Duo\ApiHostname</backend_model> </field> - <field id="duo_failmode" translate="label comment" type="select" sortOrder="50" showInDefault="1" - showInWebsite="0" showInStore="0"> - <label>Duo Failmode</label> - <source_model>Magento\TwoFactorAuth\Model\Config\Source\DuoFailmode</source_model> - </field> <field id="integration_key" translate="label comment" type="text" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0"> <label>Integration Key</label> From 45d260268995d8347abafd1c1512d515f9e46d48 Mon Sep 17 00:00:00 2001 From: Saurabh Kumar <glo17680@adobe.com> Date: Mon, 23 Dec 2024 10:58:14 +0530 Subject: [PATCH 182/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaValidation/Model/ValidationConfig.php | 4 ++-- ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php | 4 ++-- TwoFactorAuth/Model/Config/Backend/ForceProviders.php | 6 +++--- TwoFactorAuth/Model/Country.php | 4 ++-- TwoFactorAuth/Model/ResourceModel/UserConfig.php | 4 ++-- TwoFactorAuth/Model/UserConfig.php | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/ReCaptchaValidation/Model/ValidationConfig.php b/ReCaptchaValidation/Model/ValidationConfig.php index 37e60fe9..638466b4 100644 --- a/ReCaptchaValidation/Model/ValidationConfig.php +++ b/ReCaptchaValidation/Model/ValidationConfig.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php index 92dbb703..114e7249 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2023 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Config/Backend/ForceProviders.php b/TwoFactorAuth/Model/Config/Backend/ForceProviders.php index 420253e2..220535ab 100644 --- a/TwoFactorAuth/Model/Config/Backend/ForceProviders.php +++ b/TwoFactorAuth/Model/Config/Backend/ForceProviders.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); @@ -76,7 +76,7 @@ public function beforeSave() $value = explode(',', $value); } $validValues = is_array($value) ? array_intersect($codes, $value) : []; - if (empty($value) || !$validValues) { + if (count($value) === 0 || count($validValues) === 0) { throw new ValidatorException(__('You have to select at least one Two-Factor Authorization provider')); } diff --git a/TwoFactorAuth/Model/Country.php b/TwoFactorAuth/Model/Country.php index 5c910cf0..2ed4b858 100644 --- a/TwoFactorAuth/Model/Country.php +++ b/TwoFactorAuth/Model/Country.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/ResourceModel/UserConfig.php b/TwoFactorAuth/Model/ResourceModel/UserConfig.php index 9237738c..bce6d213 100644 --- a/TwoFactorAuth/Model/ResourceModel/UserConfig.php +++ b/TwoFactorAuth/Model/ResourceModel/UserConfig.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/UserConfig.php b/TwoFactorAuth/Model/UserConfig.php index bc0b5438..d1619696 100644 --- a/TwoFactorAuth/Model/UserConfig.php +++ b/TwoFactorAuth/Model/UserConfig.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); From f6d07b197317df07601f36e521b1fd476018553c Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Mon, 23 Dec 2024 11:24:21 +0530 Subject: [PATCH 183/208] Google recaptcha version chnaged --- ReCaptchaValidation/composer.json | 4 ++-- _metapackage/composer.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index cc355c14..874f449e 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -4,14 +4,14 @@ "repositories": [ { "type": "vcs", - "url": "git@github.com:phpfui/recaptcha.git" + "url": "git@github.com:magento-commerce/recaptcha.git" } ], "require": { "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", - "google/recaptcha": "dev-PHP84" + "google/recaptcha": "dev-develop" }, "type": "magento2-module", "license": "OSL-3.0", diff --git a/_metapackage/composer.json b/_metapackage/composer.json index 9fb453db..528214ec 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -5,7 +5,7 @@ "repositories": [ { "type": "vcs", - "url": "git@github.com:phpfui/recaptcha.git" + "url": "git@github.com:magento-commerce/recaptcha.git" } ], "require": { @@ -34,7 +34,7 @@ "magento/module-re-captcha-webapi-ui": "*", "magento/module-securitytxt": "*", "magento/module-two-factor-auth": "*", - "google/recaptcha": "dev-PHP84", + "google/recaptcha": "dev-develop", "magento/module-re-captcha-checkout-sales-rule": "*" } } From 7d6b6c4ab6b46441e7253608b8de53b2190e09f4 Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Mon, 23 Dec 2024 14:08:42 +0530 Subject: [PATCH 184/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaValidation/composer.json | 4 ++-- _metapackage/composer.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index 874f449e..55e9f179 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -4,14 +4,14 @@ "repositories": [ { "type": "vcs", - "url": "git@github.com:magento-commerce/recaptcha.git" + "url": "git@github.com:magento-commerce/magento-recaptcha.git" } ], "require": { "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", - "google/recaptcha": "dev-develop" + "magento/recaptcha": "dev-develop" }, "type": "magento2-module", "license": "OSL-3.0", diff --git a/_metapackage/composer.json b/_metapackage/composer.json index 528214ec..a9bb223a 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -5,7 +5,7 @@ "repositories": [ { "type": "vcs", - "url": "git@github.com:magento-commerce/recaptcha.git" + "url": "git@github.com:magento-commerce/magento-recaptcha.git" } ], "require": { @@ -34,7 +34,7 @@ "magento/module-re-captcha-webapi-ui": "*", "magento/module-securitytxt": "*", "magento/module-two-factor-auth": "*", - "google/recaptcha": "dev-develop", + "magento/recaptcha": "dev-develop", "magento/module-re-captcha-checkout-sales-rule": "*" } } From e9333ab0f539f16b72583e7116edbb9ed45fa9a7 Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Fri, 27 Dec 2024 18:45:58 +0530 Subject: [PATCH 185/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- TwoFactorAuth/Model/Provider/Engine/Google.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/Google.php b/TwoFactorAuth/Model/Provider/Engine/Google.php index 20ddcf52..03fa8501 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Google.php +++ b/TwoFactorAuth/Model/Provider/Engine/Google.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); From 9793f7a075b78617759c1eecfe0b7905a5510b83 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Fri, 3 Jan 2025 18:25:12 +0530 Subject: [PATCH 186/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaValidation/composer.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index 55e9f179..4675beb6 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -1,12 +1,6 @@ { "name": "magento/module-re-captcha-validation", "description": "Google reCAPTCHA integration for Magento2", - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:magento-commerce/magento-recaptcha.git" - } - ], "require": { "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", From afc200727f6ef0513fea782b578f7fc2f71fd643 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Wed, 8 Jan 2025 18:38:40 +0530 Subject: [PATCH 187/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaValidation/composer.json | 2 +- _metapackage/composer.json | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index 4675beb6..ffb96078 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -5,7 +5,7 @@ "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", - "magento/recaptcha": "dev-develop" + "magento/recaptcha": "^1.0.0" }, "type": "magento2-module", "license": "OSL-3.0", diff --git a/_metapackage/composer.json b/_metapackage/composer.json index a9bb223a..52c2520e 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -2,12 +2,6 @@ "name": "magento/security-package", "description": "Magento Security Package", "type": "metapackage", - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:magento-commerce/magento-recaptcha.git" - } - ], "require": { "magento/module-re-captcha-admin-ui": "*", "magento/module-re-captcha-checkout": "*", @@ -34,7 +28,7 @@ "magento/module-re-captcha-webapi-ui": "*", "magento/module-securitytxt": "*", "magento/module-two-factor-auth": "*", - "magento/recaptcha": "dev-develop", + "magento/recaptcha": "^1.0.0", "magento/module-re-captcha-checkout-sales-rule": "*" } } From 866558e7e857f144719d55c0b6273412448d1030 Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Fri, 10 Jan 2025 08:20:01 +0530 Subject: [PATCH 188/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php index 80d88a10..5ede11be 100644 --- a/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php +++ b/TwoFactorAuth/Model/Provider/Engine/DuoSecurity.php @@ -87,8 +87,8 @@ class DuoSecurity implements EngineInterface public function __construct( ScopeConfigInterface $scopeConfig, UrlInterface $urlBuilder, - Client $client = null, - DuoAuth $duoAuth = null + ?Client $client = null, + ?DuoAuth $duoAuth = null ) { $this->scopeConfig = $scopeConfig; $this->urlBuilder = $urlBuilder; From db937f5a67969306f5034e09db591307e337b099 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Fri, 10 Jan 2025 11:55:01 +0530 Subject: [PATCH 189/208] AC-13306::Adobe Commerce 2.4.8 core code is compatible with PHP 8.4 --- ReCaptchaValidation/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaValidation/composer.json b/ReCaptchaValidation/composer.json index ffb96078..d47fedcd 100644 --- a/ReCaptchaValidation/composer.json +++ b/ReCaptchaValidation/composer.json @@ -5,7 +5,7 @@ "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-validation-api": "*", - "magento/recaptcha": "^1.0.0" + "phpfui/recaptcha": "^2.0.0" }, "type": "magento2-module", "license": "OSL-3.0", From ee9dcee999fc534e31a8b5cbcac93eb302dbb9f6 Mon Sep 17 00:00:00 2001 From: "Pawan.kumar" <pawan.kumar9@globallogic.com> Date: Tue, 14 Jan 2025 19:26:36 +0530 Subject: [PATCH 190/208] cia-2.4.8-beta2-develop-2.4-develop-sync-01132025: resolve conflict --- .../Model/Provider/Engine/DuoSecurityTest.php | 143 ++++++------------ 1 file changed, 46 insertions(+), 97 deletions(-) diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php index d57d7de6..062564f4 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/DuoSecurityTest.php @@ -1,54 +1,61 @@ <?php /** - * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine; -use Magento\User\Api\Data\UserInterface; use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\DataObject; +use Magento\Framework\UrlInterface; use Magento\TwoFactorAuth\Model\Provider\Engine\DuoSecurity; +use Magento\User\Api\Data\UserInterface; +use Duo\DuoUniversal\Client; +use DuoAPI\Auth as DuoAuth; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; class DuoSecurityTest extends TestCase { - /** - * @var DuoSecurity - */ - private $model; + /** @var MockObject|ScopeConfigInterface */ + private $configMock; - /** - * @var DuoSecurity - */ - private $modelWithForcedDuoAuth; + /** @var MockObject|UrlInterface */ + private $urlMock; - /** - * @var ScopeConfigInterface|MockObject - */ - private $configMock; + /** @var MockObject|Client */ + private $clientMock; /** - * @var UserInterface|MockObject + * @var DuoAuth|MockObject */ - private $user; + private $duoAuthMock; + + /** @var DuoSecurity */ + private $model; - /** - * @inheritDoc - */ protected function setUp(): void { - $objectManager = new ObjectManager($this); - $this->configMock = $this->getMockBuilder(ScopeConfigInterface::class)->disableOriginalConstructor()->getMock(); - $this->user = $this->getMockBuilder(UserInterface::class)->disableOriginalConstructor()->getMock(); + $this->configMock = $this->getMockBuilder(ScopeConfigInterface::class) + ->disableOriginalConstructor() + ->getMock(); - $this->model = $objectManager->getObject(DuoSecurity::class, ['scopeConfig' => $this->configMock]); - $this->modelWithForcedDuoAuth = new DuoSecurity($this->configMock, $this->model::DUO_PREFIX); + $this->urlMock = $this->getMockBuilder(UrlInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->clientMock = $this->createMock(Client::class); + $this->duoAuthMock = $this->createMock(DuoAuth::class); + + $this->model = new DuoSecurity( + $this->configMock, + $this->urlMock, + $this->clientMock, + $this->duoAuthMock + ); } /** @@ -60,46 +67,11 @@ public static function getIsEnabledTestDataSet(): array { return [ [ - 'value', - 'value', - 'value', - 'value', + 'test.duosecurity.com', + 'ABCDEFGHIJKLMNOPQRST', + 'abcdefghijklmnopqrstuvwxyz0123456789abcd', + 'google,duo_security,authy', true - ], - [ - null, - null, - null, - null, - false - ], - [ - 'value', - null, - null, - null, - false - ], - [ - null, - 'value', - null, - null, - false - ], - [ - null, - null, - 'value', - null, - false - ], - [ - null, - null, - null, - 'value', - false ] ]; } @@ -108,51 +80,28 @@ public static function getIsEnabledTestDataSet(): array * Check that the provider is available based on configuration. * * @param string|null $apiHostname - * @param string|null $appKey - * @param string|null $secretKey - * @param string|null $integrationKey + * @param string|null $clientId + * @param string|null $clientSecret * @param bool $expected * @return void * @dataProvider getIsEnabledTestDataSet */ public function testIsEnabled( ?string $apiHostname, - ?string $appKey, - ?string $secretKey, - ?string $integrationKey, + ?string $clientId, + ?string $clientSecret, + string $forceProviders, bool $expected ): void { $this->configMock->method('getValue')->willReturnMap( [ [DuoSecurity::XML_PATH_API_HOSTNAME, 'default', null, $apiHostname], - [DuoSecurity::XML_PATH_APPLICATION_KEY, 'default', null, $appKey], - [DuoSecurity::XML_PATH_SECRET_KEY, 'default', null, $secretKey], - [DuoSecurity::XML_PATH_INTEGRATION_KEY, 'default', null, $integrationKey] + [DuoSecurity::XML_PATH_CLIENT_ID, 'default', null, $clientId], + [DuoSecurity::XML_PATH_CLIENT_SECRET, 'default', null, $clientSecret], + ['twofactorauth/general/force_providers', 'default', null, $forceProviders] ] ); $this->assertEquals($expected, $this->model->isEnabled()); } - - public function testGetRequestSignature() : void - { - $this->user->expects($this->any()) - ->method('getUserName') - ->willReturn('admin'); - $this->configMock->expects($this->any()) - ->method('getValue') - ->willReturn('SECRET'); - - $this->assertStringContainsString($this->model::AUTH_PREFIX, $this->model->getRequestSignature($this->user)); - $this->assertStringNotContainsString($this->model::DUO_PREFIX, $this->model->getRequestSignature($this->user)); - - $this->assertStringContainsString( - $this->model::DUO_PREFIX, - $this->modelWithForcedDuoAuth->getRequestSignature($this->user) - ); - $this->assertStringNotContainsString( - $this->model::AUTH_PREFIX, - $this->modelWithForcedDuoAuth->getRequestSignature($this->user) - ); - } } From 59001c8a6cf607d3cb9bbb7605c38f16f8519933 Mon Sep 17 00:00:00 2001 From: "Pawan.kumar" <pawan.kumar9@globallogic.com> Date: Wed, 15 Jan 2025 12:32:29 +0530 Subject: [PATCH 191/208] cia-2.4.8-beta2-develop-2.4-develop-sync-01132025: fix static tests --- ReCaptchaWishlist/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaWishlist/composer.json b/ReCaptchaWishlist/composer.json index bdb59f42..20186ae6 100644 --- a/ReCaptchaWishlist/composer.json +++ b/ReCaptchaWishlist/composer.json @@ -4,7 +4,7 @@ "type": "magento2-module", "license": "OSL-3.0", "require": { - "php": "~8.1.0||~8.2.0||~8.3.0", + "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", "magento/module-re-captcha-ui": "*" }, From 7b01f4b22c836761f15d7dbb47986d6bc9157831 Mon Sep 17 00:00:00 2001 From: Dnyaneshwar Jambhulkar <pru34625@adobe.com> Date: Wed, 29 Jan 2025 16:43:35 +0530 Subject: [PATCH 192/208] Replaced magento/recaptcha with phpfui/recaptcha --- _metapackage/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_metapackage/composer.json b/_metapackage/composer.json index 393f8801..79cf1a37 100644 --- a/_metapackage/composer.json +++ b/_metapackage/composer.json @@ -29,7 +29,7 @@ "magento/module-re-captcha-wishlist": "*", "magento/module-securitytxt": "*", "magento/module-two-factor-auth": "*", - "magento/recaptcha": "^1.0.0", + "phpfui/recaptcha": "^2.0.0", "magento/module-re-captcha-checkout-sales-rule": "*" } } From d445c55171762cefa5abee0148b32a038960a915 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Wed, 12 Feb 2025 19:28:06 +0530 Subject: [PATCH 193/208] AC-13911::Sync 2.4.8-beta2-develop with 2.4-develop, Fixed the static test --- ReCaptchaWishlist/Observer/ShareWishlistObserver.php | 4 ++-- ReCaptchaWishlist/view/frontend/web/css/source/_module.less | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ReCaptchaWishlist/Observer/ShareWishlistObserver.php b/ReCaptchaWishlist/Observer/ShareWishlistObserver.php index aa904bdf..03794b23 100644 --- a/ReCaptchaWishlist/Observer/ShareWishlistObserver.php +++ b/ReCaptchaWishlist/Observer/ShareWishlistObserver.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All rights reserved. */ declare(strict_types=1); diff --git a/ReCaptchaWishlist/view/frontend/web/css/source/_module.less b/ReCaptchaWishlist/view/frontend/web/css/source/_module.less index 27b68596..3c64e884 100644 --- a/ReCaptchaWishlist/view/frontend/web/css/source/_module.less +++ b/ReCaptchaWishlist/view/frontend/web/css/source/_module.less @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All rights reserved. */ .form.wishlist.share .g-recaptcha { margin-bottom: 40px; From b8b616d1333c168d0ccb0b81984133995c0fe3fd Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Wed, 12 Feb 2025 19:30:28 +0530 Subject: [PATCH 194/208] AC-13911::Sync 2.4.8-beta2-develop with 2.4-develop, Fixed the static test --- ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php | 4 ++-- ReCaptchaWishlist/registration.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php b/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php index d4d1f1de..891aa5db 100644 --- a/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php +++ b/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All rights reserved. */ declare(strict_types=1); diff --git a/ReCaptchaWishlist/registration.php b/ReCaptchaWishlist/registration.php index 80d100c8..fe00143b 100644 --- a/ReCaptchaWishlist/registration.php +++ b/ReCaptchaWishlist/registration.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All rights reserved. */ declare(strict_types=1); From 1675a645900d774b38ce04fa5a9558c8df304b27 Mon Sep 17 00:00:00 2001 From: Rajesh Kumar <glo71317@adobe.com> Date: Wed, 12 Feb 2025 20:17:56 +0530 Subject: [PATCH 195/208] AC-13911::Sync 2.4.8-beta2-develop with 2.4-develop, Fixed the static test --- ReCaptchaWishlist/etc/adminhtml/system.xml | 4 ++-- ReCaptchaWishlist/etc/config.xml | 4 ++-- ReCaptchaWishlist/etc/frontend/events.xml | 4 ++-- ReCaptchaWishlist/etc/module.xml | 4 ++-- .../view/frontend/layout/wishlist_index_share.xml | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ReCaptchaWishlist/etc/adminhtml/system.xml b/ReCaptchaWishlist/etc/adminhtml/system.xml index ff80f2d2..43eb75a8 100644 --- a/ReCaptchaWishlist/etc/adminhtml/system.xml +++ b/ReCaptchaWishlist/etc/adminhtml/system.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaWishlist/etc/config.xml b/ReCaptchaWishlist/etc/config.xml index 72b62efe..5c4c6860 100644 --- a/ReCaptchaWishlist/etc/config.xml +++ b/ReCaptchaWishlist/etc/config.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaWishlist/etc/frontend/events.xml b/ReCaptchaWishlist/etc/frontend/events.xml index b2062abe..ba55bf8d 100644 --- a/ReCaptchaWishlist/etc/frontend/events.xml +++ b/ReCaptchaWishlist/etc/frontend/events.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaWishlist/etc/module.xml b/ReCaptchaWishlist/etc/module.xml index 49f1eb62..0bca040d 100644 --- a/ReCaptchaWishlist/etc/module.xml +++ b/ReCaptchaWishlist/etc/module.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml b/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml index ffd90e30..9ec49570 100644 --- a/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml +++ b/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2024 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" From 085dc8e74f8b9c9b145228f1ea45c1f704b14d54 Mon Sep 17 00:00:00 2001 From: Alexandra Zota <zota@adobe.com> Date: Sat, 17 May 2025 12:03:18 +0300 Subject: [PATCH 196/208] ACP2E-3920: update copyrights --- .../Adminhtml/System/Config/Form/Field/Notice.php | 5 +++-- ReCaptchaAdminUi/Model/CaptchaTypeResolver.php | 5 +++-- ReCaptchaAdminUi/Model/ErrorMessageConfig.php | 5 +++-- ReCaptchaAdminUi/Model/OptionSource.php | 5 +++-- ReCaptchaAdminUi/etc/adminhtml/di.xml | 6 +++--- ReCaptchaAdminUi/etc/adminhtml/system.xml | 6 +++--- ReCaptchaAdminUi/etc/config.xml | 6 +++--- ReCaptchaAdminUi/etc/di.xml | 6 +++--- ReCaptchaAdminUi/etc/module.xml | 6 +++--- ReCaptchaAdminUi/registration.php | 5 +++-- .../view/adminhtml/web/css/source/_module.less | 5 +++-- .../Block/LayoutProcessor/Checkout/Onepage.php | 5 +++-- ReCaptchaCheckout/Model/WebapiConfigProvider.php | 5 +++-- .../Api/GuestPaymentInformationManagementTest.php | 5 +++-- .../Test/Api/PaymentInformationManagementTest.php | 5 +++-- .../Block/LayoutProcessor/Checkout/OnepageTest.php | 4 ++-- ReCaptchaCheckout/etc/adminhtml/system.xml | 6 +++--- ReCaptchaCheckout/etc/config.xml | 6 +++--- ReCaptchaCheckout/etc/di.xml | 6 +++--- ReCaptchaCheckout/etc/frontend/di.xml | 6 +++--- ReCaptchaCheckout/etc/module.xml | 6 +++--- ReCaptchaCheckout/registration.php | 5 +++-- .../view/frontend/layout/checkout_index_index.xml | 6 +++--- ReCaptchaCheckout/view/frontend/requirejs-config.js | 4 ++-- .../view/frontend/web/js/model/place-order-mixin.js | 4 ++-- .../view/frontend/web/js/reCaptchaCheckout.js | 4 ++-- .../web/js/webapiReCaptchaRegistry-mixin.js | 4 ++-- .../web/template/payment-recaptcha-container.html | 8 +++++--- .../view/frontend/web/template/reCaptcha.html | 8 +++++--- .../Block/LayoutProcessor/Checkout/Onepage.php | 5 +++-- .../Model/WebapiConfigProvider.php | 5 +++-- .../Observer/CouponCodeObserver.php | 5 +++-- .../Plugin/CouponSetLayoutPlugin.php | 5 +++-- .../Test/Api/CouponApplyFormRecaptchaTest.php | 5 +++-- .../Test/Api/CouponApplyGraphQLTest.php | 5 +++-- .../Test/Integration/CouponApplyPostTest.php | 5 +++-- ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml | 4 ++-- ReCaptchaCheckoutSalesRule/etc/config.xml | 4 ++-- ReCaptchaCheckoutSalesRule/etc/di.xml | 6 +++--- ReCaptchaCheckoutSalesRule/etc/frontend/di.xml | 6 +++--- ReCaptchaCheckoutSalesRule/etc/frontend/events.xml | 6 +++--- ReCaptchaCheckoutSalesRule/etc/module.xml | 4 ++-- ReCaptchaCheckoutSalesRule/registration.php | 5 +++-- .../view/frontend/layout/checkout_cart_index.xml | 4 ++-- .../view/frontend/layout/checkout_index_index.xml | 4 ++-- .../view/frontend/web/css/source/_module.less | 5 +++-- .../view/frontend/web/js/checkout-sales-rule.js | 5 +++-- ReCaptchaContact/Observer/ContactFormObserver.php | 5 +++-- .../Test/Integration/ContactFormTest.php | 5 +++-- ReCaptchaContact/etc/adminhtml/system.xml | 6 +++--- ReCaptchaContact/etc/config.xml | 6 +++--- ReCaptchaContact/etc/frontend/di.xml | 6 +++--- ReCaptchaContact/etc/frontend/events.xml | 6 +++--- ReCaptchaContact/etc/module.xml | 6 +++--- ReCaptchaContact/registration.php | 5 +++-- .../view/frontend/layout/contact_index_index.xml | 6 +++--- .../Model/AjaxLogin/CaptchaResponseResolver.php | 5 +++-- .../Model/AjaxLogin/ErrorProcessor.php | 5 +++-- ReCaptchaCustomer/Model/WebapiConfigProvider.php | 5 +++-- ReCaptchaCustomer/Observer/AjaxLoginObserver.php | 5 +++-- .../Observer/CreateCustomerObserver.php | 5 +++-- ReCaptchaCustomer/Observer/EditCustomerObserver.php | 5 +++-- .../Observer/ForgotPasswordObserver.php | 5 +++-- ReCaptchaCustomer/Observer/LoginObserver.php | 5 +++-- .../InjectRecaptchaInAuthenticationPopup.php | 5 +++-- .../Api/AccountManagementCaptchaGlaphQLTest.php | 5 +++-- .../Test/Api/AccountManagementCaptchaTest.php | 5 +++-- ReCaptchaCustomer/Test/Api/LoginGraphQlTest.php | 4 ++-- ReCaptchaCustomer/Test/Api/LoginTest.php | 4 ++-- ReCaptchaCustomer/Test/Api/RegisterGraphQlTest.php | 4 ++-- ReCaptchaCustomer/Test/Api/RegisterTest.php | 4 ++-- .../Test/Integration/AjaxLoginFormTest.php | 5 +++-- .../Test/Integration/CreateCustomerFormTest.php | 5 +++-- ReCaptchaCustomer/Test/Integration/EditFromTest.php | 5 +++-- .../Test/Integration/ForgotPasswordFormTest.php | 5 +++-- .../Test/Integration/LoginFromTest.php | 5 +++-- ReCaptchaCustomer/etc/adminhtml/system.xml | 6 +++--- ReCaptchaCustomer/etc/config.xml | 6 +++--- ReCaptchaCustomer/etc/di.xml | 6 +++--- ReCaptchaCustomer/etc/frontend/di.xml | 6 +++--- ReCaptchaCustomer/etc/frontend/events.xml | 6 +++--- ReCaptchaCustomer/etc/module.xml | 6 +++--- ReCaptchaCustomer/registration.php | 5 +++-- .../frontend/layout/customer_account_create.xml | 6 +++--- .../view/frontend/layout/customer_account_edit.xml | 4 ++-- .../layout/customer_account_forgotpassword.xml | 6 +++--- .../view/frontend/layout/customer_account_login.xml | 6 +++--- ReCaptchaCustomer/view/frontend/layout/default.xml | 6 +++--- .../view/frontend/web/css/source/_module.less | 5 +++-- ReCaptchaFrontendUi/Model/CaptchaTypeResolver.php | 5 +++-- ReCaptchaFrontendUi/Model/ErrorMessageConfig.php | 5 +++-- .../Plugin/ExcludeFromMinification.php | 5 +++-- ReCaptchaFrontendUi/etc/adminhtml/system.xml | 6 +++--- ReCaptchaFrontendUi/etc/config.xml | 6 +++--- ReCaptchaFrontendUi/etc/di.xml | 6 +++--- ReCaptchaFrontendUi/etc/frontend/di.xml | 6 +++--- ReCaptchaFrontendUi/etc/module.xml | 6 +++--- ReCaptchaFrontendUi/registration.php | 5 +++-- .../view/frontend/requirejs-config.js | 4 ++-- .../view/frontend/templates/recaptcha.phtml | 5 +++-- .../view/frontend/web/css/source/_module.less | 5 +++-- .../frontend/web/js/nonInlineReCaptchaRenderer.js | 4 ++-- .../view/frontend/web/js/reCaptcha.js | 4 ++-- .../view/frontend/web/js/reCaptchaScriptLoader.js | 4 ++-- .../view/frontend/web/js/registry.js | 4 ++-- .../view/frontend/web/js/ui-messages-mixin.js | 4 ++-- .../view/frontend/web/template/reCaptcha.html | 8 +++++--- .../Patch/Data/MigrateConfigToRecaptchaModules.php | 5 +++-- ReCaptchaMigration/etc/module.xml | 6 +++--- ReCaptchaMigration/registration.php | 5 +++-- ReCaptchaNewsletter/Model/WebapiConfigProvider.php | 5 +++-- ReCaptchaNewsletter/Observer/NewsletterObserver.php | 5 +++-- .../SubscribeEmailToNewsletterCaptchaTest.php | 5 +++-- .../Test/Integration/NewsletterFormTest.php | 5 +++-- ReCaptchaNewsletter/etc/adminhtml/system.xml | 6 +++--- ReCaptchaNewsletter/etc/config.xml | 6 +++--- ReCaptchaNewsletter/etc/di.xml | 6 +++--- ReCaptchaNewsletter/etc/frontend/di.xml | 6 +++--- ReCaptchaNewsletter/etc/frontend/events.xml | 6 +++--- ReCaptchaNewsletter/etc/module.xml | 6 +++--- ReCaptchaNewsletter/registration.php | 5 +++-- .../view/frontend/layout/default.xml | 6 +++--- .../frontend/templates/recaptcha_newsletter.phtml | 5 +++-- .../view/frontend/web/css/source/_module.less | 4 ++-- .../Block/LayoutProcessor/Checkout/Onepage.php | 5 +++-- ReCaptchaPaypal/Model/CheckoutConfigProvider.php | 5 +++-- ReCaptchaPaypal/Model/ReCaptchaSession.php | 5 +++-- ReCaptchaPaypal/Model/WebapiConfigProvider.php | 5 +++-- ReCaptchaPaypal/Observer/PayPalObserver.php | 5 +++-- .../Plugin/ReplayPayflowReCaptchaForPlaceOrder.php | 5 +++-- .../Test/Api/PayflowCaptchaGlaphQLTest.php | 5 +++-- .../Block/LayoutProcessor/Checkout/OnepageTest.php | 4 ++-- .../Test/Unit/Model/ReCaptchaSessionTest.php | 5 +++-- .../Test/Unit/Observer/PayPalObserverTest.php | 4 ++-- .../ReplayPayflowReCaptchaForPlaceOrderTest.php | 4 ++-- ReCaptchaPaypal/etc/adminhtml/system.xml | 4 ++-- ReCaptchaPaypal/etc/config.xml | 4 ++-- ReCaptchaPaypal/etc/di.xml | 9 +++++---- ReCaptchaPaypal/etc/frontend/di.xml | 4 ++-- ReCaptchaPaypal/etc/frontend/events.xml | 4 ++-- ReCaptchaPaypal/etc/module.xml | 4 ++-- ReCaptchaPaypal/etc/webapi_rest/di.xml | 4 ++-- ReCaptchaPaypal/registration.php | 5 +++-- .../view/frontend/layout/checkout_index_index.xml | 4 ++-- ReCaptchaPaypal/view/frontend/requirejs-config.js | 4 ++-- .../view/frontend/web/js/payflowpro-method-mixin.js | 5 +++-- .../view/frontend/web/js/reCaptchaPaypal.js | 4 ++-- .../Model/WebapiConfigProvider.php | 10 +--------- .../Observer/ResendConfirmationEmailObserver.php | 10 +--------- .../ResendConfirmationEmailTest.php | 10 +--------- .../etc/adminhtml/system.xml | 13 +------------ ReCaptchaResendConfirmationEmail/etc/config.xml | 13 +------------ ReCaptchaResendConfirmationEmail/etc/di.xml | 13 +------------ ReCaptchaResendConfirmationEmail/etc/module.xml | 13 +------------ ReCaptchaResendConfirmationEmail/registration.php | 10 +--------- ReCaptchaReview/Model/WebapiConfigProvider.php | 5 +++-- ReCaptchaReview/Observer/ReviewFormObserver.php | 5 +++-- .../Test/Api/GraphQl/Review/ProductReviewsTest.php | 4 ++-- ReCaptchaReview/Test/Integration/ReviewFormTest.php | 5 +++-- ReCaptchaReview/etc/adminhtml/system.xml | 6 +++--- ReCaptchaReview/etc/config.xml | 6 +++--- ReCaptchaReview/etc/di.xml | 6 +++--- ReCaptchaReview/etc/frontend/di.xml | 6 +++--- ReCaptchaReview/etc/frontend/events.xml | 6 +++--- ReCaptchaReview/etc/module.xml | 6 +++--- ReCaptchaReview/registration.php | 5 +++-- .../view/frontend/layout/catalog_product_view.xml | 6 +++--- .../view/frontend/web/css/source/_module.less | 5 +++-- ReCaptchaSendFriend/Model/WebapiConfigProvider.php | 5 +++-- ReCaptchaSendFriend/Observer/SendFriendObserver.php | 5 +++-- .../GraphQl/SendFriend/SendEmailToFriendTest.php | 5 +++-- .../Test/Integration/SendFriendFormTest.php | 5 +++-- ReCaptchaSendFriend/etc/adminhtml/system.xml | 6 +++--- ReCaptchaSendFriend/etc/config.xml | 6 +++--- ReCaptchaSendFriend/etc/di.xml | 6 +++--- ReCaptchaSendFriend/etc/frontend/di.xml | 6 +++--- ReCaptchaSendFriend/etc/frontend/events.xml | 6 +++--- ReCaptchaSendFriend/etc/module.xml | 6 +++--- ReCaptchaSendFriend/registration.php | 5 +++-- .../frontend/layout/sendfriend_product_send.xml | 6 +++--- .../view/frontend/web/css/source/_module.less | 5 +++-- .../Block/LayoutProcessor/Checkout/Onepage.php | 5 +++-- ReCaptchaStorePickup/etc/frontend/di.xml | 4 ++-- ReCaptchaStorePickup/etc/module.xml | 4 ++-- ReCaptchaStorePickup/registration.php | 5 +++-- .../view/frontend/layout/checkout_index_index.xml | 6 +++--- .../view/frontend/web/js/reCaptchaStorePickup.js | 4 ++-- ReCaptchaUi/Block/ReCaptcha.php | 5 +++-- ReCaptchaUi/Model/ButtonLock.php | 5 +++-- ReCaptchaUi/Model/CaptchaResponseResolver.php | 5 +++-- .../Model/CaptchaResponseResolverInterface.php | 5 +++-- ReCaptchaUi/Model/CaptchaTypeResolver.php | 5 +++-- ReCaptchaUi/Model/CaptchaTypeResolverInterface.php | 5 +++-- ReCaptchaUi/Model/ErrorMessageConfigInterface.php | 5 +++-- ReCaptchaUi/Model/IsCaptchaEnabled.php | 5 +++-- ReCaptchaUi/Model/IsCaptchaEnabledInterface.php | 5 +++-- ReCaptchaUi/Model/RequestHandler.php | 5 +++-- ReCaptchaUi/Model/RequestHandlerInterface.php | 5 +++-- ReCaptchaUi/Model/UiConfigProviderInterface.php | 5 +++-- ReCaptchaUi/Model/UiConfigResolver.php | 5 +++-- ReCaptchaUi/Model/UiConfigResolverInterface.php | 5 +++-- .../Model/ValidationConfigProviderInterface.php | 5 +++-- ReCaptchaUi/Model/ValidationConfigResolver.php | 5 +++-- .../Model/ValidationConfigResolverInterface.php | 5 +++-- ReCaptchaUi/etc/acl.xml | 6 +++--- ReCaptchaUi/etc/di.xml | 6 +++--- ReCaptchaUi/etc/module.xml | 6 +++--- ReCaptchaUi/registration.php | 5 +++-- ...DisableReCaptchaForUserForgotPasswordCommand.php | 5 +++-- .../Command/DisableReCaptchaForUserLoginCommand.php | 5 +++-- .../Model/DisableReCaptchaForUserForgotPassword.php | 5 +++-- .../Model/DisableReCaptchaForUserLogin.php | 5 +++-- ReCaptchaUser/Observer/ForgotPasswordObserver.php | 5 +++-- ReCaptchaUser/Observer/LoginObserver.php | 1 + .../Test/Integration/ForgotPasswordFormTest.php | 5 +++-- ReCaptchaUser/Test/Integration/LoginFormTest.php | 1 + .../ActionGroup/RecaptchaDisabledActionGroup.xml | 9 ++++----- .../ActionGroup/RecaptchaEnabledActionGroup.xml | 9 ++++----- .../Test/Mftf/Data/RecaptchaConfigPageData.xml | 9 ++++----- .../Test/Mftf/Page/AdminStoreConfigurationPage.xml | 9 ++++----- .../Test/Mftf/Section/RecaptchaFormSection.xml | 9 ++++----- .../Test/AdminLoginReCaptchaFunctionalityTest.xml | 9 ++++----- ReCaptchaUser/etc/adminhtml/events.xml | 6 +++--- ReCaptchaUser/etc/adminhtml/system.xml | 6 +++--- ReCaptchaUser/etc/config.xml | 6 +++--- ReCaptchaUser/etc/di.xml | 6 +++--- ReCaptchaUser/etc/module.xml | 6 +++--- ReCaptchaUser/registration.php | 5 +++-- .../layout/adminhtml_auth_forgotpassword.xml | 6 +++--- .../view/adminhtml/layout/adminhtml_auth_login.xml | 6 +++--- ReCaptchaUser/view/adminhtml/layout/recaptcha.xml | 6 +++--- .../view/adminhtml/templates/recaptcha.phtml | 5 +++-- ReCaptchaUser/view/adminhtml/web/css/recaptcha.less | 5 +++-- ReCaptchaValidation/Model/ReCaptcha.php | 5 +++-- ReCaptchaValidation/Model/ValidationConfig.php | 1 + ReCaptchaValidation/Model/Validator.php | 5 +++-- ReCaptchaValidation/etc/di.xml | 6 +++--- ReCaptchaValidation/etc/module.xml | 6 +++--- ReCaptchaValidation/registration.php | 5 +++-- .../Api/Data/ValidationConfigInterface.php | 5 +++-- ReCaptchaValidationApi/Api/ValidatorInterface.php | 5 +++-- .../Model/ErrorMessagesProvider.php | 5 +++-- .../Model/ValidationErrorMessagesProvider.php | 5 +++-- ReCaptchaValidationApi/etc/di.xml | 6 +++--- ReCaptchaValidationApi/etc/module.xml | 6 +++--- ReCaptchaValidationApi/registration.php | 5 +++-- .../Model/Adminhtml/UiConfigProvider.php | 5 +++-- .../Model/Adminhtml/ValidationConfigProvider.php | 5 +++-- ReCaptchaVersion2Checkbox/Model/Config.php | 10 +--------- .../Model/Frontend/UiConfigProvider.php | 5 +++-- .../Model/Frontend/ValidationConfigProvider.php | 5 +++-- ReCaptchaVersion2Checkbox/etc/adminhtml/di.xml | 6 +++--- ReCaptchaVersion2Checkbox/etc/adminhtml/system.xml | 6 +++--- ReCaptchaVersion2Checkbox/etc/config.xml | 6 +++--- ReCaptchaVersion2Checkbox/etc/csp_whitelist.xml | 4 ++-- ReCaptchaVersion2Checkbox/etc/di.xml | 6 +++--- ReCaptchaVersion2Checkbox/etc/frontend/di.xml | 6 +++--- ReCaptchaVersion2Checkbox/etc/module.xml | 6 +++--- ReCaptchaVersion2Checkbox/registration.php | 5 +++-- .../Model/Adminhtml/UiConfigProvider.php | 5 +++-- .../Model/Adminhtml/ValidationConfigProvider.php | 5 +++-- ReCaptchaVersion2Invisible/Model/Config.php | 10 +--------- .../Model/Frontend/UiConfigProvider.php | 5 +++-- .../Model/Frontend/ValidationConfigProvider.php | 5 +++-- ReCaptchaVersion2Invisible/etc/adminhtml/di.xml | 6 +++--- ReCaptchaVersion2Invisible/etc/adminhtml/system.xml | 6 +++--- ReCaptchaVersion2Invisible/etc/config.xml | 6 +++--- ReCaptchaVersion2Invisible/etc/csp_whitelist.xml | 4 ++-- ReCaptchaVersion2Invisible/etc/di.xml | 6 +++--- ReCaptchaVersion2Invisible/etc/frontend/di.xml | 6 +++--- ReCaptchaVersion2Invisible/etc/module.xml | 6 +++--- ReCaptchaVersion2Invisible/registration.php | 5 +++-- .../Model/Adminhtml/UiConfigProvider.php | 5 +++-- .../Model/Adminhtml/ValidationConfigProvider.php | 5 +++-- ReCaptchaVersion3Invisible/Model/Config.php | 5 +++-- .../Model/Frontend/UiConfigProvider.php | 5 +++-- .../Model/Frontend/ValidationConfigProvider.php | 5 +++-- ReCaptchaVersion3Invisible/etc/adminhtml/di.xml | 6 +++--- ReCaptchaVersion3Invisible/etc/adminhtml/system.xml | 6 +++--- ReCaptchaVersion3Invisible/etc/config.xml | 6 +++--- ReCaptchaVersion3Invisible/etc/csp_whitelist.xml | 4 ++-- ReCaptchaVersion3Invisible/etc/di.xml | 6 +++--- .../etc/extension_attributes.xml | 4 ++-- ReCaptchaVersion3Invisible/etc/frontend/di.xml | 6 +++--- ReCaptchaVersion3Invisible/etc/module.xml | 6 +++--- ReCaptchaVersion3Invisible/registration.php | 5 +++-- ReCaptchaWebapiApi/Api/Data/EndpointInterface.php | 5 +++-- .../Api/WebapiValidationConfigProviderInterface.php | 5 +++-- .../CompositeWebapiValidationConfigProvider.php | 5 +++-- ReCaptchaWebapiApi/Model/Data/Endpoint.php | 5 +++-- ReCaptchaWebapiApi/etc/di.xml | 5 ++--- ReCaptchaWebapiApi/etc/module.xml | 6 +++--- ReCaptchaWebapiApi/registration.php | 5 +++-- .../Model/Adapter/ReCaptchaConfigInterface.php | 10 +--------- .../Model/Resolver/ReCaptchaFormConfig.php | 10 +--------- .../Model/Resolver/ReCaptchaV3.php | 1 + ReCaptchaWebapiGraphQl/Plugin/GraphQlValidator.php | 5 +++-- .../Plugin/ValidationOverrider.php | 5 +++-- .../Test/Api/ReCaptchaFormConfigTest.php | 10 +--------- .../Test/Api/ReCaptchaV3ConfigTest.php | 4 ++-- .../Test/Unit/Plugin/GraphQlValidatorTest.php | 4 ++-- .../Test/Unit/Plugin/ValidationOverriderTest.php | 4 ++-- ReCaptchaWebapiGraphQl/etc/di.xml | 5 ++--- ReCaptchaWebapiGraphQl/etc/graphql/di.xml | 5 ++--- ReCaptchaWebapiGraphQl/etc/module.xml | 6 +++--- ReCaptchaWebapiGraphQl/etc/schema.graphqls | 10 +++++++--- ReCaptchaWebapiGraphQl/registration.php | 5 +++-- ReCaptchaWebapiRest/Plugin/RestValidationPlugin.php | 5 +++-- ReCaptchaWebapiRest/Plugin/SoapValidationPlugin.php | 5 +++-- ReCaptchaWebapiRest/Plugin/ValidationOverrider.php | 5 +++-- .../Test/Unit/Plugin/RestValidationPluginTest.php | 4 ++-- .../Test/Unit/Plugin/SoapValidationPluginTest.php | 4 ++-- .../Test/Unit/Plugin/ValidationOverriderTest.php | 4 ++-- ReCaptchaWebapiRest/etc/di.xml | 5 ++--- ReCaptchaWebapiRest/etc/module.xml | 6 +++--- ReCaptchaWebapiRest/etc/webapi_rest/di.xml | 5 ++--- ReCaptchaWebapiRest/etc/webapi_soap/di.xml | 5 ++--- ReCaptchaWebapiRest/registration.php | 5 +++-- ReCaptchaWebapiUi/etc/module.xml | 6 +++--- ReCaptchaWebapiUi/registration.php | 5 +++-- ReCaptchaWebapiUi/view/frontend/requirejs-config.js | 4 ++-- .../view/frontend/web/js/jquery-mixin.js | 4 ++-- .../view/frontend/web/js/webapiReCaptcha.js | 4 ++-- .../view/frontend/web/js/webapiReCaptchaRegistry.js | 4 ++-- .../Observer/ShareWishlistObserver.php | 3 ++- .../Test/Integration/ShareWishlistFormTest.php | 3 ++- ReCaptchaWishlist/etc/adminhtml/system.xml | 2 +- ReCaptchaWishlist/etc/config.xml | 2 +- ReCaptchaWishlist/etc/frontend/events.xml | 2 +- ReCaptchaWishlist/etc/module.xml | 2 +- ReCaptchaWishlist/registration.php | 3 ++- .../view/frontend/layout/wishlist_index_share.xml | 2 +- Securitytxt/Controller/Index/Securitytxt.php | 4 ++-- Securitytxt/Controller/Index/Securitytxtsig.php | 4 ++-- Securitytxt/Controller/Router.php | 4 ++-- Securitytxt/Model/Config.php | 4 ++-- Securitytxt/Model/Config/Backend/SecureUrl.php | 5 +++-- Securitytxt/Model/Config/Signature.php | 5 +++-- Securitytxt/Model/Securitytxt.php | 4 ++-- ...ssertFullSecurityTxtConfigurationActionGroup.xml | 9 ++++----- .../FillSecurityTxtConfigurationActionGroup.xml | 9 ++++----- .../ActionGroup/OpenSecurityTxtPageActionGroup.xml | 9 ++++----- .../OpenSecurityTxtSignaturePageActionGroup.xml | 9 ++++----- .../Test/Mftf/Data/SecuritytxtConfigData.xml | 9 ++++----- Securitytxt/Test/Mftf/Data/SecuritytxtPageData.xml | 9 ++++----- .../Mftf/Page/AdminSecurityTxtConfigurationPage.xml | 9 ++++----- .../Section/AdminConfigureSecurityTxtSection.xml | 8 ++++---- .../RedirectToNotFoundWhenSecurityTxtIsDisabled.xml | 8 ++++---- .../Test/SecurityTxtWithCorrectConfiguration.xml | 8 ++++---- Securitytxt/etc/acl.xml | 4 ++-- Securitytxt/etc/adminhtml/system.xml | 4 ++-- Securitytxt/etc/config.xml | 4 ++-- Securitytxt/etc/di.xml | 4 ++-- Securitytxt/etc/frontend/di.xml | 4 ++-- Securitytxt/etc/frontend/routes.xml | 4 ++-- Securitytxt/etc/module.xml | 4 ++-- Securitytxt/registration.php | 4 ++-- TwoFactorAuth/Api/AdminTokenServiceInterface.php | 4 ++-- TwoFactorAuth/Api/AuthyAuthenticateInterface.php | 4 ++-- TwoFactorAuth/Api/AuthyConfigureInterface.php | 4 ++-- TwoFactorAuth/Api/CountryRepositoryInterface.php | 5 +++-- .../Api/Data/AdminTokenResponseInterface.php | 4 ++-- TwoFactorAuth/Api/Data/AuthyDeviceInterface.php | 5 +++-- .../AuthyRegistrationPromptResponseInterface.php | 4 ++-- TwoFactorAuth/Api/Data/CountryInterface.php | 5 +++-- .../Api/Data/CountrySearchResultsInterface.php | 5 +++-- TwoFactorAuth/Api/Data/DuoDataInterface.php | 1 + .../Api/Data/GoogleAuthenticateInterface.php | 4 ++-- TwoFactorAuth/Api/Data/GoogleConfigureInterface.php | 5 +++-- .../Api/Data/U2fWebAuthnRequestInterface.php | 4 ++-- TwoFactorAuth/Api/Data/UserConfigInterface.php | 5 +++-- .../Api/Data/UserConfigSearchResultsInterface.php | 5 +++-- TwoFactorAuth/Api/EngineInterface.php | 5 +++-- .../Exception/NotificationExceptionInterface.php | 4 ++-- TwoFactorAuth/Api/GoogleAuthenticateInterface.php | 4 ++-- TwoFactorAuth/Api/GoogleConfigureInterface.php | 4 ++-- TwoFactorAuth/Api/ProviderInterface.php | 5 +++-- TwoFactorAuth/Api/ProviderPoolInterface.php | 5 +++-- TwoFactorAuth/Api/TfaInterface.php | 5 +++-- TwoFactorAuth/Api/TfaSessionInterface.php | 5 +++-- TwoFactorAuth/Api/TfatActionsInterface.php | 4 ++-- TwoFactorAuth/Api/U2fKeyAuthenticateInterface.php | 4 ++-- TwoFactorAuth/Api/U2fKeyConfigReaderInterface.php | 4 ++-- TwoFactorAuth/Api/U2fKeyConfigureInterface.php | 4 ++-- TwoFactorAuth/Api/UserConfigManagerInterface.php | 5 +++-- TwoFactorAuth/Api/UserConfigRepositoryInterface.php | 5 +++-- .../Api/UserConfigRequestManagerInterface.php | 4 ++-- .../Api/UserConfigTokenManagerInterface.php | 4 ++-- TwoFactorAuth/Api/UserNotifierInterface.php | 4 ++-- TwoFactorAuth/Block/ChangeProvider.php | 5 +++-- TwoFactorAuth/Block/Configure.php | 4 ++-- TwoFactorAuth/Block/ConfigureLater.php | 5 +++-- TwoFactorAuth/Block/Provider/Authy/Auth.php | 5 +++-- TwoFactorAuth/Block/Provider/Authy/Configure.php | 5 +++-- TwoFactorAuth/Block/Provider/Google/Auth.php | 5 +++-- TwoFactorAuth/Block/Provider/Google/Configure.php | 5 +++-- TwoFactorAuth/Block/Provider/U2fKey/Auth.php | 5 +++-- TwoFactorAuth/Block/Provider/U2fKey/Configure.php | 5 +++-- TwoFactorAuth/Command/GoogleSecret.php | 5 +++-- TwoFactorAuth/Command/TfaProviders.php | 5 +++-- TwoFactorAuth/Command/TfaReset.php | 5 +++-- .../Controller/Adminhtml/AbstractAction.php | 5 +++-- .../Adminhtml/AbstractConfigureAction.php | 4 ++-- TwoFactorAuth/Controller/Adminhtml/Authy/Auth.php | 5 +++-- .../Controller/Adminhtml/Authy/Authpost.php | 5 +++-- .../Controller/Adminhtml/Authy/Configure.php | 5 +++-- .../Controller/Adminhtml/Authy/Configurepost.php | 5 +++-- .../Adminhtml/Authy/Configureverifypost.php | 5 +++-- .../Controller/Adminhtml/Authy/Onetouch.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/Authy/Token.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/Authy/Verify.php | 5 +++-- .../Controller/Adminhtml/Authy/Verifyonetouch.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php | 1 + .../Controller/Adminhtml/Duo/Configure.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/Google/Auth.php | 5 +++-- .../Controller/Adminhtml/Google/Authpost.php | 5 +++-- .../Controller/Adminhtml/Google/Configure.php | 5 +++-- .../Controller/Adminhtml/Google/Configurepost.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/Google/Qr.php | 5 +++-- .../Controller/Adminhtml/Tfa/AccessDenied.php | 5 +++-- .../Controller/Adminhtml/Tfa/Configure.php | 4 ++-- .../Controller/Adminhtml/Tfa/ConfigureLater.php | 4 ++-- .../Controller/Adminhtml/Tfa/Configurepost.php | 4 ++-- TwoFactorAuth/Controller/Adminhtml/Tfa/Index.php | 5 +++-- .../Controller/Adminhtml/Tfa/Requestconfig.php | 4 ++-- TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/U2f/Auth.php | 5 +++-- TwoFactorAuth/Controller/Adminhtml/U2f/Authpost.php | 5 +++-- .../Controller/Adminhtml/U2f/Configure.php | 5 +++-- .../Controller/Adminhtml/U2f/Configurepost.php | 5 +++-- TwoFactorAuth/Model/AdminAccessTokenService.php | 4 ++-- TwoFactorAuth/Model/Alert.php | 5 +++-- TwoFactorAuth/Model/AlertInterface.php | 5 +++-- .../Model/Config/Backend/Duo/ApiHostname.php | 4 ++-- TwoFactorAuth/Model/Config/Backend/Leeway.php | 1 + .../Model/Config/Source/EnabledProvider.php | 5 +++-- TwoFactorAuth/Model/Config/Source/Provider.php | 5 +++-- TwoFactorAuth/Model/Config/UserNotifier.php | 4 ++-- TwoFactorAuth/Model/Config/WebApiUserNotifier.php | 4 ++-- TwoFactorAuth/Model/Country.php | 1 + TwoFactorAuth/Model/CountryRegistry.php | 5 +++-- TwoFactorAuth/Model/Data/AdminTokenResponse.php | 5 +++-- TwoFactorAuth/Model/Data/Country.php | 5 +++-- .../Model/Data/Provider/Engine/Authy/Device.php | 4 ++-- .../Provider/Engine/Authy/RegistrationResponse.php | 4 ++-- .../Provider/Engine/Google/AuthenticateData.php | 4 ++-- .../Provider/Engine/Google/ConfigurationData.php | 4 ++-- .../Data/Provider/Engine/U2fkey/WebAuthnRequest.php | 4 ++-- TwoFactorAuth/Model/Data/UserConfig.php | 5 +++-- TwoFactorAuth/Model/EmailUserNotifier.php | 4 ++-- .../Model/Exception/NotificationException.php | 4 ++-- TwoFactorAuth/Model/Provider.php | 5 +++-- TwoFactorAuth/Model/Provider/Engine/Authy.php | 5 +++-- .../Model/Provider/Engine/Authy/Authenticate.php | 4 ++-- .../Model/Provider/Engine/Authy/Configure.php | 4 ++-- .../Model/Provider/Engine/Authy/OneTouch.php | 5 +++-- .../Model/Provider/Engine/Authy/Service.php | 5 +++-- TwoFactorAuth/Model/Provider/Engine/Authy/Token.php | 5 +++-- .../Model/Provider/Engine/Authy/Verification.php | 5 +++-- TwoFactorAuth/Model/Provider/Engine/Google.php | 1 + .../Model/Provider/Engine/Google/Authenticate.php | 4 ++-- .../Model/Provider/Engine/Google/Configure.php | 4 ++-- .../Model/Provider/Engine/Google/TotpFactory.php | 4 ++-- TwoFactorAuth/Model/Provider/Engine/U2fKey.php | 5 +++-- .../Model/Provider/Engine/U2fKey/Authenticate.php | 4 ++-- .../Model/Provider/Engine/U2fKey/ConfigReader.php | 4 ++-- .../Model/Provider/Engine/U2fKey/Configure.php | 4 ++-- .../Model/Provider/Engine/U2fKey/Session.php | 4 ++-- .../Provider/Engine/U2fKey/WebApiConfigReader.php | 4 ++-- .../Model/Provider/Engine/U2fKey/WebAuthn.php | 4 ++-- TwoFactorAuth/Model/ProviderPool.php | 5 +++-- TwoFactorAuth/Model/ResourceModel/Country.php | 5 +++-- .../Model/ResourceModel/Country/Collection.php | 5 +++-- .../Model/ResourceModel/CountryRepository.php | 5 +++-- TwoFactorAuth/Model/ResourceModel/UserConfig.php | 1 + .../Model/ResourceModel/UserConfig/Collection.php | 5 +++-- .../Model/ResourceModel/UserConfigRepository.php | 5 +++-- TwoFactorAuth/Model/Tfa.php | 5 +++-- TwoFactorAuth/Model/TfaSession.php | 5 +++-- TwoFactorAuth/Model/TfatActions.php | 4 ++-- TwoFactorAuth/Model/UserAuthenticator.php | 4 ++-- TwoFactorAuth/Model/UserConfig.php | 1 + .../Model/UserConfig/HtmlAreaTokenVerifier.php | 4 ++-- .../Model/UserConfig/SignedTokenManager.php | 4 ++-- .../Model/UserConfig/UserConfigRequestManager.php | 4 ++-- TwoFactorAuth/Model/UserConfigManager.php | 5 +++-- TwoFactorAuth/Model/UserConfigRegistry.php | 5 +++-- TwoFactorAuth/Observer/AdminUserLoadAfter.php | 5 +++-- TwoFactorAuth/Observer/AdminUserSaveAfter.php | 5 +++-- .../Observer/ControllerActionPredispatch.php | 5 +++-- TwoFactorAuth/Plugin/AddTabToAdminUserEdit.php | 5 +++-- .../Plugin/AvoidRecursionOnPasswordChange.php | 5 +++-- TwoFactorAuth/Plugin/DeleteCookieOnLogout.php | 4 ++-- TwoFactorAuth/Plugin/FirstAvailableMenu.php | 4 ++-- .../Setup/Patch/Data/CopyConfigFromOldModule.php | 5 +++-- .../Setup/Patch/Data/EncryptConfiguration.php | 5 +++-- .../Setup/Patch/Data/EncryptGoogleSecrets.php | 5 +++-- .../Setup/Patch/Data/PopulateCountryTable.php | 5 +++-- TwoFactorAuth/Setup/Patch/Data/ResetU2fConfig.php | 5 +++-- .../Setup/Patch/Schema/CopyTablesFromOldModule.php | 5 +++-- .../Test/Api/AdminIntegrationTokenTest.php | 5 +++-- TwoFactorAuth/Test/Api/GoogleActivateTest.php | 5 +++-- TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php | 5 +++-- TwoFactorAuth/Test/Api/GoogleConfigureTest.php | 5 +++-- .../Test/Integration/Command/GoogleSecretTest.php | 4 ++-- .../Controller/Adminhtml/Authy/ConfigureTest.php | 4 ++-- .../Adminhtml/Authy/ConfigurepostTest.php | 4 ++-- .../Adminhtml/Authy/ConfigureverifypostTest.php | 4 ++-- .../Controller/Adminhtml/Google/ConfigureTest.php | 4 ++-- .../Adminhtml/Google/ConfigurepostTest.php | 4 ++-- .../Controller/Adminhtml/Tfa/ConfigureTest.php | 4 ++-- .../Controller/Adminhtml/Tfa/ConfigurepostTest.php | 4 ++-- .../Controller/Adminhtml/Tfa/RequestconfigTest.php | 4 ++-- .../Controller/Adminhtml/U2f/ConfigureTest.php | 4 ++-- .../Controller/Adminhtml/U2f/ConfigurepostTest.php | 4 ++-- .../Test/Integration/Controller/SoapTest.php | 4 ++-- .../Integration/Model/Config/UserNotifierTest.php | 4 ++-- .../Model/Config/WebApiUserNotifierTest.php | 4 ++-- .../Provider/Engine/Authy/AuthenticateTest.php | 4 ++-- .../Model/Provider/Engine/Authy/ConfigureTest.php | 4 ++-- .../Provider/Engine/U2fKey/AuthenticateTest.php | 4 ++-- .../Model/Provider/Engine/U2fKey/ConfigureTest.php | 4 ++-- .../Model/Provider/Engine/U2fKey/SessionTest.php | 4 ++-- .../Test/Integration/Model/TfaSessionTest.php | 4 ++-- .../Test/Integration/UserConfigManagerTest.php | 5 +++-- .../Test/Integration/UserConfigTokenManagerTest.php | 4 ++-- TwoFactorAuth/Test/Integration/_files/overrides.xml | 6 +++--- .../Mftf/ActionGroup/AdminCreateRoleActionGroup.xml | 8 ++++---- .../AdminCreateUserRoleWithReportsActionGroup.xml | 8 ++++---- .../AdminFillUserRoleRequiredDataActionGroup.xml | 8 ++++---- .../Test/Mftf/ActionGroup/AdminLoginActionGroup.xml | 8 ++++---- .../ActionGroup/AdminSaveUserRoleActionGroup.xml | 7 +++---- TwoFactorAuth/Test/Mftf/Data/TwoFactorAuthData.xml | 9 ++++----- TwoFactorAuth/Test/Mftf/Data/UserRoleData.xml | 9 ++++----- TwoFactorAuth/Test/Mftf/Helper/FillOtp.php | 4 ++-- TwoFactorAuth/Test/Mftf/Helper/SetSharedSecret.php | 4 ++-- .../Test/Mftf/Metadata/TwoFactorAuthMeta.xml | 8 ++++---- .../Test/Mftf/Section/AdminEditRoleInfoSection.xml | 8 ++++---- .../Test/Mftf/Section/AdminGoogleTfaSection.xml | 9 ++++----- ...tAccessibleForAdminUserWithLimitedAccessTest.xml | 8 ++++---- .../Mftf/Test/AdminConfigurationPermissionTest.xml | 8 ++++---- .../AdminReviewOrderWithReportsPermissionTest.xml | 8 ++++---- .../Test/Mftf/Test/AdminUpdateUserRoleTest.xml | 8 ++++---- ...strictedAdminCatalogMassActionPermissionTest.xml | 9 ++++----- .../RestrictedUserRoleForProductRemovalTest.xml | 8 ++++---- .../Test/RestrictedUserRoleProductAttributeTest.xml | 8 ++++---- ...derLevelAndOrderItemForAdditionalWebsiteTest.xml | 8 ++++---- .../Test/Mftf/Test/StorefrontInvoiceFilterTest.xml | 8 ++++---- .../Model/Config/Backend/Duo/ApiHostnameTest.php | 4 ++-- .../Model/Config/Backend/ForceProvidersTest.php | 4 ++-- .../Test/Unit/Model/Provider/Engine/AuthyTest.php | 4 ++-- .../Test/Unit/Model/Provider/Engine/GoogleTest.php | 4 ++-- .../Provider/Engine/U2fKey/ConfigReaderTest.php | 4 ++-- .../Engine/U2fKey/WebApiConfigReaderTest.php | 4 ++-- .../Test/Unit/Model/Provider/Engine/U2fKeyTest.php | 4 ++-- TwoFactorAuth/Test/Unit/Model/TfaTest.php | 3 +-- .../Model/UserConfig/HtmlAreaTokenVerifierTest.php | 3 +-- .../TestFramework/Plugin/BypassTwoFactorAuth.php | 4 ++-- .../TestCase/AbstractBackendController.php | 4 ++-- .../TestCase/AbstractConfigureBackendController.php | 4 ++-- .../Ui/Component/Form/User/DataProvider.php | 5 +++-- TwoFactorAuth/etc/acl.xml | 6 +++--- TwoFactorAuth/etc/adminhtml/events.xml | 4 ++-- TwoFactorAuth/etc/adminhtml/routes.xml | 4 ++-- TwoFactorAuth/etc/adminhtml/system.xml | 6 +++--- TwoFactorAuth/etc/config.xml | 6 +++--- TwoFactorAuth/etc/db_schema.xml | 4 ++-- TwoFactorAuth/etc/di.xml | 6 +++--- TwoFactorAuth/etc/email_templates.xml | 4 ++-- TwoFactorAuth/etc/module.xml | 4 ++-- TwoFactorAuth/etc/webapi.xml | 8 ++++---- TwoFactorAuth/etc/webapi_rest/di.xml | 4 ++-- TwoFactorAuth/etc/webapi_soap/di.xml | 4 ++-- TwoFactorAuth/registration.php | 5 +++-- .../view/adminhtml/email/app_config_required.html | 8 +++++--- .../view/adminhtml/email/user_config_required.html | 8 +++++--- .../view/adminhtml/layout/adminhtml_user_edit.xml | 4 ++-- .../view/adminhtml/layout/tfa_authy_auth.xml | 4 ++-- .../view/adminhtml/layout/tfa_authy_configure.xml | 4 ++-- .../view/adminhtml/layout/tfa_duo_auth.xml | 4 ++-- .../view/adminhtml/layout/tfa_google_auth.xml | 4 ++-- .../view/adminhtml/layout/tfa_google_configure.xml | 4 ++-- TwoFactorAuth/view/adminhtml/layout/tfa_screen.xml | 4 ++-- .../view/adminhtml/layout/tfa_tfa_accessdenied.xml | 4 ++-- .../view/adminhtml/layout/tfa_tfa_configure.xml | 4 ++-- .../view/adminhtml/layout/tfa_tfa_requestconfig.xml | 4 ++-- .../view/adminhtml/layout/tfa_u2f_auth.xml | 4 ++-- .../view/adminhtml/layout/tfa_u2f_configure.xml | 4 ++-- .../config/providers/modal_content_body.phtml | 4 ++-- .../adminhtml/templates/tfa/change_provider.phtml | 5 +++-- .../view/adminhtml/templates/tfa/configure.phtml | 4 ++-- .../adminhtml/templates/tfa/configure_later.phtml | 5 +++-- .../adminhtml/templates/tfa/provider/auth.phtml | 5 +++-- .../templates/tfa/provider/configure.phtml | 5 +++-- .../adminhtml/templates/tfa/request_config.phtml | 4 ++-- .../adminhtml/ui_component/tfa_edit_user_form.xml | 4 ++-- TwoFactorAuth/view/adminhtml/web/css/auth.css | 4 ++-- TwoFactorAuth/view/adminhtml/web/css/authy.css | 4 ++-- TwoFactorAuth/view/adminhtml/web/css/duo.css | 4 ++-- TwoFactorAuth/view/adminhtml/web/css/google.css | 4 ++-- TwoFactorAuth/view/adminhtml/web/css/tfa-screen.css | 4 ++-- TwoFactorAuth/view/adminhtml/web/css/tfa.css | 4 ++-- TwoFactorAuth/view/adminhtml/web/css/u2f.css | 4 ++-- TwoFactorAuth/view/adminhtml/web/js/authy/auth.js | 4 ++-- .../view/adminhtml/web/js/authy/configure.js | 4 ++-- .../adminhtml/web/js/authy/configure/register.js | 4 ++-- .../adminhtml/web/js/authy/configure/registry.js | 4 ++-- .../view/adminhtml/web/js/authy/configure/verify.js | 4 ++-- .../view/adminhtml/web/js/change_provider.js | 4 ++-- TwoFactorAuth/view/adminhtml/web/js/error.js | 4 ++-- .../view/adminhtml/web/js/form/element/providers.js | 4 ++-- .../web/js/form/element/reset_providers.js | 4 ++-- .../view/adminhtml/web/js/form/provider.js | 4 ++-- TwoFactorAuth/view/adminhtml/web/js/google/auth.js | 4 ++-- TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js | 4 ++-- .../view/adminhtml/web/js/u2fkey/configure.js | 4 ++-- TwoFactorAuth/view/adminhtml/web/js/u2fkey/utils.js | 4 ++-- .../view/adminhtml/web/template/authy/auth.html | 8 +++++--- .../adminhtml/web/template/authy/configure.html | 8 +++++--- .../web/template/authy/configure/register.html | 8 +++++--- .../web/template/authy/configure/verify.html | 8 +++++--- .../adminhtml/web/template/change_provider.html | 8 +++++--- .../web/template/form/element/providers.html | 8 +++++--- .../web/template/form/element/reset_providers.html | 8 +++++--- .../view/adminhtml/web/template/google/auth.html | 8 +++++--- .../adminhtml/web/template/google/configure.html | 8 +++++--- .../view/adminhtml/web/template/u2fkey/auth.html | 8 +++++--- .../adminhtml/web/template/u2fkey/configure.html | 8 +++++--- .../frontend/js/model/place-order-mixin.test.js | 4 ++-- 629 files changed, 1694 insertions(+), 1545 deletions(-) diff --git a/ReCaptchaAdminUi/Block/Adminhtml/System/Config/Form/Field/Notice.php b/ReCaptchaAdminUi/Block/Adminhtml/System/Config/Form/Field/Notice.php index 9a3b6032..05a38077 100644 --- a/ReCaptchaAdminUi/Block/Adminhtml/System/Config/Form/Field/Notice.php +++ b/ReCaptchaAdminUi/Block/Adminhtml/System/Config/Form/Field/Notice.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaAdminUi\Block\Adminhtml\System\Config\Form\Field; diff --git a/ReCaptchaAdminUi/Model/CaptchaTypeResolver.php b/ReCaptchaAdminUi/Model/CaptchaTypeResolver.php index 0b89bb25..5365db28 100644 --- a/ReCaptchaAdminUi/Model/CaptchaTypeResolver.php +++ b/ReCaptchaAdminUi/Model/CaptchaTypeResolver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaAdminUi\Model; diff --git a/ReCaptchaAdminUi/Model/ErrorMessageConfig.php b/ReCaptchaAdminUi/Model/ErrorMessageConfig.php index c1ee222b..4e36969e 100644 --- a/ReCaptchaAdminUi/Model/ErrorMessageConfig.php +++ b/ReCaptchaAdminUi/Model/ErrorMessageConfig.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaAdminUi\Model; diff --git a/ReCaptchaAdminUi/Model/OptionSource.php b/ReCaptchaAdminUi/Model/OptionSource.php index 12cc6a92..dff8cd99 100644 --- a/ReCaptchaAdminUi/Model/OptionSource.php +++ b/ReCaptchaAdminUi/Model/OptionSource.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaAdminUi\Model; diff --git a/ReCaptchaAdminUi/etc/adminhtml/di.xml b/ReCaptchaAdminUi/etc/adminhtml/di.xml index 9924803e..d5d37fba 100644 --- a/ReCaptchaAdminUi/etc/adminhtml/di.xml +++ b/ReCaptchaAdminUi/etc/adminhtml/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\ReCaptchaUi\Model\CaptchaTypeResolverInterface" diff --git a/ReCaptchaAdminUi/etc/adminhtml/system.xml b/ReCaptchaAdminUi/etc/adminhtml/system.xml index 01e6bb50..582a90f1 100644 --- a/ReCaptchaAdminUi/etc/adminhtml/system.xml +++ b/ReCaptchaAdminUi/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaAdminUi/etc/config.xml b/ReCaptchaAdminUi/etc/config.xml index 8f371674..18dd3c5a 100644 --- a/ReCaptchaAdminUi/etc/config.xml +++ b/ReCaptchaAdminUi/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaAdminUi/etc/di.xml b/ReCaptchaAdminUi/etc/di.xml index ce8edb48..e987bfe2 100644 --- a/ReCaptchaAdminUi/etc/di.xml +++ b/ReCaptchaAdminUi/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <virtualType name="Magento\ReCaptchaAdminUi\Model\OptionSource\Type" diff --git a/ReCaptchaAdminUi/etc/module.xml b/ReCaptchaAdminUi/etc/module.xml index 2f916eba..c57bd276 100644 --- a/ReCaptchaAdminUi/etc/module.xml +++ b/ReCaptchaAdminUi/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaAdminUi"/> diff --git a/ReCaptchaAdminUi/registration.php b/ReCaptchaAdminUi/registration.php index a6e545b4..fb9b66db 100644 --- a/ReCaptchaAdminUi/registration.php +++ b/ReCaptchaAdminUi/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less b/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less index d4623ef1..1ac8ac9b 100644 --- a/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less +++ b/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + .recaptcha_backend_type_for_recaptcha_backend_info_heading_notice, .recaptcha_frontend_type_for_recaptcha_frontend_info_heading_notice { strong { diff --git a/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php index 00b76086..a5d7932d 100644 --- a/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaCheckout/Block/LayoutProcessor/Checkout/Onepage.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckout\Block\LayoutProcessor\Checkout; diff --git a/ReCaptchaCheckout/Model/WebapiConfigProvider.php b/ReCaptchaCheckout/Model/WebapiConfigProvider.php index 34c353ef..8b5dc4b0 100644 --- a/ReCaptchaCheckout/Model/WebapiConfigProvider.php +++ b/ReCaptchaCheckout/Model/WebapiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckout\Model; diff --git a/ReCaptchaCheckout/Test/Api/GuestPaymentInformationManagementTest.php b/ReCaptchaCheckout/Test/Api/GuestPaymentInformationManagementTest.php index 5c5ef337..f9362dfa 100644 --- a/ReCaptchaCheckout/Test/Api/GuestPaymentInformationManagementTest.php +++ b/ReCaptchaCheckout/Test/Api/GuestPaymentInformationManagementTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckout\Test\Api; diff --git a/ReCaptchaCheckout/Test/Api/PaymentInformationManagementTest.php b/ReCaptchaCheckout/Test/Api/PaymentInformationManagementTest.php index 85fab723..35080398 100644 --- a/ReCaptchaCheckout/Test/Api/PaymentInformationManagementTest.php +++ b/ReCaptchaCheckout/Test/Api/PaymentInformationManagementTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckout\Test\Api; diff --git a/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php index 91a38a08..d2c0f9dd 100644 --- a/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php +++ b/ReCaptchaCheckout/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckout\Test\Unit\Block\LayoutProcessor\Checkout; diff --git a/ReCaptchaCheckout/etc/adminhtml/system.xml b/ReCaptchaCheckout/etc/adminhtml/system.xml index 6be7fbe7..cb760012 100644 --- a/ReCaptchaCheckout/etc/adminhtml/system.xml +++ b/ReCaptchaCheckout/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaCheckout/etc/config.xml b/ReCaptchaCheckout/etc/config.xml index 8a1ce1fc..a60bd8ee 100644 --- a/ReCaptchaCheckout/etc/config.xml +++ b/ReCaptchaCheckout/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaCheckout/etc/di.xml b/ReCaptchaCheckout/etc/di.xml index 401b976b..b4010553 100644 --- a/ReCaptchaCheckout/etc/di.xml +++ b/ReCaptchaCheckout/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> diff --git a/ReCaptchaCheckout/etc/frontend/di.xml b/ReCaptchaCheckout/etc/frontend/di.xml index 1d10cbea..3689d325 100644 --- a/ReCaptchaCheckout/etc/frontend/di.xml +++ b/ReCaptchaCheckout/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/ReCaptchaCheckout/etc/module.xml b/ReCaptchaCheckout/etc/module.xml index b260cb48..7550e9e7 100644 --- a/ReCaptchaCheckout/etc/module.xml +++ b/ReCaptchaCheckout/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaCheckout"/> diff --git a/ReCaptchaCheckout/registration.php b/ReCaptchaCheckout/registration.php index 10e710d0..80dffeac 100644 --- a/ReCaptchaCheckout/registration.php +++ b/ReCaptchaCheckout/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml b/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml index ffc3c6ef..193dc1bf 100644 --- a/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml +++ b/ReCaptchaCheckout/view/frontend/layout/checkout_index_index.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaCheckout/view/frontend/requirejs-config.js b/ReCaptchaCheckout/view/frontend/requirejs-config.js index 57feceac..e112d147 100644 --- a/ReCaptchaCheckout/view/frontend/requirejs-config.js +++ b/ReCaptchaCheckout/view/frontend/requirejs-config.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ // eslint-disable-next-line no-unused-vars diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 9dae44fe..7ea7751f 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ /* eslint-disable max-nested-callbacks */ diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js index cbc51637..9d60f3f8 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ define( diff --git a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js index b7780d54..315ba718 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ define([], function () { diff --git a/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html b/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html index 932ecd74..9f5884ff 100644 --- a/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html +++ b/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div> <each args="data: getRegion('place-order-recaptcha'), as: 'recaptcha'" render=""></each> diff --git a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html index 9ea1c08c..adfe3202 100644 --- a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ + +<!-- + --> <!-- ko if: (isCheckoutReCaptchaRequiredFor($parents[1]))--> <div class="recaptcha-checkout-place-order" data-bind="{ diff --git a/ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php index 6cf7b10f..7c09a820 100644 --- a/ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaCheckoutSalesRule/Block/LayoutProcessor/Checkout/Onepage.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckoutSalesRule\Block\LayoutProcessor\Checkout; diff --git a/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php b/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php index 422313db..a72eb04e 100644 --- a/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php +++ b/ReCaptchaCheckoutSalesRule/Model/WebapiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckoutSalesRule\Model; diff --git a/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php index 47a5fb0e..5d7c0e19 100644 --- a/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php +++ b/ReCaptchaCheckoutSalesRule/Observer/CouponCodeObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckoutSalesRule\Observer; diff --git a/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php b/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php index 309d8cfd..5240be4b 100644 --- a/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php +++ b/ReCaptchaCheckoutSalesRule/Plugin/CouponSetLayoutPlugin.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + namespace Magento\ReCaptchaCheckoutSalesRule\Plugin; use Magento\Checkout\Block\Cart\Coupon; diff --git a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php index 262cb0c7..a9c937b7 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckoutSalesRule\Test\Api; diff --git a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php index 17240f73..bdba974a 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckoutSalesRule\Test\Api; diff --git a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php index 3091bc06..c36e5b03 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Integration/CouponApplyPostTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCheckoutSalesRule\Test\Integration; diff --git a/ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml b/ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml index 87faa3b0..f8219494 100644 --- a/ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml +++ b/ReCaptchaCheckoutSalesRule/etc/adminhtml/system.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaCheckoutSalesRule/etc/config.xml b/ReCaptchaCheckoutSalesRule/etc/config.xml index a49b695d..065a7ff3 100644 --- a/ReCaptchaCheckoutSalesRule/etc/config.xml +++ b/ReCaptchaCheckoutSalesRule/etc/config.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaCheckoutSalesRule/etc/di.xml b/ReCaptchaCheckoutSalesRule/etc/di.xml index f35f2636..c123061e 100644 --- a/ReCaptchaCheckoutSalesRule/etc/di.xml +++ b/ReCaptchaCheckoutSalesRule/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> diff --git a/ReCaptchaCheckoutSalesRule/etc/frontend/di.xml b/ReCaptchaCheckoutSalesRule/etc/frontend/di.xml index 6130ef3c..ad5d551e 100644 --- a/ReCaptchaCheckoutSalesRule/etc/frontend/di.xml +++ b/ReCaptchaCheckoutSalesRule/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Checkout\Block\Cart\Coupon"> diff --git a/ReCaptchaCheckoutSalesRule/etc/frontend/events.xml b/ReCaptchaCheckoutSalesRule/etc/frontend/events.xml index 2436e87d..501baa46 100644 --- a/ReCaptchaCheckoutSalesRule/etc/frontend/events.xml +++ b/ReCaptchaCheckoutSalesRule/etc/frontend/events.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_checkout_cart_couponPost"> diff --git a/ReCaptchaCheckoutSalesRule/etc/module.xml b/ReCaptchaCheckoutSalesRule/etc/module.xml index ea717982..8fc9b371 100644 --- a/ReCaptchaCheckoutSalesRule/etc/module.xml +++ b/ReCaptchaCheckoutSalesRule/etc/module.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaCheckoutSalesRule/registration.php b/ReCaptchaCheckoutSalesRule/registration.php index adf95955..022d1c62 100644 --- a/ReCaptchaCheckoutSalesRule/registration.php +++ b/ReCaptchaCheckoutSalesRule/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_cart_index.xml b/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_cart_index.xml index ed061fbe..f0ec7f0a 100644 --- a/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_cart_index.xml +++ b/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_cart_index.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml b/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml index 7509e6eb..bee81f33 100644 --- a/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml +++ b/ReCaptchaCheckoutSalesRule/view/frontend/layout/checkout_index_index.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less b/ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less index 85870020..2f816705 100644 --- a/ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less +++ b/ReCaptchaCheckoutSalesRule/view/frontend/web/css/source/_module.less @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + .form-discount { .g-recaptcha { margin-top: 50px !important; diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js index 551c4558..1d12f2b2 100644 --- a/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js +++ b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + /* global grecaptcha */ define( [ diff --git a/ReCaptchaContact/Observer/ContactFormObserver.php b/ReCaptchaContact/Observer/ContactFormObserver.php index 4ff8d9e0..287b1dd0 100644 --- a/ReCaptchaContact/Observer/ContactFormObserver.php +++ b/ReCaptchaContact/Observer/ContactFormObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaContact\Observer; diff --git a/ReCaptchaContact/Test/Integration/ContactFormTest.php b/ReCaptchaContact/Test/Integration/ContactFormTest.php index 18f3470a..a07edbc4 100644 --- a/ReCaptchaContact/Test/Integration/ContactFormTest.php +++ b/ReCaptchaContact/Test/Integration/ContactFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaContact\Test\Integration; diff --git a/ReCaptchaContact/etc/adminhtml/system.xml b/ReCaptchaContact/etc/adminhtml/system.xml index 8b7b7e8d..29bac289 100644 --- a/ReCaptchaContact/etc/adminhtml/system.xml +++ b/ReCaptchaContact/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaContact/etc/config.xml b/ReCaptchaContact/etc/config.xml index a7060fc1..4f7ae61d 100644 --- a/ReCaptchaContact/etc/config.xml +++ b/ReCaptchaContact/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaContact/etc/frontend/di.xml b/ReCaptchaContact/etc/frontend/di.xml index ee228c25..47bf3e1c 100644 --- a/ReCaptchaContact/etc/frontend/di.xml +++ b/ReCaptchaContact/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/ReCaptchaContact/etc/frontend/events.xml b/ReCaptchaContact/etc/frontend/events.xml index 45a325a0..8e56819e 100644 --- a/ReCaptchaContact/etc/frontend/events.xml +++ b/ReCaptchaContact/etc/frontend/events.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_contact_index_post"> diff --git a/ReCaptchaContact/etc/module.xml b/ReCaptchaContact/etc/module.xml index 10f3f1ed..2c7573c7 100644 --- a/ReCaptchaContact/etc/module.xml +++ b/ReCaptchaContact/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaContact"/> diff --git a/ReCaptchaContact/registration.php b/ReCaptchaContact/registration.php index aac21c51..eb473733 100644 --- a/ReCaptchaContact/registration.php +++ b/ReCaptchaContact/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaContact/view/frontend/layout/contact_index_index.xml b/ReCaptchaContact/view/frontend/layout/contact_index_index.xml index 7068b36d..d60862d5 100644 --- a/ReCaptchaContact/view/frontend/layout/contact_index_index.xml +++ b/ReCaptchaContact/view/frontend/layout/contact_index_index.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> diff --git a/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php b/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php index dacd2c8f..beae9ad7 100644 --- a/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php +++ b/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Model\AjaxLogin; diff --git a/ReCaptchaCustomer/Model/AjaxLogin/ErrorProcessor.php b/ReCaptchaCustomer/Model/AjaxLogin/ErrorProcessor.php index aabc9014..088b5dd2 100644 --- a/ReCaptchaCustomer/Model/AjaxLogin/ErrorProcessor.php +++ b/ReCaptchaCustomer/Model/AjaxLogin/ErrorProcessor.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Model\AjaxLogin; diff --git a/ReCaptchaCustomer/Model/WebapiConfigProvider.php b/ReCaptchaCustomer/Model/WebapiConfigProvider.php index 3915f43d..94c97190 100644 --- a/ReCaptchaCustomer/Model/WebapiConfigProvider.php +++ b/ReCaptchaCustomer/Model/WebapiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Model; diff --git a/ReCaptchaCustomer/Observer/AjaxLoginObserver.php b/ReCaptchaCustomer/Observer/AjaxLoginObserver.php index 10b54cce..38de61da 100644 --- a/ReCaptchaCustomer/Observer/AjaxLoginObserver.php +++ b/ReCaptchaCustomer/Observer/AjaxLoginObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Observer; diff --git a/ReCaptchaCustomer/Observer/CreateCustomerObserver.php b/ReCaptchaCustomer/Observer/CreateCustomerObserver.php index c4e773c9..d5e332b9 100644 --- a/ReCaptchaCustomer/Observer/CreateCustomerObserver.php +++ b/ReCaptchaCustomer/Observer/CreateCustomerObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Observer; diff --git a/ReCaptchaCustomer/Observer/EditCustomerObserver.php b/ReCaptchaCustomer/Observer/EditCustomerObserver.php index 6ab19f0e..fb99862d 100644 --- a/ReCaptchaCustomer/Observer/EditCustomerObserver.php +++ b/ReCaptchaCustomer/Observer/EditCustomerObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Observer; diff --git a/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php b/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php index e352442b..a5a2628d 100644 --- a/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php +++ b/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Observer; diff --git a/ReCaptchaCustomer/Observer/LoginObserver.php b/ReCaptchaCustomer/Observer/LoginObserver.php index bb49da21..9eec902b 100644 --- a/ReCaptchaCustomer/Observer/LoginObserver.php +++ b/ReCaptchaCustomer/Observer/LoginObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Observer; diff --git a/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php b/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php index 57ead070..b08cb63e 100644 --- a/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php +++ b/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Plugin\Block\Account; diff --git a/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaGlaphQLTest.php b/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaGlaphQLTest.php index 9ec67606..7052198c 100644 --- a/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaGlaphQLTest.php +++ b/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaGlaphQLTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Test\Api; diff --git a/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php b/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php index 3673da27..7edae82a 100644 --- a/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php +++ b/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Test\Api; diff --git a/ReCaptchaCustomer/Test/Api/LoginGraphQlTest.php b/ReCaptchaCustomer/Test/Api/LoginGraphQlTest.php index 5893b33c..e72754cc 100644 --- a/ReCaptchaCustomer/Test/Api/LoginGraphQlTest.php +++ b/ReCaptchaCustomer/Test/Api/LoginGraphQlTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/ReCaptchaCustomer/Test/Api/LoginTest.php b/ReCaptchaCustomer/Test/Api/LoginTest.php index e08f88ba..1675f78a 100644 --- a/ReCaptchaCustomer/Test/Api/LoginTest.php +++ b/ReCaptchaCustomer/Test/Api/LoginTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/ReCaptchaCustomer/Test/Api/RegisterGraphQlTest.php b/ReCaptchaCustomer/Test/Api/RegisterGraphQlTest.php index b0d7a7dc..0a4e4251 100644 --- a/ReCaptchaCustomer/Test/Api/RegisterGraphQlTest.php +++ b/ReCaptchaCustomer/Test/Api/RegisterGraphQlTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/ReCaptchaCustomer/Test/Api/RegisterTest.php b/ReCaptchaCustomer/Test/Api/RegisterTest.php index dda2d5fb..1567c424 100644 --- a/ReCaptchaCustomer/Test/Api/RegisterTest.php +++ b/ReCaptchaCustomer/Test/Api/RegisterTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/ReCaptchaCustomer/Test/Integration/AjaxLoginFormTest.php b/ReCaptchaCustomer/Test/Integration/AjaxLoginFormTest.php index bc60aa3b..8780dfdd 100644 --- a/ReCaptchaCustomer/Test/Integration/AjaxLoginFormTest.php +++ b/ReCaptchaCustomer/Test/Integration/AjaxLoginFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Test\Integration; diff --git a/ReCaptchaCustomer/Test/Integration/CreateCustomerFormTest.php b/ReCaptchaCustomer/Test/Integration/CreateCustomerFormTest.php index d4440267..8acc7702 100644 --- a/ReCaptchaCustomer/Test/Integration/CreateCustomerFormTest.php +++ b/ReCaptchaCustomer/Test/Integration/CreateCustomerFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Test\Integration; diff --git a/ReCaptchaCustomer/Test/Integration/EditFromTest.php b/ReCaptchaCustomer/Test/Integration/EditFromTest.php index 885c7e66..289560a5 100644 --- a/ReCaptchaCustomer/Test/Integration/EditFromTest.php +++ b/ReCaptchaCustomer/Test/Integration/EditFromTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Test\Integration; diff --git a/ReCaptchaCustomer/Test/Integration/ForgotPasswordFormTest.php b/ReCaptchaCustomer/Test/Integration/ForgotPasswordFormTest.php index 3504ce38..e70132f1 100644 --- a/ReCaptchaCustomer/Test/Integration/ForgotPasswordFormTest.php +++ b/ReCaptchaCustomer/Test/Integration/ForgotPasswordFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Test\Integration; diff --git a/ReCaptchaCustomer/Test/Integration/LoginFromTest.php b/ReCaptchaCustomer/Test/Integration/LoginFromTest.php index ee0df5ae..18abdcf1 100644 --- a/ReCaptchaCustomer/Test/Integration/LoginFromTest.php +++ b/ReCaptchaCustomer/Test/Integration/LoginFromTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaCustomer\Test\Integration; diff --git a/ReCaptchaCustomer/etc/adminhtml/system.xml b/ReCaptchaCustomer/etc/adminhtml/system.xml index 27b3bd28..6dd66a56 100644 --- a/ReCaptchaCustomer/etc/adminhtml/system.xml +++ b/ReCaptchaCustomer/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaCustomer/etc/config.xml b/ReCaptchaCustomer/etc/config.xml index 11ee5351..239f5cde 100644 --- a/ReCaptchaCustomer/etc/config.xml +++ b/ReCaptchaCustomer/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaCustomer/etc/di.xml b/ReCaptchaCustomer/etc/di.xml index 7751d8cd..40c37502 100644 --- a/ReCaptchaCustomer/etc/di.xml +++ b/ReCaptchaCustomer/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> diff --git a/ReCaptchaCustomer/etc/frontend/di.xml b/ReCaptchaCustomer/etc/frontend/di.xml index e32489da..7572ae1b 100644 --- a/ReCaptchaCustomer/etc/frontend/di.xml +++ b/ReCaptchaCustomer/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/ReCaptchaCustomer/etc/frontend/events.xml b/ReCaptchaCustomer/etc/frontend/events.xml index 8166d9b6..212948ef 100644 --- a/ReCaptchaCustomer/etc/frontend/events.xml +++ b/ReCaptchaCustomer/etc/frontend/events.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_customer_account_loginPost"> diff --git a/ReCaptchaCustomer/etc/module.xml b/ReCaptchaCustomer/etc/module.xml index 0d20ca70..ec3d50d8 100644 --- a/ReCaptchaCustomer/etc/module.xml +++ b/ReCaptchaCustomer/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaCustomer"/> diff --git a/ReCaptchaCustomer/registration.php b/ReCaptchaCustomer/registration.php index 50426e2d..bd7b486d 100644 --- a/ReCaptchaCustomer/registration.php +++ b/ReCaptchaCustomer/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaCustomer/view/frontend/layout/customer_account_create.xml b/ReCaptchaCustomer/view/frontend/layout/customer_account_create.xml index cb9186f6..a410d3b7 100644 --- a/ReCaptchaCustomer/view/frontend/layout/customer_account_create.xml +++ b/ReCaptchaCustomer/view/frontend/layout/customer_account_create.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaCustomer/view/frontend/layout/customer_account_edit.xml b/ReCaptchaCustomer/view/frontend/layout/customer_account_edit.xml index 11a1de9a..ffd21e84 100644 --- a/ReCaptchaCustomer/view/frontend/layout/customer_account_edit.xml +++ b/ReCaptchaCustomer/view/frontend/layout/customer_account_edit.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaCustomer/view/frontend/layout/customer_account_forgotpassword.xml b/ReCaptchaCustomer/view/frontend/layout/customer_account_forgotpassword.xml index 77127af3..fd10a737 100644 --- a/ReCaptchaCustomer/view/frontend/layout/customer_account_forgotpassword.xml +++ b/ReCaptchaCustomer/view/frontend/layout/customer_account_forgotpassword.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> diff --git a/ReCaptchaCustomer/view/frontend/layout/customer_account_login.xml b/ReCaptchaCustomer/view/frontend/layout/customer_account_login.xml index 70c005bf..6fbd5bdd 100644 --- a/ReCaptchaCustomer/view/frontend/layout/customer_account_login.xml +++ b/ReCaptchaCustomer/view/frontend/layout/customer_account_login.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> diff --git a/ReCaptchaCustomer/view/frontend/layout/default.xml b/ReCaptchaCustomer/view/frontend/layout/default.xml index 5a1e04d0..74abc79a 100644 --- a/ReCaptchaCustomer/view/frontend/layout/default.xml +++ b/ReCaptchaCustomer/view/frontend/layout/default.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaCustomer/view/frontend/web/css/source/_module.less b/ReCaptchaCustomer/view/frontend/web/css/source/_module.less index f2958ae5..e96a4f9c 100644 --- a/ReCaptchaCustomer/view/frontend/web/css/source/_module.less +++ b/ReCaptchaCustomer/view/frontend/web/css/source/_module.less @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + .login-container, .form-login, .form-edit-account { diff --git a/ReCaptchaFrontendUi/Model/CaptchaTypeResolver.php b/ReCaptchaFrontendUi/Model/CaptchaTypeResolver.php index 56ce5019..6e68e443 100644 --- a/ReCaptchaFrontendUi/Model/CaptchaTypeResolver.php +++ b/ReCaptchaFrontendUi/Model/CaptchaTypeResolver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaFrontendUi\Model; diff --git a/ReCaptchaFrontendUi/Model/ErrorMessageConfig.php b/ReCaptchaFrontendUi/Model/ErrorMessageConfig.php index 47234e8d..8b09eaf3 100644 --- a/ReCaptchaFrontendUi/Model/ErrorMessageConfig.php +++ b/ReCaptchaFrontendUi/Model/ErrorMessageConfig.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaFrontendUi\Model; diff --git a/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php b/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php index d5c2994d..50233e0d 100644 --- a/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php +++ b/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaFrontendUi\Plugin; diff --git a/ReCaptchaFrontendUi/etc/adminhtml/system.xml b/ReCaptchaFrontendUi/etc/adminhtml/system.xml index e97642ff..f56ed694 100644 --- a/ReCaptchaFrontendUi/etc/adminhtml/system.xml +++ b/ReCaptchaFrontendUi/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaFrontendUi/etc/config.xml b/ReCaptchaFrontendUi/etc/config.xml index 81154a13..23155a04 100644 --- a/ReCaptchaFrontendUi/etc/config.xml +++ b/ReCaptchaFrontendUi/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaFrontendUi/etc/di.xml b/ReCaptchaFrontendUi/etc/di.xml index a8a4fa8e..64f067ec 100644 --- a/ReCaptchaFrontendUi/etc/di.xml +++ b/ReCaptchaFrontendUi/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaUi\Model\CaptchaTypeResolver"> diff --git a/ReCaptchaFrontendUi/etc/frontend/di.xml b/ReCaptchaFrontendUi/etc/frontend/di.xml index 56f11f03..6bde9e80 100644 --- a/ReCaptchaFrontendUi/etc/frontend/di.xml +++ b/ReCaptchaFrontendUi/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\ReCaptchaUi\Model\CaptchaTypeResolverInterface" diff --git a/ReCaptchaFrontendUi/etc/module.xml b/ReCaptchaFrontendUi/etc/module.xml index b3b392d9..f2073c14 100644 --- a/ReCaptchaFrontendUi/etc/module.xml +++ b/ReCaptchaFrontendUi/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaFrontendUi"/> diff --git a/ReCaptchaFrontendUi/registration.php b/ReCaptchaFrontendUi/registration.php index ba5e8ba4..ade81895 100644 --- a/ReCaptchaFrontendUi/registration.php +++ b/ReCaptchaFrontendUi/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaFrontendUi/view/frontend/requirejs-config.js b/ReCaptchaFrontendUi/view/frontend/requirejs-config.js index e39ef6c1..b62d9b69 100644 --- a/ReCaptchaFrontendUi/view/frontend/requirejs-config.js +++ b/ReCaptchaFrontendUi/view/frontend/requirejs-config.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ /*eslint strict: ["error", "global"]*/ diff --git a/ReCaptchaFrontendUi/view/frontend/templates/recaptcha.phtml b/ReCaptchaFrontendUi/view/frontend/templates/recaptcha.phtml index 37c54aad..d5694c96 100644 --- a/ReCaptchaFrontendUi/view/frontend/templates/recaptcha.phtml +++ b/ReCaptchaFrontendUi/view/frontend/templates/recaptcha.phtml @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); /** @var $block \Magento\ReCaptchaUi\Block\ReCaptcha */ diff --git a/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less b/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less index 65e31f0f..6f07f7db 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less +++ b/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + .required-captcha.checkbox{ position: absolute; display: block; diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js b/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js index ee07822a..ccec8338 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ /* global grecaptcha */ diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index 4fdca404..995de4ea 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ /* global grecaptcha */ diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js index 94746c33..a241974c 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([], function () { diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/registry.js b/ReCaptchaFrontendUi/view/frontend/web/js/registry.js index 2ff47a0c..e5909097 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/registry.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/registry.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define(['ko'], function (ko) { diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js b/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js index 86713ef4..5e67ffdf 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define(['Magento_ReCaptchaFrontendUi/js/registry'], function (registry) { diff --git a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html index e8a16dad..019a721c 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div data-bind="{ diff --git a/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php b/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php index 1c131d6a..8203178d 100644 --- a/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php +++ b/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaMigration\Setup\Patch\Data; diff --git a/ReCaptchaMigration/etc/module.xml b/ReCaptchaMigration/etc/module.xml index be65c266..fc23b4d5 100644 --- a/ReCaptchaMigration/etc/module.xml +++ b/ReCaptchaMigration/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaMigration"/> diff --git a/ReCaptchaMigration/registration.php b/ReCaptchaMigration/registration.php index d47e5be1..ae586447 100644 --- a/ReCaptchaMigration/registration.php +++ b/ReCaptchaMigration/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaNewsletter/Model/WebapiConfigProvider.php b/ReCaptchaNewsletter/Model/WebapiConfigProvider.php index ac60b186..d8d98393 100644 --- a/ReCaptchaNewsletter/Model/WebapiConfigProvider.php +++ b/ReCaptchaNewsletter/Model/WebapiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaNewsletter\Model; diff --git a/ReCaptchaNewsletter/Observer/NewsletterObserver.php b/ReCaptchaNewsletter/Observer/NewsletterObserver.php index d399ec46..7ba04cc8 100644 --- a/ReCaptchaNewsletter/Observer/NewsletterObserver.php +++ b/ReCaptchaNewsletter/Observer/NewsletterObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaNewsletter\Observer; diff --git a/ReCaptchaNewsletter/Test/Api/GraphQl/SubscribeEmailToNewsletter/SubscribeEmailToNewsletterCaptchaTest.php b/ReCaptchaNewsletter/Test/Api/GraphQl/SubscribeEmailToNewsletter/SubscribeEmailToNewsletterCaptchaTest.php index 3d87aeb8..0514a6b3 100644 --- a/ReCaptchaNewsletter/Test/Api/GraphQl/SubscribeEmailToNewsletter/SubscribeEmailToNewsletterCaptchaTest.php +++ b/ReCaptchaNewsletter/Test/Api/GraphQl/SubscribeEmailToNewsletter/SubscribeEmailToNewsletterCaptchaTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaNewsletter\Test\Api\GraphQl\SubscribeEmailToNewsletter; diff --git a/ReCaptchaNewsletter/Test/Integration/NewsletterFormTest.php b/ReCaptchaNewsletter/Test/Integration/NewsletterFormTest.php index fb27ee92..4532b8b8 100644 --- a/ReCaptchaNewsletter/Test/Integration/NewsletterFormTest.php +++ b/ReCaptchaNewsletter/Test/Integration/NewsletterFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaNewsletter\Test\Integration; diff --git a/ReCaptchaNewsletter/etc/adminhtml/system.xml b/ReCaptchaNewsletter/etc/adminhtml/system.xml index ca0109b6..47d63e30 100644 --- a/ReCaptchaNewsletter/etc/adminhtml/system.xml +++ b/ReCaptchaNewsletter/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaNewsletter/etc/config.xml b/ReCaptchaNewsletter/etc/config.xml index 56acb6bd..c2d01b98 100644 --- a/ReCaptchaNewsletter/etc/config.xml +++ b/ReCaptchaNewsletter/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaNewsletter/etc/di.xml b/ReCaptchaNewsletter/etc/di.xml index cd496bad..fa8247b8 100644 --- a/ReCaptchaNewsletter/etc/di.xml +++ b/ReCaptchaNewsletter/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> diff --git a/ReCaptchaNewsletter/etc/frontend/di.xml b/ReCaptchaNewsletter/etc/frontend/di.xml index 4622e4c3..d3a20fd2 100644 --- a/ReCaptchaNewsletter/etc/frontend/di.xml +++ b/ReCaptchaNewsletter/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/ReCaptchaNewsletter/etc/frontend/events.xml b/ReCaptchaNewsletter/etc/frontend/events.xml index 9cc0e365..da816118 100644 --- a/ReCaptchaNewsletter/etc/frontend/events.xml +++ b/ReCaptchaNewsletter/etc/frontend/events.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_newsletter_subscriber_new"> diff --git a/ReCaptchaNewsletter/etc/module.xml b/ReCaptchaNewsletter/etc/module.xml index f684e0f8..088bd1f6 100644 --- a/ReCaptchaNewsletter/etc/module.xml +++ b/ReCaptchaNewsletter/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaNewsletter"/> diff --git a/ReCaptchaNewsletter/registration.php b/ReCaptchaNewsletter/registration.php index e5c20536..6011ad42 100644 --- a/ReCaptchaNewsletter/registration.php +++ b/ReCaptchaNewsletter/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaNewsletter/view/frontend/layout/default.xml b/ReCaptchaNewsletter/view/frontend/layout/default.xml index 992d56d7..266da426 100644 --- a/ReCaptchaNewsletter/view/frontend/layout/default.xml +++ b/ReCaptchaNewsletter/view/frontend/layout/default.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaNewsletter/view/frontend/templates/recaptcha_newsletter.phtml b/ReCaptchaNewsletter/view/frontend/templates/recaptcha_newsletter.phtml index d53a4062..9cc06440 100644 --- a/ReCaptchaNewsletter/view/frontend/templates/recaptcha_newsletter.phtml +++ b/ReCaptchaNewsletter/view/frontend/templates/recaptcha_newsletter.phtml @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); /** @var $block \Magento\ReCaptchaUi\Block\ReCaptcha */ diff --git a/ReCaptchaNewsletter/view/frontend/web/css/source/_module.less b/ReCaptchaNewsletter/view/frontend/web/css/source/_module.less index 563319cd..dbd86986 100644 --- a/ReCaptchaNewsletter/view/frontend/web/css/source/_module.less +++ b/ReCaptchaNewsletter/view/frontend/web/css/source/_module.less @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ .block.newsletter { diff --git a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php index 16a6c528..b4a31ee4 100644 --- a/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaPaypal/Block/LayoutProcessor/Checkout/Onepage.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Block\LayoutProcessor\Checkout; diff --git a/ReCaptchaPaypal/Model/CheckoutConfigProvider.php b/ReCaptchaPaypal/Model/CheckoutConfigProvider.php index ce2a338c..56327218 100644 --- a/ReCaptchaPaypal/Model/CheckoutConfigProvider.php +++ b/ReCaptchaPaypal/Model/CheckoutConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Model; diff --git a/ReCaptchaPaypal/Model/ReCaptchaSession.php b/ReCaptchaPaypal/Model/ReCaptchaSession.php index 2e805236..d2563d4a 100644 --- a/ReCaptchaPaypal/Model/ReCaptchaSession.php +++ b/ReCaptchaPaypal/Model/ReCaptchaSession.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Model; diff --git a/ReCaptchaPaypal/Model/WebapiConfigProvider.php b/ReCaptchaPaypal/Model/WebapiConfigProvider.php index 752579b5..868069bc 100644 --- a/ReCaptchaPaypal/Model/WebapiConfigProvider.php +++ b/ReCaptchaPaypal/Model/WebapiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Model; diff --git a/ReCaptchaPaypal/Observer/PayPalObserver.php b/ReCaptchaPaypal/Observer/PayPalObserver.php index ba4e0e25..d5bde1e6 100644 --- a/ReCaptchaPaypal/Observer/PayPalObserver.php +++ b/ReCaptchaPaypal/Observer/PayPalObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Observer; diff --git a/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php index d648246d..20809d42 100644 --- a/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php +++ b/ReCaptchaPaypal/Plugin/ReplayPayflowReCaptchaForPlaceOrder.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Plugin; diff --git a/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php b/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php index 58994f3c..b1f2ac0f 100644 --- a/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php +++ b/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Test\Api; diff --git a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php index 25a6f3d1..30de658a 100644 --- a/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php +++ b/ReCaptchaPaypal/Test/Unit/Block/LayoutProcessor/Checkout/OnepageTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Test\Unit\Block\LayoutProcessor\Checkout; diff --git a/ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php b/ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php index 58112e20..990f7883 100644 --- a/ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php +++ b/ReCaptchaPaypal/Test/Unit/Model/ReCaptchaSessionTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Test\Unit\Model; diff --git a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php index 860d3724..aad0e7cb 100644 --- a/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php +++ b/ReCaptchaPaypal/Test/Unit/Observer/PayPalObserverTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Test\Unit\Observer; diff --git a/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php index b5e2f600..3203cd9e 100644 --- a/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php +++ b/ReCaptchaPaypal/Test/Unit/Plugin/ReplayPayflowReCaptchaForPlaceOrderTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaPaypal\Test\Unit\Plugin; diff --git a/ReCaptchaPaypal/etc/adminhtml/system.xml b/ReCaptchaPaypal/etc/adminhtml/system.xml index 358278cc..629ca6a5 100644 --- a/ReCaptchaPaypal/etc/adminhtml/system.xml +++ b/ReCaptchaPaypal/etc/adminhtml/system.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaPaypal/etc/config.xml b/ReCaptchaPaypal/etc/config.xml index bce55f77..d1f2c2c8 100644 --- a/ReCaptchaPaypal/etc/config.xml +++ b/ReCaptchaPaypal/etc/config.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaPaypal/etc/di.xml b/ReCaptchaPaypal/etc/di.xml index d52a6d06..bf8b227d 100644 --- a/ReCaptchaPaypal/etc/di.xml +++ b/ReCaptchaPaypal/etc/di.xml @@ -1,10 +1,11 @@ - <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> + + <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> diff --git a/ReCaptchaPaypal/etc/frontend/di.xml b/ReCaptchaPaypal/etc/frontend/di.xml index d63b8637..3dd88e60 100644 --- a/ReCaptchaPaypal/etc/frontend/di.xml +++ b/ReCaptchaPaypal/etc/frontend/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaPaypal/etc/frontend/events.xml b/ReCaptchaPaypal/etc/frontend/events.xml index e63b462b..65fc5fd7 100644 --- a/ReCaptchaPaypal/etc/frontend/events.xml +++ b/ReCaptchaPaypal/etc/frontend/events.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaPaypal/etc/module.xml b/ReCaptchaPaypal/etc/module.xml index 2f140fdb..1d22d648 100644 --- a/ReCaptchaPaypal/etc/module.xml +++ b/ReCaptchaPaypal/etc/module.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaPaypal/etc/webapi_rest/di.xml b/ReCaptchaPaypal/etc/webapi_rest/di.xml index 67b665f2..4d513e98 100644 --- a/ReCaptchaPaypal/etc/webapi_rest/di.xml +++ b/ReCaptchaPaypal/etc/webapi_rest/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaPaypal/registration.php b/ReCaptchaPaypal/registration.php index 2e3ebb0e..6d1c2237 100644 --- a/ReCaptchaPaypal/registration.php +++ b/ReCaptchaPaypal/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaPaypal/view/frontend/layout/checkout_index_index.xml b/ReCaptchaPaypal/view/frontend/layout/checkout_index_index.xml index a115af08..93e3182d 100644 --- a/ReCaptchaPaypal/view/frontend/layout/checkout_index_index.xml +++ b/ReCaptchaPaypal/view/frontend/layout/checkout_index_index.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaPaypal/view/frontend/requirejs-config.js b/ReCaptchaPaypal/view/frontend/requirejs-config.js index a20b4e51..a36f2b75 100644 --- a/ReCaptchaPaypal/view/frontend/requirejs-config.js +++ b/ReCaptchaPaypal/view/frontend/requirejs-config.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ // eslint-disable-next-line no-unused-vars diff --git a/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js b/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js index c392f662..2f498b80 100644 --- a/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js +++ b/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + define([ 'jquery', 'Magento_Checkout/js/model/payment/additional-validators' diff --git a/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js b/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js index f8892436..daa240fd 100644 --- a/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js +++ b/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define( diff --git a/ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php b/ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php index 1df7d4d4..0033b42d 100644 --- a/ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php +++ b/ReCaptchaResendConfirmationEmail/Model/WebapiConfigProvider.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaResendConfirmationEmail\Model; diff --git a/ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php b/ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php index 0d8129e3..7bda396c 100644 --- a/ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php +++ b/ReCaptchaResendConfirmationEmail/Observer/ResendConfirmationEmailObserver.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaResendConfirmationEmail\Observer; diff --git a/ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php b/ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php index 01733bcc..586e206e 100644 --- a/ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php +++ b/ReCaptchaResendConfirmationEmail/Test/Api/GraphQl/ResendConfirmationEmail/ResendConfirmationEmailTest.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaResendConfirmationEmail\Test\Api\GraphQl\ResendConfirmationEmail; diff --git a/ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml b/ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml index 2eaab50b..79b0d8a4 100644 --- a/ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml +++ b/ReCaptchaResendConfirmationEmail/etc/adminhtml/system.xml @@ -1,19 +1,8 @@ <?xml version="1.0"?> <!-- -/************************************************************************ - * +/** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - * ************************************************************************ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaResendConfirmationEmail/etc/config.xml b/ReCaptchaResendConfirmationEmail/etc/config.xml index ffca5578..8033a1cc 100644 --- a/ReCaptchaResendConfirmationEmail/etc/config.xml +++ b/ReCaptchaResendConfirmationEmail/etc/config.xml @@ -1,19 +1,8 @@ <?xml version="1.0"?> <!-- -/************************************************************************ - * +/** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - * ************************************************************************ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaResendConfirmationEmail/etc/di.xml b/ReCaptchaResendConfirmationEmail/etc/di.xml index 3089cd0a..51f3ec2d 100644 --- a/ReCaptchaResendConfirmationEmail/etc/di.xml +++ b/ReCaptchaResendConfirmationEmail/etc/di.xml @@ -1,19 +1,8 @@ <?xml version="1.0"?> <!-- -/************************************************************************ - * +/** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - * ************************************************************************ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaResendConfirmationEmail/etc/module.xml b/ReCaptchaResendConfirmationEmail/etc/module.xml index 8b07d8c0..5535b69b 100644 --- a/ReCaptchaResendConfirmationEmail/etc/module.xml +++ b/ReCaptchaResendConfirmationEmail/etc/module.xml @@ -1,19 +1,8 @@ <?xml version="1.0"?> <!-- -/************************************************************************ - * +/** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained - * from Adobe. - * ************************************************************************ */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaResendConfirmationEmail/registration.php b/ReCaptchaResendConfirmationEmail/registration.php index fb4277d6..5c9e78d4 100644 --- a/ReCaptchaResendConfirmationEmail/registration.php +++ b/ReCaptchaResendConfirmationEmail/registration.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaReview/Model/WebapiConfigProvider.php b/ReCaptchaReview/Model/WebapiConfigProvider.php index e4dbf1d1..6a6b9166 100644 --- a/ReCaptchaReview/Model/WebapiConfigProvider.php +++ b/ReCaptchaReview/Model/WebapiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaReview\Model; diff --git a/ReCaptchaReview/Observer/ReviewFormObserver.php b/ReCaptchaReview/Observer/ReviewFormObserver.php index 722ec3fb..88c870b4 100644 --- a/ReCaptchaReview/Observer/ReviewFormObserver.php +++ b/ReCaptchaReview/Observer/ReviewFormObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaReview\Observer; diff --git a/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php b/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php index 3467013e..e9200a7d 100644 --- a/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php +++ b/ReCaptchaReview/Test/Api/GraphQl/Review/ProductReviewsTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaReview\Test\Api\GraphQl\Review; diff --git a/ReCaptchaReview/Test/Integration/ReviewFormTest.php b/ReCaptchaReview/Test/Integration/ReviewFormTest.php index 1047fc50..c36c6d74 100644 --- a/ReCaptchaReview/Test/Integration/ReviewFormTest.php +++ b/ReCaptchaReview/Test/Integration/ReviewFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaReview\Test\Integration; diff --git a/ReCaptchaReview/etc/adminhtml/system.xml b/ReCaptchaReview/etc/adminhtml/system.xml index 45b4226f..4c9deacd 100644 --- a/ReCaptchaReview/etc/adminhtml/system.xml +++ b/ReCaptchaReview/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaReview/etc/config.xml b/ReCaptchaReview/etc/config.xml index b8fc1dac..d437d560 100644 --- a/ReCaptchaReview/etc/config.xml +++ b/ReCaptchaReview/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaReview/etc/di.xml b/ReCaptchaReview/etc/di.xml index bbc6d320..f237bd9d 100644 --- a/ReCaptchaReview/etc/di.xml +++ b/ReCaptchaReview/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> diff --git a/ReCaptchaReview/etc/frontend/di.xml b/ReCaptchaReview/etc/frontend/di.xml index 509158d4..cc25e6b6 100644 --- a/ReCaptchaReview/etc/frontend/di.xml +++ b/ReCaptchaReview/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/ReCaptchaReview/etc/frontend/events.xml b/ReCaptchaReview/etc/frontend/events.xml index 6cc89dfd..541c69c0 100644 --- a/ReCaptchaReview/etc/frontend/events.xml +++ b/ReCaptchaReview/etc/frontend/events.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_review_product_post"> diff --git a/ReCaptchaReview/etc/module.xml b/ReCaptchaReview/etc/module.xml index 9691a735..3f18bca9 100644 --- a/ReCaptchaReview/etc/module.xml +++ b/ReCaptchaReview/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaReview"/> diff --git a/ReCaptchaReview/registration.php b/ReCaptchaReview/registration.php index 8b2cae1b..21509455 100644 --- a/ReCaptchaReview/registration.php +++ b/ReCaptchaReview/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml b/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml index 2892de64..348e7e97 100644 --- a/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml +++ b/ReCaptchaReview/view/frontend/layout/catalog_product_view.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <referenceContainer name="form.additional.review.info"> diff --git a/ReCaptchaReview/view/frontend/web/css/source/_module.less b/ReCaptchaReview/view/frontend/web/css/source/_module.less index 0c7cee55..f94e324d 100644 --- a/ReCaptchaReview/view/frontend/web/css/source/_module.less +++ b/ReCaptchaReview/view/frontend/web/css/source/_module.less @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + .review-form { .field-recaptcha { margin-bottom: 10px; diff --git a/ReCaptchaSendFriend/Model/WebapiConfigProvider.php b/ReCaptchaSendFriend/Model/WebapiConfigProvider.php index c4594ee0..b4c45b69 100644 --- a/ReCaptchaSendFriend/Model/WebapiConfigProvider.php +++ b/ReCaptchaSendFriend/Model/WebapiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaSendFriend\Model; diff --git a/ReCaptchaSendFriend/Observer/SendFriendObserver.php b/ReCaptchaSendFriend/Observer/SendFriendObserver.php index 28fd6e07..9397452e 100644 --- a/ReCaptchaSendFriend/Observer/SendFriendObserver.php +++ b/ReCaptchaSendFriend/Observer/SendFriendObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaSendFriend\Observer; diff --git a/ReCaptchaSendFriend/Test/Api/GraphQl/SendFriend/SendEmailToFriendTest.php b/ReCaptchaSendFriend/Test/Api/GraphQl/SendFriend/SendEmailToFriendTest.php index 37c4ca63..f3728b51 100644 --- a/ReCaptchaSendFriend/Test/Api/GraphQl/SendFriend/SendEmailToFriendTest.php +++ b/ReCaptchaSendFriend/Test/Api/GraphQl/SendFriend/SendEmailToFriendTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaSendFriend\Test\Api\GraphQl\SendFriend; diff --git a/ReCaptchaSendFriend/Test/Integration/SendFriendFormTest.php b/ReCaptchaSendFriend/Test/Integration/SendFriendFormTest.php index 12e1d1d2..abe48bb3 100644 --- a/ReCaptchaSendFriend/Test/Integration/SendFriendFormTest.php +++ b/ReCaptchaSendFriend/Test/Integration/SendFriendFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaSendFriend\Test\Integration; diff --git a/ReCaptchaSendFriend/etc/adminhtml/system.xml b/ReCaptchaSendFriend/etc/adminhtml/system.xml index 0682d45d..1db8f4c7 100644 --- a/ReCaptchaSendFriend/etc/adminhtml/system.xml +++ b/ReCaptchaSendFriend/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaSendFriend/etc/config.xml b/ReCaptchaSendFriend/etc/config.xml index a23d1a11..ece17d23 100644 --- a/ReCaptchaSendFriend/etc/config.xml +++ b/ReCaptchaSendFriend/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaSendFriend/etc/di.xml b/ReCaptchaSendFriend/etc/di.xml index 01d9075e..1deab30e 100644 --- a/ReCaptchaSendFriend/etc/di.xml +++ b/ReCaptchaSendFriend/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> diff --git a/ReCaptchaSendFriend/etc/frontend/di.xml b/ReCaptchaSendFriend/etc/frontend/di.xml index b48b3cb7..1c4c4dbc 100644 --- a/ReCaptchaSendFriend/etc/frontend/di.xml +++ b/ReCaptchaSendFriend/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/ReCaptchaSendFriend/etc/frontend/events.xml b/ReCaptchaSendFriend/etc/frontend/events.xml index d28d8ba7..a1631a06 100644 --- a/ReCaptchaSendFriend/etc/frontend/events.xml +++ b/ReCaptchaSendFriend/etc/frontend/events.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_sendfriend_product_sendmail"> diff --git a/ReCaptchaSendFriend/etc/module.xml b/ReCaptchaSendFriend/etc/module.xml index 9a3e3a08..0c063e3f 100644 --- a/ReCaptchaSendFriend/etc/module.xml +++ b/ReCaptchaSendFriend/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaSendFriend"/> diff --git a/ReCaptchaSendFriend/registration.php b/ReCaptchaSendFriend/registration.php index 9f72af49..357fe232 100644 --- a/ReCaptchaSendFriend/registration.php +++ b/ReCaptchaSendFriend/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaSendFriend/view/frontend/layout/sendfriend_product_send.xml b/ReCaptchaSendFriend/view/frontend/layout/sendfriend_product_send.xml index 4fdf650b..fd78e7bc 100644 --- a/ReCaptchaSendFriend/view/frontend/layout/sendfriend_product_send.xml +++ b/ReCaptchaSendFriend/view/frontend/layout/sendfriend_product_send.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> diff --git a/ReCaptchaSendFriend/view/frontend/web/css/source/_module.less b/ReCaptchaSendFriend/view/frontend/web/css/source/_module.less index 495f4b46..2d787978 100644 --- a/ReCaptchaSendFriend/view/frontend/web/css/source/_module.less +++ b/ReCaptchaSendFriend/view/frontend/web/css/source/_module.less @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + .form.send.friend .g-recaptcha { margin-top: 40px; } diff --git a/ReCaptchaStorePickup/Block/LayoutProcessor/Checkout/Onepage.php b/ReCaptchaStorePickup/Block/LayoutProcessor/Checkout/Onepage.php index 339db3a7..3b8c48bb 100644 --- a/ReCaptchaStorePickup/Block/LayoutProcessor/Checkout/Onepage.php +++ b/ReCaptchaStorePickup/Block/LayoutProcessor/Checkout/Onepage.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaStorePickup\Block\LayoutProcessor\Checkout; diff --git a/ReCaptchaStorePickup/etc/frontend/di.xml b/ReCaptchaStorePickup/etc/frontend/di.xml index 64e2926e..257a239c 100644 --- a/ReCaptchaStorePickup/etc/frontend/di.xml +++ b/ReCaptchaStorePickup/etc/frontend/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaStorePickup/etc/module.xml b/ReCaptchaStorePickup/etc/module.xml index 4c62fcfa..582c2404 100644 --- a/ReCaptchaStorePickup/etc/module.xml +++ b/ReCaptchaStorePickup/etc/module.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/ReCaptchaStorePickup/registration.php b/ReCaptchaStorePickup/registration.php index 8d2d190d..21a6f2c0 100644 --- a/ReCaptchaStorePickup/registration.php +++ b/ReCaptchaStorePickup/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaStorePickup/view/frontend/layout/checkout_index_index.xml b/ReCaptchaStorePickup/view/frontend/layout/checkout_index_index.xml index a13c362f..b6ae7392 100644 --- a/ReCaptchaStorePickup/view/frontend/layout/checkout_index_index.xml +++ b/ReCaptchaStorePickup/view/frontend/layout/checkout_index_index.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> diff --git a/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js b/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js index 5fe3878d..bced9f85 100644 --- a/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js +++ b/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ define(['Magento_ReCaptchaFrontendUi/js/reCaptcha'], function (reCaptcha) { diff --git a/ReCaptchaUi/Block/ReCaptcha.php b/ReCaptchaUi/Block/ReCaptcha.php index cca673d3..e998caa2 100644 --- a/ReCaptchaUi/Block/ReCaptcha.php +++ b/ReCaptchaUi/Block/ReCaptcha.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Block; diff --git a/ReCaptchaUi/Model/ButtonLock.php b/ReCaptchaUi/Model/ButtonLock.php index 8b349ee5..264d1491 100644 --- a/ReCaptchaUi/Model/ButtonLock.php +++ b/ReCaptchaUi/Model/ButtonLock.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/CaptchaResponseResolver.php b/ReCaptchaUi/Model/CaptchaResponseResolver.php index 53c92d86..befad472 100644 --- a/ReCaptchaUi/Model/CaptchaResponseResolver.php +++ b/ReCaptchaUi/Model/CaptchaResponseResolver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/CaptchaResponseResolverInterface.php b/ReCaptchaUi/Model/CaptchaResponseResolverInterface.php index c1a31e4d..c114fb6b 100644 --- a/ReCaptchaUi/Model/CaptchaResponseResolverInterface.php +++ b/ReCaptchaUi/Model/CaptchaResponseResolverInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/CaptchaTypeResolver.php b/ReCaptchaUi/Model/CaptchaTypeResolver.php index c7a58a5d..0b8afab4 100644 --- a/ReCaptchaUi/Model/CaptchaTypeResolver.php +++ b/ReCaptchaUi/Model/CaptchaTypeResolver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/CaptchaTypeResolverInterface.php b/ReCaptchaUi/Model/CaptchaTypeResolverInterface.php index 09df2c39..b2f6429b 100644 --- a/ReCaptchaUi/Model/CaptchaTypeResolverInterface.php +++ b/ReCaptchaUi/Model/CaptchaTypeResolverInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/ErrorMessageConfigInterface.php b/ReCaptchaUi/Model/ErrorMessageConfigInterface.php index e3173735..cf9ab2b1 100644 --- a/ReCaptchaUi/Model/ErrorMessageConfigInterface.php +++ b/ReCaptchaUi/Model/ErrorMessageConfigInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/IsCaptchaEnabled.php b/ReCaptchaUi/Model/IsCaptchaEnabled.php index 8eaf8b12..fa125d5c 100644 --- a/ReCaptchaUi/Model/IsCaptchaEnabled.php +++ b/ReCaptchaUi/Model/IsCaptchaEnabled.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/IsCaptchaEnabledInterface.php b/ReCaptchaUi/Model/IsCaptchaEnabledInterface.php index a20d5e93..465d43b5 100644 --- a/ReCaptchaUi/Model/IsCaptchaEnabledInterface.php +++ b/ReCaptchaUi/Model/IsCaptchaEnabledInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/RequestHandler.php b/ReCaptchaUi/Model/RequestHandler.php index 52c4b8ab..e1b35196 100644 --- a/ReCaptchaUi/Model/RequestHandler.php +++ b/ReCaptchaUi/Model/RequestHandler.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/RequestHandlerInterface.php b/ReCaptchaUi/Model/RequestHandlerInterface.php index 3efc05f4..c8ab62f2 100644 --- a/ReCaptchaUi/Model/RequestHandlerInterface.php +++ b/ReCaptchaUi/Model/RequestHandlerInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/UiConfigProviderInterface.php b/ReCaptchaUi/Model/UiConfigProviderInterface.php index 2a3e5440..22350a57 100644 --- a/ReCaptchaUi/Model/UiConfigProviderInterface.php +++ b/ReCaptchaUi/Model/UiConfigProviderInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/UiConfigResolver.php b/ReCaptchaUi/Model/UiConfigResolver.php index 5ca000ad..6d3c3377 100644 --- a/ReCaptchaUi/Model/UiConfigResolver.php +++ b/ReCaptchaUi/Model/UiConfigResolver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/UiConfigResolverInterface.php b/ReCaptchaUi/Model/UiConfigResolverInterface.php index 4ad3c6b5..ff8058df 100644 --- a/ReCaptchaUi/Model/UiConfigResolverInterface.php +++ b/ReCaptchaUi/Model/UiConfigResolverInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/ValidationConfigProviderInterface.php b/ReCaptchaUi/Model/ValidationConfigProviderInterface.php index 018e3301..db6f6c9a 100644 --- a/ReCaptchaUi/Model/ValidationConfigProviderInterface.php +++ b/ReCaptchaUi/Model/ValidationConfigProviderInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/ValidationConfigResolver.php b/ReCaptchaUi/Model/ValidationConfigResolver.php index 4ff3b428..163fd152 100644 --- a/ReCaptchaUi/Model/ValidationConfigResolver.php +++ b/ReCaptchaUi/Model/ValidationConfigResolver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/Model/ValidationConfigResolverInterface.php b/ReCaptchaUi/Model/ValidationConfigResolverInterface.php index 6b758d75..5f9c52d6 100644 --- a/ReCaptchaUi/Model/ValidationConfigResolverInterface.php +++ b/ReCaptchaUi/Model/ValidationConfigResolverInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUi\Model; diff --git a/ReCaptchaUi/etc/acl.xml b/ReCaptchaUi/etc/acl.xml index c40f317c..64606489 100644 --- a/ReCaptchaUi/etc/acl.xml +++ b/ReCaptchaUi/etc/acl.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> <acl> diff --git a/ReCaptchaUi/etc/di.xml b/ReCaptchaUi/etc/di.xml index 260929bf..26fd38b9 100644 --- a/ReCaptchaUi/etc/di.xml +++ b/ReCaptchaUi/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\ReCaptchaUi\Model\RequestHandlerInterface" type="Magento\ReCaptchaUi\Model\RequestHandler"/> diff --git a/ReCaptchaUi/etc/module.xml b/ReCaptchaUi/etc/module.xml index d1125400..d6287047 100644 --- a/ReCaptchaUi/etc/module.xml +++ b/ReCaptchaUi/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaUi"/> diff --git a/ReCaptchaUi/registration.php b/ReCaptchaUi/registration.php index 8308dbd7..202ac5b2 100644 --- a/ReCaptchaUi/registration.php +++ b/ReCaptchaUi/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php b/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php index 64d384e2..fa088c41 100644 --- a/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php +++ b/ReCaptchaUser/Command/DisableReCaptchaForUserForgotPasswordCommand.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Command; diff --git a/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php b/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php index 7a678fe5..2c989932 100644 --- a/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php +++ b/ReCaptchaUser/Command/DisableReCaptchaForUserLoginCommand.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Command; diff --git a/ReCaptchaUser/Model/DisableReCaptchaForUserForgotPassword.php b/ReCaptchaUser/Model/DisableReCaptchaForUserForgotPassword.php index 4db2e4bf..b4ac4345 100644 --- a/ReCaptchaUser/Model/DisableReCaptchaForUserForgotPassword.php +++ b/ReCaptchaUser/Model/DisableReCaptchaForUserForgotPassword.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Model; diff --git a/ReCaptchaUser/Model/DisableReCaptchaForUserLogin.php b/ReCaptchaUser/Model/DisableReCaptchaForUserLogin.php index 160a55ae..609db501 100644 --- a/ReCaptchaUser/Model/DisableReCaptchaForUserLogin.php +++ b/ReCaptchaUser/Model/DisableReCaptchaForUserLogin.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Model; diff --git a/ReCaptchaUser/Observer/ForgotPasswordObserver.php b/ReCaptchaUser/Observer/ForgotPasswordObserver.php index 17dccecb..0c267bb8 100644 --- a/ReCaptchaUser/Observer/ForgotPasswordObserver.php +++ b/ReCaptchaUser/Observer/ForgotPasswordObserver.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Observer; diff --git a/ReCaptchaUser/Observer/LoginObserver.php b/ReCaptchaUser/Observer/LoginObserver.php index bdedc940..df877338 100644 --- a/ReCaptchaUser/Observer/LoginObserver.php +++ b/ReCaptchaUser/Observer/LoginObserver.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Observer; diff --git a/ReCaptchaUser/Test/Integration/ForgotPasswordFormTest.php b/ReCaptchaUser/Test/Integration/ForgotPasswordFormTest.php index 465cfbd8..1324adba 100644 --- a/ReCaptchaUser/Test/Integration/ForgotPasswordFormTest.php +++ b/ReCaptchaUser/Test/Integration/ForgotPasswordFormTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Test\Integration; diff --git a/ReCaptchaUser/Test/Integration/LoginFormTest.php b/ReCaptchaUser/Test/Integration/LoginFormTest.php index ce947236..6e5b2dcc 100644 --- a/ReCaptchaUser/Test/Integration/LoginFormTest.php +++ b/ReCaptchaUser/Test/Integration/LoginFormTest.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaUser\Test\Integration; diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml index c8ed6a4b..020dd755 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaDisabledActionGroup.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2022 Adobe + * All Rights Reserved. + */ --> - <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="RecaptchaDisabledActionGroup"> diff --git a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml index c2dd9c9a..5c1a34e1 100644 --- a/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml +++ b/ReCaptchaUser/Test/Mftf/ActionGroup/RecaptchaEnabledActionGroup.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2022 Adobe + * All Rights Reserved. + */ --> - <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="RecaptchaEnabledActionGroup"> diff --git a/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml b/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml index 0238b563..0925f55b 100644 --- a/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml +++ b/ReCaptchaUser/Test/Mftf/Data/RecaptchaConfigPageData.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2022 Adobe + * All Rights Reserved. + */ --> - <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="recaptchaForm"> diff --git a/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml b/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml index f4574393..02ae5a68 100644 --- a/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml +++ b/ReCaptchaUser/Test/Mftf/Page/AdminStoreConfigurationPage.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2022 Adobe + * All Rights Reserved. + */ --> - <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="AdminStoreConfigurationPage" url="admin/system_config/edit/section/recaptcha_backend" area="admin" module="Magento_Backend"> diff --git a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml index b9b99d39..e3a4678f 100644 --- a/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml +++ b/ReCaptchaUser/Test/Mftf/Section/RecaptchaFormSection.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2022 Adobe + * All Rights Reserved. + */ --> - <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="RecaptchaFormSection"> diff --git a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml index 42b41861..ab973577 100644 --- a/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml +++ b/ReCaptchaUser/Test/Mftf/Test/AdminLoginReCaptchaFunctionalityTest.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2022 Adobe + * All Rights Reserved. + */ --> - <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminLoginReCaptchaFunctionalityTest"> <annotations> diff --git a/ReCaptchaUser/etc/adminhtml/events.xml b/ReCaptchaUser/etc/adminhtml/events.xml index c0e9a2c5..f2bf172b 100644 --- a/ReCaptchaUser/etc/adminhtml/events.xml +++ b/ReCaptchaUser/etc/adminhtml/events.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_adminhtml_auth_forgotpassword"> diff --git a/ReCaptchaUser/etc/adminhtml/system.xml b/ReCaptchaUser/etc/adminhtml/system.xml index 8bb4d234..5b38eb54 100644 --- a/ReCaptchaUser/etc/adminhtml/system.xml +++ b/ReCaptchaUser/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaUser/etc/config.xml b/ReCaptchaUser/etc/config.xml index 0bd2fe9f..cc2dc64e 100644 --- a/ReCaptchaUser/etc/config.xml +++ b/ReCaptchaUser/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaUser/etc/di.xml b/ReCaptchaUser/etc/di.xml index 8d033b5f..639fc74c 100644 --- a/ReCaptchaUser/etc/di.xml +++ b/ReCaptchaUser/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Framework\Console\CommandListInterface"> diff --git a/ReCaptchaUser/etc/module.xml b/ReCaptchaUser/etc/module.xml index 533c7a8d..501b02bd 100644 --- a/ReCaptchaUser/etc/module.xml +++ b/ReCaptchaUser/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaUser"/> diff --git a/ReCaptchaUser/registration.php b/ReCaptchaUser/registration.php index 5fabe668..75f065ac 100644 --- a/ReCaptchaUser/registration.php +++ b/ReCaptchaUser/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_forgotpassword.xml b/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_forgotpassword.xml index aa14ebae..8df07538 100644 --- a/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_forgotpassword.xml +++ b/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_forgotpassword.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_login.xml b/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_login.xml index 4bc51e0e..1ea612af 100644 --- a/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_login.xml +++ b/ReCaptchaUser/view/adminhtml/layout/adminhtml_auth_login.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> diff --git a/ReCaptchaUser/view/adminhtml/layout/recaptcha.xml b/ReCaptchaUser/view/adminhtml/layout/recaptcha.xml index 1a55a978..f516c166 100644 --- a/ReCaptchaUser/view/adminhtml/layout/recaptcha.xml +++ b/ReCaptchaUser/view/adminhtml/layout/recaptcha.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <head> diff --git a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml index e4ba91f1..9f492881 100644 --- a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml +++ b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + /** @var $block Magento\ReCaptchaUi\Block\ReCaptcha */ $config = $block->getCaptchaUiConfig(); $renderingOptions = $config['rendering'] ?? []; diff --git a/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less b/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less index d30a444d..acd06e2f 100644 --- a/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less +++ b/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less @@ -1,7 +1,8 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + .login-content { .field-recaptcha { margin-left: auto; diff --git a/ReCaptchaValidation/Model/ReCaptcha.php b/ReCaptchaValidation/Model/ReCaptcha.php index b02a41de..07c073d5 100644 --- a/ReCaptchaValidation/Model/ReCaptcha.php +++ b/ReCaptchaValidation/Model/ReCaptcha.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2023 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaValidation\Model; diff --git a/ReCaptchaValidation/Model/ValidationConfig.php b/ReCaptchaValidation/Model/ValidationConfig.php index 638466b4..b73a68ce 100644 --- a/ReCaptchaValidation/Model/ValidationConfig.php +++ b/ReCaptchaValidation/Model/ValidationConfig.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaValidation\Model; diff --git a/ReCaptchaValidation/Model/Validator.php b/ReCaptchaValidation/Model/Validator.php index 16907b1c..c6d0887f 100644 --- a/ReCaptchaValidation/Model/Validator.php +++ b/ReCaptchaValidation/Model/Validator.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaValidation\Model; diff --git a/ReCaptchaValidation/etc/di.xml b/ReCaptchaValidation/etc/di.xml index 9cddc231..a6bfe189 100644 --- a/ReCaptchaValidation/etc/di.xml +++ b/ReCaptchaValidation/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface" type="Magento\ReCaptchaValidation\Model\ValidationConfig"/> diff --git a/ReCaptchaValidation/etc/module.xml b/ReCaptchaValidation/etc/module.xml index bd577e5d..5f5b6242 100644 --- a/ReCaptchaValidation/etc/module.xml +++ b/ReCaptchaValidation/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaValidation"/> diff --git a/ReCaptchaValidation/registration.php b/ReCaptchaValidation/registration.php index 9c83d4c3..8eb6b3f4 100644 --- a/ReCaptchaValidation/registration.php +++ b/ReCaptchaValidation/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php b/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php index 824012af..192e3ee1 100644 --- a/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php +++ b/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaValidationApi\Api\Data; diff --git a/ReCaptchaValidationApi/Api/ValidatorInterface.php b/ReCaptchaValidationApi/Api/ValidatorInterface.php index 6e580935..28af5fc5 100644 --- a/ReCaptchaValidationApi/Api/ValidatorInterface.php +++ b/ReCaptchaValidationApi/Api/ValidatorInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaValidationApi\Api; diff --git a/ReCaptchaValidationApi/Model/ErrorMessagesProvider.php b/ReCaptchaValidationApi/Model/ErrorMessagesProvider.php index ec83f9af..eb64381f 100644 --- a/ReCaptchaValidationApi/Model/ErrorMessagesProvider.php +++ b/ReCaptchaValidationApi/Model/ErrorMessagesProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaValidationApi\Model; diff --git a/ReCaptchaValidationApi/Model/ValidationErrorMessagesProvider.php b/ReCaptchaValidationApi/Model/ValidationErrorMessagesProvider.php index 0b3df540..ee34de99 100644 --- a/ReCaptchaValidationApi/Model/ValidationErrorMessagesProvider.php +++ b/ReCaptchaValidationApi/Model/ValidationErrorMessagesProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaValidationApi\Model; diff --git a/ReCaptchaValidationApi/etc/di.xml b/ReCaptchaValidationApi/etc/di.xml index a70521e1..dcac396b 100644 --- a/ReCaptchaValidationApi/etc/di.xml +++ b/ReCaptchaValidationApi/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaValidationApi\Model\ErrorMessagesProvider"> diff --git a/ReCaptchaValidationApi/etc/module.xml b/ReCaptchaValidationApi/etc/module.xml index 7a24451e..3987fd41 100644 --- a/ReCaptchaValidationApi/etc/module.xml +++ b/ReCaptchaValidationApi/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaValidationApi"/> diff --git a/ReCaptchaValidationApi/registration.php b/ReCaptchaValidationApi/registration.php index bed7ab66..64434fe0 100644 --- a/ReCaptchaValidationApi/registration.php +++ b/ReCaptchaValidationApi/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php b/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php index feb2c014..afa64e6f 100644 --- a/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php +++ b/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Checkbox\Model\Adminhtml; diff --git a/ReCaptchaVersion2Checkbox/Model/Adminhtml/ValidationConfigProvider.php b/ReCaptchaVersion2Checkbox/Model/Adminhtml/ValidationConfigProvider.php index 96495fe6..9b3b1689 100644 --- a/ReCaptchaVersion2Checkbox/Model/Adminhtml/ValidationConfigProvider.php +++ b/ReCaptchaVersion2Checkbox/Model/Adminhtml/ValidationConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Checkbox\Model\Adminhtml; diff --git a/ReCaptchaVersion2Checkbox/Model/Config.php b/ReCaptchaVersion2Checkbox/Model/Config.php index 8858f058..ac6bf759 100644 --- a/ReCaptchaVersion2Checkbox/Model/Config.php +++ b/ReCaptchaVersion2Checkbox/Model/Config.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Checkbox\Model; diff --git a/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php index bdc4b7f5..5600ed83 100644 --- a/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Checkbox\Model\Frontend; diff --git a/ReCaptchaVersion2Checkbox/Model/Frontend/ValidationConfigProvider.php b/ReCaptchaVersion2Checkbox/Model/Frontend/ValidationConfigProvider.php index 136a7dc3..274309c7 100644 --- a/ReCaptchaVersion2Checkbox/Model/Frontend/ValidationConfigProvider.php +++ b/ReCaptchaVersion2Checkbox/Model/Frontend/ValidationConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Checkbox\Model\Frontend; diff --git a/ReCaptchaVersion2Checkbox/etc/adminhtml/di.xml b/ReCaptchaVersion2Checkbox/etc/adminhtml/di.xml index 10efe821..005db252 100644 --- a/ReCaptchaVersion2Checkbox/etc/adminhtml/di.xml +++ b/ReCaptchaVersion2Checkbox/etc/adminhtml/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaUi\Model\UiConfigResolver"> diff --git a/ReCaptchaVersion2Checkbox/etc/adminhtml/system.xml b/ReCaptchaVersion2Checkbox/etc/adminhtml/system.xml index 935c813d..ec62ddd9 100644 --- a/ReCaptchaVersion2Checkbox/etc/adminhtml/system.xml +++ b/ReCaptchaVersion2Checkbox/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaVersion2Checkbox/etc/config.xml b/ReCaptchaVersion2Checkbox/etc/config.xml index 5fe67d28..b68a9de7 100644 --- a/ReCaptchaVersion2Checkbox/etc/config.xml +++ b/ReCaptchaVersion2Checkbox/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaVersion2Checkbox/etc/csp_whitelist.xml b/ReCaptchaVersion2Checkbox/etc/csp_whitelist.xml index 8a07aca9..ba72b07e 100644 --- a/ReCaptchaVersion2Checkbox/etc/csp_whitelist.xml +++ b/ReCaptchaVersion2Checkbox/etc/csp_whitelist.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd"> diff --git a/ReCaptchaVersion2Checkbox/etc/di.xml b/ReCaptchaVersion2Checkbox/etc/di.xml index 02876b29..9231152e 100644 --- a/ReCaptchaVersion2Checkbox/etc/di.xml +++ b/ReCaptchaVersion2Checkbox/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Config\Model\Config\TypePool"> diff --git a/ReCaptchaVersion2Checkbox/etc/frontend/di.xml b/ReCaptchaVersion2Checkbox/etc/frontend/di.xml index 249dc802..7c73f41b 100644 --- a/ReCaptchaVersion2Checkbox/etc/frontend/di.xml +++ b/ReCaptchaVersion2Checkbox/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaUi\Model\UiConfigResolver"> diff --git a/ReCaptchaVersion2Checkbox/etc/module.xml b/ReCaptchaVersion2Checkbox/etc/module.xml index 19a79a04..d48881a0 100644 --- a/ReCaptchaVersion2Checkbox/etc/module.xml +++ b/ReCaptchaVersion2Checkbox/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaVersion2Checkbox"/> diff --git a/ReCaptchaVersion2Checkbox/registration.php b/ReCaptchaVersion2Checkbox/registration.php index 725347e0..4ac8b220 100644 --- a/ReCaptchaVersion2Checkbox/registration.php +++ b/ReCaptchaVersion2Checkbox/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php b/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php index c592e70d..b9b9f562 100644 --- a/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php +++ b/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Invisible\Model\Adminhtml; diff --git a/ReCaptchaVersion2Invisible/Model/Adminhtml/ValidationConfigProvider.php b/ReCaptchaVersion2Invisible/Model/Adminhtml/ValidationConfigProvider.php index c6184081..c5b50568 100644 --- a/ReCaptchaVersion2Invisible/Model/Adminhtml/ValidationConfigProvider.php +++ b/ReCaptchaVersion2Invisible/Model/Adminhtml/ValidationConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Invisible\Model\Adminhtml; diff --git a/ReCaptchaVersion2Invisible/Model/Config.php b/ReCaptchaVersion2Invisible/Model/Config.php index 16f941e2..d5ae6535 100644 --- a/ReCaptchaVersion2Invisible/Model/Config.php +++ b/ReCaptchaVersion2Invisible/Model/Config.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Invisible\Model; diff --git a/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php index 4e84c44f..d9b648b2 100644 --- a/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Invisible\Model\Frontend; diff --git a/ReCaptchaVersion2Invisible/Model/Frontend/ValidationConfigProvider.php b/ReCaptchaVersion2Invisible/Model/Frontend/ValidationConfigProvider.php index f1208ba0..b07710a0 100644 --- a/ReCaptchaVersion2Invisible/Model/Frontend/ValidationConfigProvider.php +++ b/ReCaptchaVersion2Invisible/Model/Frontend/ValidationConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion2Invisible\Model\Frontend; diff --git a/ReCaptchaVersion2Invisible/etc/adminhtml/di.xml b/ReCaptchaVersion2Invisible/etc/adminhtml/di.xml index 74ec785d..71cd727e 100644 --- a/ReCaptchaVersion2Invisible/etc/adminhtml/di.xml +++ b/ReCaptchaVersion2Invisible/etc/adminhtml/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaUi\Model\UiConfigResolver"> diff --git a/ReCaptchaVersion2Invisible/etc/adminhtml/system.xml b/ReCaptchaVersion2Invisible/etc/adminhtml/system.xml index 7a36dac7..26afe29d 100644 --- a/ReCaptchaVersion2Invisible/etc/adminhtml/system.xml +++ b/ReCaptchaVersion2Invisible/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaVersion2Invisible/etc/config.xml b/ReCaptchaVersion2Invisible/etc/config.xml index 6d768a18..d0f2deef 100644 --- a/ReCaptchaVersion2Invisible/etc/config.xml +++ b/ReCaptchaVersion2Invisible/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaVersion2Invisible/etc/csp_whitelist.xml b/ReCaptchaVersion2Invisible/etc/csp_whitelist.xml index 8a07aca9..ba72b07e 100644 --- a/ReCaptchaVersion2Invisible/etc/csp_whitelist.xml +++ b/ReCaptchaVersion2Invisible/etc/csp_whitelist.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd"> diff --git a/ReCaptchaVersion2Invisible/etc/di.xml b/ReCaptchaVersion2Invisible/etc/di.xml index 83aed2c3..f9e6a92b 100644 --- a/ReCaptchaVersion2Invisible/etc/di.xml +++ b/ReCaptchaVersion2Invisible/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Config\Model\Config\TypePool"> diff --git a/ReCaptchaVersion2Invisible/etc/frontend/di.xml b/ReCaptchaVersion2Invisible/etc/frontend/di.xml index 451a98eb..c2dd8bed 100644 --- a/ReCaptchaVersion2Invisible/etc/frontend/di.xml +++ b/ReCaptchaVersion2Invisible/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaUi\Model\UiConfigResolver"> diff --git a/ReCaptchaVersion2Invisible/etc/module.xml b/ReCaptchaVersion2Invisible/etc/module.xml index 348088be..0f1ef47e 100644 --- a/ReCaptchaVersion2Invisible/etc/module.xml +++ b/ReCaptchaVersion2Invisible/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaVersion2Invisible"/> diff --git a/ReCaptchaVersion2Invisible/registration.php b/ReCaptchaVersion2Invisible/registration.php index 69a4a5c8..f6eac07d 100644 --- a/ReCaptchaVersion2Invisible/registration.php +++ b/ReCaptchaVersion2Invisible/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php b/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php index 565b84df..6635d360 100644 --- a/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php +++ b/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion3Invisible\Model\Adminhtml; diff --git a/ReCaptchaVersion3Invisible/Model/Adminhtml/ValidationConfigProvider.php b/ReCaptchaVersion3Invisible/Model/Adminhtml/ValidationConfigProvider.php index b93bc4f0..03ae4874 100644 --- a/ReCaptchaVersion3Invisible/Model/Adminhtml/ValidationConfigProvider.php +++ b/ReCaptchaVersion3Invisible/Model/Adminhtml/ValidationConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion3Invisible\Model\Adminhtml; diff --git a/ReCaptchaVersion3Invisible/Model/Config.php b/ReCaptchaVersion3Invisible/Model/Config.php index 3005c4d8..7f86bfc8 100644 --- a/ReCaptchaVersion3Invisible/Model/Config.php +++ b/ReCaptchaVersion3Invisible/Model/Config.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2023 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion3Invisible\Model; diff --git a/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php index 9b10ab97..4d56c407 100644 --- a/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion3Invisible\Model\Frontend; diff --git a/ReCaptchaVersion3Invisible/Model/Frontend/ValidationConfigProvider.php b/ReCaptchaVersion3Invisible/Model/Frontend/ValidationConfigProvider.php index 3ff0fdf5..915ab195 100644 --- a/ReCaptchaVersion3Invisible/Model/Frontend/ValidationConfigProvider.php +++ b/ReCaptchaVersion3Invisible/Model/Frontend/ValidationConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaVersion3Invisible\Model\Frontend; diff --git a/ReCaptchaVersion3Invisible/etc/adminhtml/di.xml b/ReCaptchaVersion3Invisible/etc/adminhtml/di.xml index 66bd1dee..48373702 100644 --- a/ReCaptchaVersion3Invisible/etc/adminhtml/di.xml +++ b/ReCaptchaVersion3Invisible/etc/adminhtml/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaUi\Model\UiConfigResolver"> diff --git a/ReCaptchaVersion3Invisible/etc/adminhtml/system.xml b/ReCaptchaVersion3Invisible/etc/adminhtml/system.xml index b2c48c9d..a3c02dfa 100644 --- a/ReCaptchaVersion3Invisible/etc/adminhtml/system.xml +++ b/ReCaptchaVersion3Invisible/etc/adminhtml/system.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaVersion3Invisible/etc/config.xml b/ReCaptchaVersion3Invisible/etc/config.xml index 7bf2f131..22fda62c 100644 --- a/ReCaptchaVersion3Invisible/etc/config.xml +++ b/ReCaptchaVersion3Invisible/etc/config.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaVersion3Invisible/etc/csp_whitelist.xml b/ReCaptchaVersion3Invisible/etc/csp_whitelist.xml index 8a07aca9..ba72b07e 100644 --- a/ReCaptchaVersion3Invisible/etc/csp_whitelist.xml +++ b/ReCaptchaVersion3Invisible/etc/csp_whitelist.xml @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <csp_whitelist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Csp:etc/csp_whitelist.xsd"> diff --git a/ReCaptchaVersion3Invisible/etc/di.xml b/ReCaptchaVersion3Invisible/etc/di.xml index 7549b73e..43cbc98b 100644 --- a/ReCaptchaVersion3Invisible/etc/di.xml +++ b/ReCaptchaVersion3Invisible/etc/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Config\Model\Config\TypePool"> diff --git a/ReCaptchaVersion3Invisible/etc/extension_attributes.xml b/ReCaptchaVersion3Invisible/etc/extension_attributes.xml index b947b525..135b8768 100644 --- a/ReCaptchaVersion3Invisible/etc/extension_attributes.xml +++ b/ReCaptchaVersion3Invisible/etc/extension_attributes.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd"> diff --git a/ReCaptchaVersion3Invisible/etc/frontend/di.xml b/ReCaptchaVersion3Invisible/etc/frontend/di.xml index 9f2d94b8..42ca15d8 100644 --- a/ReCaptchaVersion3Invisible/etc/frontend/di.xml +++ b/ReCaptchaVersion3Invisible/etc/frontend/di.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaUi\Model\UiConfigResolver"> diff --git a/ReCaptchaVersion3Invisible/etc/module.xml b/ReCaptchaVersion3Invisible/etc/module.xml index 84efbd88..c59e7134 100644 --- a/ReCaptchaVersion3Invisible/etc/module.xml +++ b/ReCaptchaVersion3Invisible/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaVersion3Invisible"/> diff --git a/ReCaptchaVersion3Invisible/registration.php b/ReCaptchaVersion3Invisible/registration.php index a69eb3ad..b4e05642 100644 --- a/ReCaptchaVersion3Invisible/registration.php +++ b/ReCaptchaVersion3Invisible/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaWebapiApi/Api/Data/EndpointInterface.php b/ReCaptchaWebapiApi/Api/Data/EndpointInterface.php index af8f9894..8458ee2d 100644 --- a/ReCaptchaWebapiApi/Api/Data/EndpointInterface.php +++ b/ReCaptchaWebapiApi/Api/Data/EndpointInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiApi\Api\Data; diff --git a/ReCaptchaWebapiApi/Api/WebapiValidationConfigProviderInterface.php b/ReCaptchaWebapiApi/Api/WebapiValidationConfigProviderInterface.php index ff4ce5eb..32b2209e 100644 --- a/ReCaptchaWebapiApi/Api/WebapiValidationConfigProviderInterface.php +++ b/ReCaptchaWebapiApi/Api/WebapiValidationConfigProviderInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiApi\Api; diff --git a/ReCaptchaWebapiApi/Model/CompositeWebapiValidationConfigProvider.php b/ReCaptchaWebapiApi/Model/CompositeWebapiValidationConfigProvider.php index 9f56a67d..02d24886 100644 --- a/ReCaptchaWebapiApi/Model/CompositeWebapiValidationConfigProvider.php +++ b/ReCaptchaWebapiApi/Model/CompositeWebapiValidationConfigProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiApi\Model; diff --git a/ReCaptchaWebapiApi/Model/Data/Endpoint.php b/ReCaptchaWebapiApi/Model/Data/Endpoint.php index dcc8d0d7..9063d733 100644 --- a/ReCaptchaWebapiApi/Model/Data/Endpoint.php +++ b/ReCaptchaWebapiApi/Model/Data/Endpoint.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiApi\Model\Data; diff --git a/ReCaptchaWebapiApi/etc/di.xml b/ReCaptchaWebapiApi/etc/di.xml index 998403b1..387c63e6 100644 --- a/ReCaptchaWebapiApi/etc/di.xml +++ b/ReCaptchaWebapiApi/etc/di.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <preference for="Magento\ReCaptchaWebapiApi\Api\WebapiValidationConfigProviderInterface" type="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider" /> </config> diff --git a/ReCaptchaWebapiApi/etc/module.xml b/ReCaptchaWebapiApi/etc/module.xml index 18ead477..2e2381f0 100644 --- a/ReCaptchaWebapiApi/etc/module.xml +++ b/ReCaptchaWebapiApi/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaWebapiApi"/> diff --git a/ReCaptchaWebapiApi/registration.php b/ReCaptchaWebapiApi/registration.php index 5fb987de..2e4296a5 100644 --- a/ReCaptchaWebapiApi/registration.php +++ b/ReCaptchaWebapiApi/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php b/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php index 08aea710..ed51c5ac 100644 --- a/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php +++ b/ReCaptchaWebapiGraphQl/Model/Adapter/ReCaptchaConfigInterface.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Model\Adapter; diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php index 59bc4646..d7d68b48 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaFormConfig.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Model\Resolver; diff --git a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php index 114e7249..1503a252 100644 --- a/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php +++ b/ReCaptchaWebapiGraphQl/Model/Resolver/ReCaptchaV3.php @@ -3,6 +3,7 @@ * Copyright 2023 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Model\Resolver; diff --git a/ReCaptchaWebapiGraphQl/Plugin/GraphQlValidator.php b/ReCaptchaWebapiGraphQl/Plugin/GraphQlValidator.php index 60ec2e2e..12b79669 100644 --- a/ReCaptchaWebapiGraphQl/Plugin/GraphQlValidator.php +++ b/ReCaptchaWebapiGraphQl/Plugin/GraphQlValidator.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Plugin; diff --git a/ReCaptchaWebapiGraphQl/Plugin/ValidationOverrider.php b/ReCaptchaWebapiGraphQl/Plugin/ValidationOverrider.php index cb27ad14..70779960 100644 --- a/ReCaptchaWebapiGraphQl/Plugin/ValidationOverrider.php +++ b/ReCaptchaWebapiGraphQl/Plugin/ValidationOverrider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Plugin; diff --git a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php index 9ffc579b..82857968 100644 --- a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaFormConfigTest.php @@ -2,16 +2,8 @@ /** * Copyright 2024 Adobe * All Rights Reserved. - * - * NOTICE: All information contained herein is, and remains - * the property of Adobe and its suppliers, if any. The intellectual - * and technical concepts contained herein are proprietary to Adobe - * and its suppliers and are protected by all applicable intellectual - * property laws, including trade secret and copyright laws. - * Dissemination of this information or reproduction of this material - * is strictly forbidden unless prior written permission is obtained from - * Adobe. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Test\Api; diff --git a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php index af9939f1..192476f7 100644 --- a/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Api/ReCaptchaV3ConfigTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Test\Api; diff --git a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php index 15b96503..84d141ea 100644 --- a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/GraphQlValidatorTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Test\Unit\Plugin; diff --git a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php index 329ad4a4..5b798674 100644 --- a/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php +++ b/ReCaptchaWebapiGraphQl/Test/Unit/Plugin/ValidationOverriderTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiGraphQl\Test\Unit\Plugin; diff --git a/ReCaptchaWebapiGraphQl/etc/di.xml b/ReCaptchaWebapiGraphQl/etc/di.xml index cef82784..2a8ad994 100644 --- a/ReCaptchaWebapiGraphQl/etc/di.xml +++ b/ReCaptchaWebapiGraphQl/etc/di.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Framework\GraphQl\Query\ResolverInterface"> <plugin name="graphql_recaptcha_validation" type="Magento\ReCaptchaWebapiGraphQl\Plugin\GraphQlValidator" /> diff --git a/ReCaptchaWebapiGraphQl/etc/graphql/di.xml b/ReCaptchaWebapiGraphQl/etc/graphql/di.xml index 2c0be078..453da0b0 100644 --- a/ReCaptchaWebapiGraphQl/etc/graphql/di.xml +++ b/ReCaptchaWebapiGraphQl/etc/graphql/di.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaValidationApi\Api\ValidatorInterface"> <plugin name="graphql_recaptcha_validation_override" type="Magento\ReCaptchaWebapiGraphQl\Plugin\ValidationOverrider" /> diff --git a/ReCaptchaWebapiGraphQl/etc/module.xml b/ReCaptchaWebapiGraphQl/etc/module.xml index 93a2834f..791e4a73 100644 --- a/ReCaptchaWebapiGraphQl/etc/module.xml +++ b/ReCaptchaWebapiGraphQl/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaWebapiGraphQl"/> diff --git a/ReCaptchaWebapiGraphQl/etc/schema.graphqls b/ReCaptchaWebapiGraphQl/etc/schema.graphqls index cff38831..caf82f99 100644 --- a/ReCaptchaWebapiGraphQl/etc/schema.graphqls +++ b/ReCaptchaWebapiGraphQl/etc/schema.graphqls @@ -1,6 +1,10 @@ -# Copyright 2024 Adobe All rights reserved. -# See COPYING.txt for license details. - +# +# +# Copyright 2023 Adobe +# All Rights Reserved. +# +# +# type Query { recaptchaV3Config: ReCaptchaConfigurationV3 @resolver(class: "Magento\\ReCaptchaWebapiGraphQl\\Model\\Resolver\\ReCaptchaV3") @doc(description: "Returns details about Google reCAPTCHA V3-Invisible configuration.") recaptchaFormConfig(formType: ReCaptchaFormEnum!): ReCaptchaConfigOutput @resolver(class: "Magento\\ReCaptchaWebapiGraphQl\\Model\\Resolver\\ReCaptchaFormConfig") diff --git a/ReCaptchaWebapiGraphQl/registration.php b/ReCaptchaWebapiGraphQl/registration.php index 9d99e132..c74add3b 100644 --- a/ReCaptchaWebapiGraphQl/registration.php +++ b/ReCaptchaWebapiGraphQl/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaWebapiRest/Plugin/RestValidationPlugin.php b/ReCaptchaWebapiRest/Plugin/RestValidationPlugin.php index 3e85ef0a..e641401f 100644 --- a/ReCaptchaWebapiRest/Plugin/RestValidationPlugin.php +++ b/ReCaptchaWebapiRest/Plugin/RestValidationPlugin.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiRest\Plugin; diff --git a/ReCaptchaWebapiRest/Plugin/SoapValidationPlugin.php b/ReCaptchaWebapiRest/Plugin/SoapValidationPlugin.php index ad53b684..702a2e05 100644 --- a/ReCaptchaWebapiRest/Plugin/SoapValidationPlugin.php +++ b/ReCaptchaWebapiRest/Plugin/SoapValidationPlugin.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiRest\Plugin; diff --git a/ReCaptchaWebapiRest/Plugin/ValidationOverrider.php b/ReCaptchaWebapiRest/Plugin/ValidationOverrider.php index 06be9eee..c649d897 100644 --- a/ReCaptchaWebapiRest/Plugin/ValidationOverrider.php +++ b/ReCaptchaWebapiRest/Plugin/ValidationOverrider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiRest\Plugin; diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php index bd410551..c706d9e7 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/RestValidationPluginTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiRest\Test\Unit\Plugin; diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php index 1f28487d..c39fdd00 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/SoapValidationPluginTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiRest\Test\Unit\Plugin; diff --git a/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php b/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php index 332cacb1..1ec0546c 100644 --- a/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php +++ b/ReCaptchaWebapiRest/Test/Unit/Plugin/ValidationOverriderTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWebapiRest\Test\Unit\Plugin; diff --git a/ReCaptchaWebapiRest/etc/di.xml b/ReCaptchaWebapiRest/etc/di.xml index cfaf88b6..5f47ac48 100644 --- a/ReCaptchaWebapiRest/etc/di.xml +++ b/ReCaptchaWebapiRest/etc/di.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Webapi\Controller\Rest\RequestValidator"> <plugin name="rest_webapi_recaptcha_validation" type="Magento\ReCaptchaWebapiRest\Plugin\RestValidationPlugin" /> diff --git a/ReCaptchaWebapiRest/etc/module.xml b/ReCaptchaWebapiRest/etc/module.xml index 5ee5170d..c2dbd083 100644 --- a/ReCaptchaWebapiRest/etc/module.xml +++ b/ReCaptchaWebapiRest/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaWebapiRest"/> diff --git a/ReCaptchaWebapiRest/etc/webapi_rest/di.xml b/ReCaptchaWebapiRest/etc/webapi_rest/di.xml index b881cd85..2d8ed68c 100644 --- a/ReCaptchaWebapiRest/etc/webapi_rest/di.xml +++ b/ReCaptchaWebapiRest/etc/webapi_rest/di.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaValidationApi\Api\ValidatorInterface"> <plugin name="webapi_recaptcha_validation_override" type="Magento\ReCaptchaWebapiRest\Plugin\ValidationOverrider" /> diff --git a/ReCaptchaWebapiRest/etc/webapi_soap/di.xml b/ReCaptchaWebapiRest/etc/webapi_soap/di.xml index b881cd85..2d8ed68c 100644 --- a/ReCaptchaWebapiRest/etc/webapi_soap/di.xml +++ b/ReCaptchaWebapiRest/etc/webapi_soap/di.xml @@ -1,11 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> - <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\ReCaptchaValidationApi\Api\ValidatorInterface"> <plugin name="webapi_recaptcha_validation_override" type="Magento\ReCaptchaWebapiRest\Plugin\ValidationOverrider" /> diff --git a/ReCaptchaWebapiRest/registration.php b/ReCaptchaWebapiRest/registration.php index a7239df2..0e78e6bb 100644 --- a/ReCaptchaWebapiRest/registration.php +++ b/ReCaptchaWebapiRest/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaWebapiUi/etc/module.xml b/ReCaptchaWebapiUi/etc/module.xml index a26f71c5..da240653 100644 --- a/ReCaptchaWebapiUi/etc/module.xml +++ b/ReCaptchaWebapiUi/etc/module.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaWebapiUi"/> diff --git a/ReCaptchaWebapiUi/registration.php b/ReCaptchaWebapiUi/registration.php index fcf8ab63..9b5eb62d 100644 --- a/ReCaptchaWebapiUi/registration.php +++ b/ReCaptchaWebapiUi/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaWebapiUi/view/frontend/requirejs-config.js b/ReCaptchaWebapiUi/view/frontend/requirejs-config.js index 6b787ba5..f173cd81 100644 --- a/ReCaptchaWebapiUi/view/frontend/requirejs-config.js +++ b/ReCaptchaWebapiUi/view/frontend/requirejs-config.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ // eslint-disable-next-line no-unused-vars diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/jquery-mixin.js b/ReCaptchaWebapiUi/view/frontend/web/js/jquery-mixin.js index e6f13966..8b93fcad 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/jquery-mixin.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/jquery-mixin.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ // jscs:disable requireDotNotation diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js index 312a68b5..e2979d0d 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptcha.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ // jscs:disable jsDoc diff --git a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js index 3d504c14..b5d47cc7 100644 --- a/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js +++ b/ReCaptchaWebapiUi/view/frontend/web/js/webapiReCaptchaRegistry.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([], function () { diff --git a/ReCaptchaWishlist/Observer/ShareWishlistObserver.php b/ReCaptchaWishlist/Observer/ShareWishlistObserver.php index 03794b23..39e0a2f6 100644 --- a/ReCaptchaWishlist/Observer/ShareWishlistObserver.php +++ b/ReCaptchaWishlist/Observer/ShareWishlistObserver.php @@ -1,8 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWishlist\Observer; diff --git a/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php b/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php index 891aa5db..ed43dfa2 100644 --- a/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php +++ b/ReCaptchaWishlist/Test/Integration/ShareWishlistFormTest.php @@ -1,8 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\ReCaptchaWishlist\Test\Integration; diff --git a/ReCaptchaWishlist/etc/adminhtml/system.xml b/ReCaptchaWishlist/etc/adminhtml/system.xml index 43eb75a8..cf2fff86 100644 --- a/ReCaptchaWishlist/etc/adminhtml/system.xml +++ b/ReCaptchaWishlist/etc/adminhtml/system.xml @@ -4,7 +4,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <system> diff --git a/ReCaptchaWishlist/etc/config.xml b/ReCaptchaWishlist/etc/config.xml index 5c4c6860..e0438db5 100644 --- a/ReCaptchaWishlist/etc/config.xml +++ b/ReCaptchaWishlist/etc/config.xml @@ -4,7 +4,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> <default> diff --git a/ReCaptchaWishlist/etc/frontend/events.xml b/ReCaptchaWishlist/etc/frontend/events.xml index ba55bf8d..2a4a19d2 100644 --- a/ReCaptchaWishlist/etc/frontend/events.xml +++ b/ReCaptchaWishlist/etc/frontend/events.xml @@ -4,7 +4,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"> <event name="controller_action_predispatch_wishlist_index_send"> diff --git a/ReCaptchaWishlist/etc/module.xml b/ReCaptchaWishlist/etc/module.xml index 0bca040d..dddb7ad5 100644 --- a/ReCaptchaWishlist/etc/module.xml +++ b/ReCaptchaWishlist/etc/module.xml @@ -4,7 +4,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="Magento_ReCaptchaWishlist"/> diff --git a/ReCaptchaWishlist/registration.php b/ReCaptchaWishlist/registration.php index fe00143b..999ad303 100644 --- a/ReCaptchaWishlist/registration.php +++ b/ReCaptchaWishlist/registration.php @@ -1,8 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml b/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml index 9ec49570..619957ff 100644 --- a/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml +++ b/ReCaptchaWishlist/view/frontend/layout/wishlist_index_share.xml @@ -4,7 +4,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ - --> +--> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> diff --git a/Securitytxt/Controller/Index/Securitytxt.php b/Securitytxt/Controller/Index/Securitytxt.php index 685384a2..5e5e4e4a 100644 --- a/Securitytxt/Controller/Index/Securitytxt.php +++ b/Securitytxt/Controller/Index/Securitytxt.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/Securitytxt/Controller/Index/Securitytxtsig.php b/Securitytxt/Controller/Index/Securitytxtsig.php index ddc828f2..e17919bf 100644 --- a/Securitytxt/Controller/Index/Securitytxtsig.php +++ b/Securitytxt/Controller/Index/Securitytxtsig.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/Securitytxt/Controller/Router.php b/Securitytxt/Controller/Router.php index 3ed0cb7b..c806ee36 100644 --- a/Securitytxt/Controller/Router.php +++ b/Securitytxt/Controller/Router.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/Securitytxt/Model/Config.php b/Securitytxt/Model/Config.php index 6af98e08..bdba190f 100644 --- a/Securitytxt/Model/Config.php +++ b/Securitytxt/Model/Config.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/Securitytxt/Model/Config/Backend/SecureUrl.php b/Securitytxt/Model/Config/Backend/SecureUrl.php index 50e6bd71..00d0f67b 100644 --- a/Securitytxt/Model/Config/Backend/SecureUrl.php +++ b/Securitytxt/Model/Config/Backend/SecureUrl.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\Securitytxt\Model\Config\Backend; diff --git a/Securitytxt/Model/Config/Signature.php b/Securitytxt/Model/Config/Signature.php index a9d62d31..3ab20f02 100644 --- a/Securitytxt/Model/Config/Signature.php +++ b/Securitytxt/Model/Config/Signature.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\Securitytxt\Model\Config; diff --git a/Securitytxt/Model/Securitytxt.php b/Securitytxt/Model/Securitytxt.php index e23329bf..32dfcc8f 100644 --- a/Securitytxt/Model/Securitytxt.php +++ b/Securitytxt/Model/Securitytxt.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/Securitytxt/Test/Mftf/ActionGroup/AssertFullSecurityTxtConfigurationActionGroup.xml b/Securitytxt/Test/Mftf/ActionGroup/AssertFullSecurityTxtConfigurationActionGroup.xml index 12fb8218..35351812 100644 --- a/Securitytxt/Test/Mftf/ActionGroup/AssertFullSecurityTxtConfigurationActionGroup.xml +++ b/Securitytxt/Test/Mftf/ActionGroup/AssertFullSecurityTxtConfigurationActionGroup.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> - <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AssertFullSecurityTxtConfiguration"> diff --git a/Securitytxt/Test/Mftf/ActionGroup/FillSecurityTxtConfigurationActionGroup.xml b/Securitytxt/Test/Mftf/ActionGroup/FillSecurityTxtConfigurationActionGroup.xml index 6b59f3ff..9c0fd7c7 100644 --- a/Securitytxt/Test/Mftf/ActionGroup/FillSecurityTxtConfigurationActionGroup.xml +++ b/Securitytxt/Test/Mftf/ActionGroup/FillSecurityTxtConfigurationActionGroup.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> - <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="FillSecurityTxtConfigurationActionGroup"> diff --git a/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtPageActionGroup.xml b/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtPageActionGroup.xml index 90c44c5f..c2884ac5 100644 --- a/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtPageActionGroup.xml +++ b/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtPageActionGroup.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> - <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="OpenSecurityTxtPage"> diff --git a/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtSignaturePageActionGroup.xml b/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtSignaturePageActionGroup.xml index bb017897..6b04a50a 100644 --- a/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtSignaturePageActionGroup.xml +++ b/Securitytxt/Test/Mftf/ActionGroup/OpenSecurityTxtSignaturePageActionGroup.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> - <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="OpenSecurityTxtSignaturePage"> diff --git a/Securitytxt/Test/Mftf/Data/SecuritytxtConfigData.xml b/Securitytxt/Test/Mftf/Data/SecuritytxtConfigData.xml index 3804a106..e74c18fd 100644 --- a/Securitytxt/Test/Mftf/Data/SecuritytxtConfigData.xml +++ b/Securitytxt/Test/Mftf/Data/SecuritytxtConfigData.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> - <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="EnableSecurityTxt"> diff --git a/Securitytxt/Test/Mftf/Data/SecuritytxtPageData.xml b/Securitytxt/Test/Mftf/Data/SecuritytxtPageData.xml index be1f0f06..48c65c7c 100644 --- a/Securitytxt/Test/Mftf/Data/SecuritytxtPageData.xml +++ b/Securitytxt/Test/Mftf/Data/SecuritytxtPageData.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> - <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="SecurityTxtPageData"> diff --git a/Securitytxt/Test/Mftf/Page/AdminSecurityTxtConfigurationPage.xml b/Securitytxt/Test/Mftf/Page/AdminSecurityTxtConfigurationPage.xml index cd5462b0..8430bbb6 100644 --- a/Securitytxt/Test/Mftf/Page/AdminSecurityTxtConfigurationPage.xml +++ b/Securitytxt/Test/Mftf/Page/AdminSecurityTxtConfigurationPage.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> - <pages xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd"> <page name="AdminSecurityTxtConfigurationPage" url="admin/system_config/edit/section/magento_securitytxt_securitytxt/" area="admin" module="Magento_Securitytxt"> diff --git a/Securitytxt/Test/Mftf/Section/AdminConfigureSecurityTxtSection.xml b/Securitytxt/Test/Mftf/Section/AdminConfigureSecurityTxtSection.xml index 723fb3b8..e5f1a5d4 100644 --- a/Securitytxt/Test/Mftf/Section/AdminConfigureSecurityTxtSection.xml +++ b/Securitytxt/Test/Mftf/Section/AdminConfigureSecurityTxtSection.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> diff --git a/Securitytxt/Test/Mftf/Test/RedirectToNotFoundWhenSecurityTxtIsDisabled.xml b/Securitytxt/Test/Mftf/Test/RedirectToNotFoundWhenSecurityTxtIsDisabled.xml index 5bb2e5fd..0b86f872 100644 --- a/Securitytxt/Test/Mftf/Test/RedirectToNotFoundWhenSecurityTxtIsDisabled.xml +++ b/Securitytxt/Test/Mftf/Test/RedirectToNotFoundWhenSecurityTxtIsDisabled.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/Securitytxt/Test/Mftf/Test/SecurityTxtWithCorrectConfiguration.xml b/Securitytxt/Test/Mftf/Test/SecurityTxtWithCorrectConfiguration.xml index f25ed1ab..2a196fbb 100644 --- a/Securitytxt/Test/Mftf/Test/SecurityTxtWithCorrectConfiguration.xml +++ b/Securitytxt/Test/Mftf/Test/SecurityTxtWithCorrectConfiguration.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2019 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/Securitytxt/etc/acl.xml b/Securitytxt/etc/acl.xml index e72ef9c4..ea4bb036 100644 --- a/Securitytxt/etc/acl.xml +++ b/Securitytxt/etc/acl.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/Securitytxt/etc/adminhtml/system.xml b/Securitytxt/etc/adminhtml/system.xml index 08474520..8f112806 100644 --- a/Securitytxt/etc/adminhtml/system.xml +++ b/Securitytxt/etc/adminhtml/system.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/Securitytxt/etc/config.xml b/Securitytxt/etc/config.xml index c2b3a47a..60b2f2d5 100644 --- a/Securitytxt/etc/config.xml +++ b/Securitytxt/etc/config.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/Securitytxt/etc/di.xml b/Securitytxt/etc/di.xml index 4c44f1e2..f33a244e 100644 --- a/Securitytxt/etc/di.xml +++ b/Securitytxt/etc/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/Securitytxt/etc/frontend/di.xml b/Securitytxt/etc/frontend/di.xml index 36ca7d97..fdc675df 100644 --- a/Securitytxt/etc/frontend/di.xml +++ b/Securitytxt/etc/frontend/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/Securitytxt/etc/frontend/routes.xml b/Securitytxt/etc/frontend/routes.xml index e2cfd519..5832bf3c 100644 --- a/Securitytxt/etc/frontend/routes.xml +++ b/Securitytxt/etc/frontend/routes.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/Securitytxt/etc/module.xml b/Securitytxt/etc/module.xml index 80561d37..0bcf6b65 100644 --- a/Securitytxt/etc/module.xml +++ b/Securitytxt/etc/module.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/Securitytxt/registration.php b/Securitytxt/registration.php index 8ed7af62..7f72224c 100644 --- a/Securitytxt/registration.php +++ b/Securitytxt/registration.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2019 Adobe + * All Rights Reserved. */ use \Magento\Framework\Component\ComponentRegistrar; diff --git a/TwoFactorAuth/Api/AdminTokenServiceInterface.php b/TwoFactorAuth/Api/AdminTokenServiceInterface.php index 519b568f..e7708138 100644 --- a/TwoFactorAuth/Api/AdminTokenServiceInterface.php +++ b/TwoFactorAuth/Api/AdminTokenServiceInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/AuthyAuthenticateInterface.php b/TwoFactorAuth/Api/AuthyAuthenticateInterface.php index f6642550..ca713c23 100644 --- a/TwoFactorAuth/Api/AuthyAuthenticateInterface.php +++ b/TwoFactorAuth/Api/AuthyAuthenticateInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/AuthyConfigureInterface.php b/TwoFactorAuth/Api/AuthyConfigureInterface.php index 22afeecb..027d3171 100644 --- a/TwoFactorAuth/Api/AuthyConfigureInterface.php +++ b/TwoFactorAuth/Api/AuthyConfigureInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/CountryRepositoryInterface.php b/TwoFactorAuth/Api/CountryRepositoryInterface.php index efe695c5..7b242784 100644 --- a/TwoFactorAuth/Api/CountryRepositoryInterface.php +++ b/TwoFactorAuth/Api/CountryRepositoryInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/Data/AdminTokenResponseInterface.php b/TwoFactorAuth/Api/Data/AdminTokenResponseInterface.php index 067d1cb3..1c928f4f 100644 --- a/TwoFactorAuth/Api/Data/AdminTokenResponseInterface.php +++ b/TwoFactorAuth/Api/Data/AdminTokenResponseInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/Data/AuthyDeviceInterface.php b/TwoFactorAuth/Api/Data/AuthyDeviceInterface.php index e961410a..8f3ac6c3 100644 --- a/TwoFactorAuth/Api/Data/AuthyDeviceInterface.php +++ b/TwoFactorAuth/Api/Data/AuthyDeviceInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api\Data; diff --git a/TwoFactorAuth/Api/Data/AuthyRegistrationPromptResponseInterface.php b/TwoFactorAuth/Api/Data/AuthyRegistrationPromptResponseInterface.php index 993270da..5a21c99b 100644 --- a/TwoFactorAuth/Api/Data/AuthyRegistrationPromptResponseInterface.php +++ b/TwoFactorAuth/Api/Data/AuthyRegistrationPromptResponseInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/Data/CountryInterface.php b/TwoFactorAuth/Api/Data/CountryInterface.php index 1a7c42fb..1797726c 100644 --- a/TwoFactorAuth/Api/Data/CountryInterface.php +++ b/TwoFactorAuth/Api/Data/CountryInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api\Data; diff --git a/TwoFactorAuth/Api/Data/CountrySearchResultsInterface.php b/TwoFactorAuth/Api/Data/CountrySearchResultsInterface.php index 18c87a21..1fefa000 100644 --- a/TwoFactorAuth/Api/Data/CountrySearchResultsInterface.php +++ b/TwoFactorAuth/Api/Data/CountrySearchResultsInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api\Data; diff --git a/TwoFactorAuth/Api/Data/DuoDataInterface.php b/TwoFactorAuth/Api/Data/DuoDataInterface.php index 5f937f6e..00630e3e 100644 --- a/TwoFactorAuth/Api/Data/DuoDataInterface.php +++ b/TwoFactorAuth/Api/Data/DuoDataInterface.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api\Data; diff --git a/TwoFactorAuth/Api/Data/GoogleAuthenticateInterface.php b/TwoFactorAuth/Api/Data/GoogleAuthenticateInterface.php index fcdfc267..b40b4092 100644 --- a/TwoFactorAuth/Api/Data/GoogleAuthenticateInterface.php +++ b/TwoFactorAuth/Api/Data/GoogleAuthenticateInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/Data/GoogleConfigureInterface.php b/TwoFactorAuth/Api/Data/GoogleConfigureInterface.php index d401a7ae..68c9ec13 100644 --- a/TwoFactorAuth/Api/Data/GoogleConfigureInterface.php +++ b/TwoFactorAuth/Api/Data/GoogleConfigureInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api\Data; diff --git a/TwoFactorAuth/Api/Data/U2fWebAuthnRequestInterface.php b/TwoFactorAuth/Api/Data/U2fWebAuthnRequestInterface.php index 7a47b686..c4fc165d 100644 --- a/TwoFactorAuth/Api/Data/U2fWebAuthnRequestInterface.php +++ b/TwoFactorAuth/Api/Data/U2fWebAuthnRequestInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/Data/UserConfigInterface.php b/TwoFactorAuth/Api/Data/UserConfigInterface.php index 17b23510..6105467f 100644 --- a/TwoFactorAuth/Api/Data/UserConfigInterface.php +++ b/TwoFactorAuth/Api/Data/UserConfigInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api\Data; diff --git a/TwoFactorAuth/Api/Data/UserConfigSearchResultsInterface.php b/TwoFactorAuth/Api/Data/UserConfigSearchResultsInterface.php index 140fea79..b0af4b82 100644 --- a/TwoFactorAuth/Api/Data/UserConfigSearchResultsInterface.php +++ b/TwoFactorAuth/Api/Data/UserConfigSearchResultsInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api\Data; diff --git a/TwoFactorAuth/Api/EngineInterface.php b/TwoFactorAuth/Api/EngineInterface.php index 432b1680..dfd6229e 100644 --- a/TwoFactorAuth/Api/EngineInterface.php +++ b/TwoFactorAuth/Api/EngineInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/Exception/NotificationExceptionInterface.php b/TwoFactorAuth/Api/Exception/NotificationExceptionInterface.php index c80f4471..844198a6 100644 --- a/TwoFactorAuth/Api/Exception/NotificationExceptionInterface.php +++ b/TwoFactorAuth/Api/Exception/NotificationExceptionInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/GoogleAuthenticateInterface.php b/TwoFactorAuth/Api/GoogleAuthenticateInterface.php index f5cccd39..8feda581 100644 --- a/TwoFactorAuth/Api/GoogleAuthenticateInterface.php +++ b/TwoFactorAuth/Api/GoogleAuthenticateInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/GoogleConfigureInterface.php b/TwoFactorAuth/Api/GoogleConfigureInterface.php index 8c5f809a..0ae42240 100644 --- a/TwoFactorAuth/Api/GoogleConfigureInterface.php +++ b/TwoFactorAuth/Api/GoogleConfigureInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/ProviderInterface.php b/TwoFactorAuth/Api/ProviderInterface.php index 652493a6..7dacb982 100644 --- a/TwoFactorAuth/Api/ProviderInterface.php +++ b/TwoFactorAuth/Api/ProviderInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/ProviderPoolInterface.php b/TwoFactorAuth/Api/ProviderPoolInterface.php index 2806bcfe..498f84ce 100644 --- a/TwoFactorAuth/Api/ProviderPoolInterface.php +++ b/TwoFactorAuth/Api/ProviderPoolInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/TfaInterface.php b/TwoFactorAuth/Api/TfaInterface.php index a6c122d4..4db6101e 100644 --- a/TwoFactorAuth/Api/TfaInterface.php +++ b/TwoFactorAuth/Api/TfaInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/TfaSessionInterface.php b/TwoFactorAuth/Api/TfaSessionInterface.php index 4875bd17..2668dabb 100644 --- a/TwoFactorAuth/Api/TfaSessionInterface.php +++ b/TwoFactorAuth/Api/TfaSessionInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/TfatActionsInterface.php b/TwoFactorAuth/Api/TfatActionsInterface.php index f8cb2b40..b41335dd 100644 --- a/TwoFactorAuth/Api/TfatActionsInterface.php +++ b/TwoFactorAuth/Api/TfatActionsInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/U2fKeyAuthenticateInterface.php b/TwoFactorAuth/Api/U2fKeyAuthenticateInterface.php index 29ff7b15..f692e271 100644 --- a/TwoFactorAuth/Api/U2fKeyAuthenticateInterface.php +++ b/TwoFactorAuth/Api/U2fKeyAuthenticateInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/U2fKeyConfigReaderInterface.php b/TwoFactorAuth/Api/U2fKeyConfigReaderInterface.php index f6d0595d..169b498a 100644 --- a/TwoFactorAuth/Api/U2fKeyConfigReaderInterface.php +++ b/TwoFactorAuth/Api/U2fKeyConfigReaderInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/U2fKeyConfigureInterface.php b/TwoFactorAuth/Api/U2fKeyConfigureInterface.php index 19483ef4..e01b5649 100644 --- a/TwoFactorAuth/Api/U2fKeyConfigureInterface.php +++ b/TwoFactorAuth/Api/U2fKeyConfigureInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/UserConfigManagerInterface.php b/TwoFactorAuth/Api/UserConfigManagerInterface.php index 521d8c17..e4c0a8b1 100644 --- a/TwoFactorAuth/Api/UserConfigManagerInterface.php +++ b/TwoFactorAuth/Api/UserConfigManagerInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/UserConfigRepositoryInterface.php b/TwoFactorAuth/Api/UserConfigRepositoryInterface.php index d5d2dbfe..ae6c2cb9 100644 --- a/TwoFactorAuth/Api/UserConfigRepositoryInterface.php +++ b/TwoFactorAuth/Api/UserConfigRepositoryInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Api; diff --git a/TwoFactorAuth/Api/UserConfigRequestManagerInterface.php b/TwoFactorAuth/Api/UserConfigRequestManagerInterface.php index a574d8e7..26b9a777 100644 --- a/TwoFactorAuth/Api/UserConfigRequestManagerInterface.php +++ b/TwoFactorAuth/Api/UserConfigRequestManagerInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/UserConfigTokenManagerInterface.php b/TwoFactorAuth/Api/UserConfigTokenManagerInterface.php index fa7ddc22..d428e704 100644 --- a/TwoFactorAuth/Api/UserConfigTokenManagerInterface.php +++ b/TwoFactorAuth/Api/UserConfigTokenManagerInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Api/UserNotifierInterface.php b/TwoFactorAuth/Api/UserNotifierInterface.php index 100d7636..76e9619b 100644 --- a/TwoFactorAuth/Api/UserNotifierInterface.php +++ b/TwoFactorAuth/Api/UserNotifierInterface.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Block/ChangeProvider.php b/TwoFactorAuth/Block/ChangeProvider.php index 6b251cc8..3084d9db 100644 --- a/TwoFactorAuth/Block/ChangeProvider.php +++ b/TwoFactorAuth/Block/ChangeProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block; diff --git a/TwoFactorAuth/Block/Configure.php b/TwoFactorAuth/Block/Configure.php index 2032cfa9..fe187d26 100644 --- a/TwoFactorAuth/Block/Configure.php +++ b/TwoFactorAuth/Block/Configure.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Block/ConfigureLater.php b/TwoFactorAuth/Block/ConfigureLater.php index 446caca8..de139213 100644 --- a/TwoFactorAuth/Block/ConfigureLater.php +++ b/TwoFactorAuth/Block/ConfigureLater.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block; diff --git a/TwoFactorAuth/Block/Provider/Authy/Auth.php b/TwoFactorAuth/Block/Provider/Authy/Auth.php index 18182240..30baba74 100644 --- a/TwoFactorAuth/Block/Provider/Authy/Auth.php +++ b/TwoFactorAuth/Block/Provider/Authy/Auth.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\Authy; diff --git a/TwoFactorAuth/Block/Provider/Authy/Configure.php b/TwoFactorAuth/Block/Provider/Authy/Configure.php index 40e97ae8..2796d4a5 100644 --- a/TwoFactorAuth/Block/Provider/Authy/Configure.php +++ b/TwoFactorAuth/Block/Provider/Authy/Configure.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\Authy; diff --git a/TwoFactorAuth/Block/Provider/Google/Auth.php b/TwoFactorAuth/Block/Provider/Google/Auth.php index 221c44ca..93af80e1 100644 --- a/TwoFactorAuth/Block/Provider/Google/Auth.php +++ b/TwoFactorAuth/Block/Provider/Google/Auth.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\Google; diff --git a/TwoFactorAuth/Block/Provider/Google/Configure.php b/TwoFactorAuth/Block/Provider/Google/Configure.php index 1d1227d3..747927e6 100644 --- a/TwoFactorAuth/Block/Provider/Google/Configure.php +++ b/TwoFactorAuth/Block/Provider/Google/Configure.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\Google; diff --git a/TwoFactorAuth/Block/Provider/U2fKey/Auth.php b/TwoFactorAuth/Block/Provider/U2fKey/Auth.php index b884c75a..4542702a 100644 --- a/TwoFactorAuth/Block/Provider/U2fKey/Auth.php +++ b/TwoFactorAuth/Block/Provider/U2fKey/Auth.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\U2fKey; diff --git a/TwoFactorAuth/Block/Provider/U2fKey/Configure.php b/TwoFactorAuth/Block/Provider/U2fKey/Configure.php index f11b2351..489ae575 100644 --- a/TwoFactorAuth/Block/Provider/U2fKey/Configure.php +++ b/TwoFactorAuth/Block/Provider/U2fKey/Configure.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Block\Provider\U2fKey; diff --git a/TwoFactorAuth/Command/GoogleSecret.php b/TwoFactorAuth/Command/GoogleSecret.php index 3be8f01f..0e7392c5 100644 --- a/TwoFactorAuth/Command/GoogleSecret.php +++ b/TwoFactorAuth/Command/GoogleSecret.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Command; diff --git a/TwoFactorAuth/Command/TfaProviders.php b/TwoFactorAuth/Command/TfaProviders.php index a2aeebe7..6810ee18 100644 --- a/TwoFactorAuth/Command/TfaProviders.php +++ b/TwoFactorAuth/Command/TfaProviders.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Command; diff --git a/TwoFactorAuth/Command/TfaReset.php b/TwoFactorAuth/Command/TfaReset.php index 6c4f55de..eb297a73 100644 --- a/TwoFactorAuth/Command/TfaReset.php +++ b/TwoFactorAuth/Command/TfaReset.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Command; diff --git a/TwoFactorAuth/Controller/Adminhtml/AbstractAction.php b/TwoFactorAuth/Controller/Adminhtml/AbstractAction.php index f3a3868f..9076fbb0 100644 --- a/TwoFactorAuth/Controller/Adminhtml/AbstractAction.php +++ b/TwoFactorAuth/Controller/Adminhtml/AbstractAction.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml; diff --git a/TwoFactorAuth/Controller/Adminhtml/AbstractConfigureAction.php b/TwoFactorAuth/Controller/Adminhtml/AbstractConfigureAction.php index e7892d60..3efb73fe 100644 --- a/TwoFactorAuth/Controller/Adminhtml/AbstractConfigureAction.php +++ b/TwoFactorAuth/Controller/Adminhtml/AbstractConfigureAction.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Auth.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Auth.php index e4f25cd8..1cf83c45 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Auth.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Auth.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php index 0a1d5674..20cc20f0 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Authpost.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Configure.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Configure.php index 07356384..31ebfdb9 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Configure.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Configure.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Configurepost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Configurepost.php index aa0bab38..b8ac3897 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Configurepost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Configurepost.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Configureverifypost.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Configureverifypost.php index c94fffd9..b3e03f7f 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Configureverifypost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Configureverifypost.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Onetouch.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Onetouch.php index 52da562d..f2b80cb7 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Onetouch.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Onetouch.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Token.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Token.php index f4fca06f..0de89748 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Token.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Token.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Verify.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Verify.php index badb4e45..56f3b636 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Verify.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Verify.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Authy/Verifyonetouch.php b/TwoFactorAuth/Controller/Adminhtml/Authy/Verifyonetouch.php index 1812c1e6..28402fe8 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Authy/Verifyonetouch.php +++ b/TwoFactorAuth/Controller/Adminhtml/Authy/Verifyonetouch.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Authy; diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php index bc46deed..31e9fc84 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Authpost.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Duo; diff --git a/TwoFactorAuth/Controller/Adminhtml/Duo/Configure.php b/TwoFactorAuth/Controller/Adminhtml/Duo/Configure.php index aa1c690f..5cefec63 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Duo/Configure.php +++ b/TwoFactorAuth/Controller/Adminhtml/Duo/Configure.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Duo; diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Auth.php b/TwoFactorAuth/Controller/Adminhtml/Google/Auth.php index df652239..96493a31 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Auth.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Auth.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Google; diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php index 14a70134..266b3f8c 100755 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Authpost.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Google; diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Configure.php b/TwoFactorAuth/Controller/Adminhtml/Google/Configure.php index 1b3e6743..9e6b21f0 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Configure.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Configure.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Google; diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Configurepost.php b/TwoFactorAuth/Controller/Adminhtml/Google/Configurepost.php index e4d823d3..b7e944e8 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Configurepost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Configurepost.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Google; diff --git a/TwoFactorAuth/Controller/Adminhtml/Google/Qr.php b/TwoFactorAuth/Controller/Adminhtml/Google/Qr.php index f5eb03e6..e29304c5 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Google/Qr.php +++ b/TwoFactorAuth/Controller/Adminhtml/Google/Qr.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Google; diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/AccessDenied.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/AccessDenied.php index bce6590a..d42aee34 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/AccessDenied.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/AccessDenied.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Tfa; diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/Configure.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/Configure.php index 6643e85c..ad3cc1b4 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/Configure.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/Configure.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/ConfigureLater.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/ConfigureLater.php index dc07f8d6..12fd010a 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/ConfigureLater.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/ConfigureLater.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/Configurepost.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/Configurepost.php index e47ef0ea..f3c31abd 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/Configurepost.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/Configurepost.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/Index.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/Index.php index f428d6c4..3ea932d6 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/Index.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/Index.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Tfa; diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/Requestconfig.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/Requestconfig.php index 535026a3..ddb63cf5 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/Requestconfig.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/Requestconfig.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php b/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php index 69fae050..35dc7e89 100644 --- a/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php +++ b/TwoFactorAuth/Controller/Adminhtml/Tfa/Reset.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\Tfa; diff --git a/TwoFactorAuth/Controller/Adminhtml/U2f/Auth.php b/TwoFactorAuth/Controller/Adminhtml/U2f/Auth.php index 613dcfa6..9ae692d5 100644 --- a/TwoFactorAuth/Controller/Adminhtml/U2f/Auth.php +++ b/TwoFactorAuth/Controller/Adminhtml/U2f/Auth.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\U2f; diff --git a/TwoFactorAuth/Controller/Adminhtml/U2f/Authpost.php b/TwoFactorAuth/Controller/Adminhtml/U2f/Authpost.php index 70905c05..9aae812d 100644 --- a/TwoFactorAuth/Controller/Adminhtml/U2f/Authpost.php +++ b/TwoFactorAuth/Controller/Adminhtml/U2f/Authpost.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\U2f; diff --git a/TwoFactorAuth/Controller/Adminhtml/U2f/Configure.php b/TwoFactorAuth/Controller/Adminhtml/U2f/Configure.php index 7c33c2c6..8ff2ea55 100644 --- a/TwoFactorAuth/Controller/Adminhtml/U2f/Configure.php +++ b/TwoFactorAuth/Controller/Adminhtml/U2f/Configure.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\U2f; diff --git a/TwoFactorAuth/Controller/Adminhtml/U2f/Configurepost.php b/TwoFactorAuth/Controller/Adminhtml/U2f/Configurepost.php index 91978915..2023cfd2 100644 --- a/TwoFactorAuth/Controller/Adminhtml/U2f/Configurepost.php +++ b/TwoFactorAuth/Controller/Adminhtml/U2f/Configurepost.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Controller\Adminhtml\U2f; diff --git a/TwoFactorAuth/Model/AdminAccessTokenService.php b/TwoFactorAuth/Model/AdminAccessTokenService.php index 007878a0..9cdc0b1c 100644 --- a/TwoFactorAuth/Model/AdminAccessTokenService.php +++ b/TwoFactorAuth/Model/AdminAccessTokenService.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Alert.php b/TwoFactorAuth/Model/Alert.php index f6d28044..eab11460 100644 --- a/TwoFactorAuth/Model/Alert.php +++ b/TwoFactorAuth/Model/Alert.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/AlertInterface.php b/TwoFactorAuth/Model/AlertInterface.php index ce07377d..85e020f1 100644 --- a/TwoFactorAuth/Model/AlertInterface.php +++ b/TwoFactorAuth/Model/AlertInterface.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/Config/Backend/Duo/ApiHostname.php b/TwoFactorAuth/Model/Config/Backend/Duo/ApiHostname.php index fcc9cc6a..24a250f2 100644 --- a/TwoFactorAuth/Model/Config/Backend/Duo/ApiHostname.php +++ b/TwoFactorAuth/Model/Config/Backend/Duo/ApiHostname.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Config/Backend/Leeway.php b/TwoFactorAuth/Model/Config/Backend/Leeway.php index bb45d0e1..2909c95e 100644 --- a/TwoFactorAuth/Model/Config/Backend/Leeway.php +++ b/TwoFactorAuth/Model/Config/Backend/Leeway.php @@ -3,6 +3,7 @@ * Copyright 2024 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Config\Backend; diff --git a/TwoFactorAuth/Model/Config/Source/EnabledProvider.php b/TwoFactorAuth/Model/Config/Source/EnabledProvider.php index 3b85fae2..86abd910 100644 --- a/TwoFactorAuth/Model/Config/Source/EnabledProvider.php +++ b/TwoFactorAuth/Model/Config/Source/EnabledProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Config\Source; diff --git a/TwoFactorAuth/Model/Config/Source/Provider.php b/TwoFactorAuth/Model/Config/Source/Provider.php index 3dc1e6eb..55f7e3a7 100644 --- a/TwoFactorAuth/Model/Config/Source/Provider.php +++ b/TwoFactorAuth/Model/Config/Source/Provider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Config\Source; diff --git a/TwoFactorAuth/Model/Config/UserNotifier.php b/TwoFactorAuth/Model/Config/UserNotifier.php index 9ad5c61a..ded21dfa 100644 --- a/TwoFactorAuth/Model/Config/UserNotifier.php +++ b/TwoFactorAuth/Model/Config/UserNotifier.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Config/WebApiUserNotifier.php b/TwoFactorAuth/Model/Config/WebApiUserNotifier.php index 95fe91cf..3d5f9667 100644 --- a/TwoFactorAuth/Model/Config/WebApiUserNotifier.php +++ b/TwoFactorAuth/Model/Config/WebApiUserNotifier.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Country.php b/TwoFactorAuth/Model/Country.php index 2ed4b858..6cdc3384 100644 --- a/TwoFactorAuth/Model/Country.php +++ b/TwoFactorAuth/Model/Country.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/CountryRegistry.php b/TwoFactorAuth/Model/CountryRegistry.php index d45f11cd..edb3ff0e 100644 --- a/TwoFactorAuth/Model/CountryRegistry.php +++ b/TwoFactorAuth/Model/CountryRegistry.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/Data/AdminTokenResponse.php b/TwoFactorAuth/Model/Data/AdminTokenResponse.php index 956ca842..bcc239ab 100644 --- a/TwoFactorAuth/Model/Data/AdminTokenResponse.php +++ b/TwoFactorAuth/Model/Data/AdminTokenResponse.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Data; diff --git a/TwoFactorAuth/Model/Data/Country.php b/TwoFactorAuth/Model/Data/Country.php index 35c43b79..ea880df6 100644 --- a/TwoFactorAuth/Model/Data/Country.php +++ b/TwoFactorAuth/Model/Data/Country.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Data; diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/Authy/Device.php b/TwoFactorAuth/Model/Data/Provider/Engine/Authy/Device.php index 68eddac3..1f1e93d1 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/Authy/Device.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/Authy/Device.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/Authy/RegistrationResponse.php b/TwoFactorAuth/Model/Data/Provider/Engine/Authy/RegistrationResponse.php index 99b7f5a6..677e928a 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/Authy/RegistrationResponse.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/Authy/RegistrationResponse.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/Google/AuthenticateData.php b/TwoFactorAuth/Model/Data/Provider/Engine/Google/AuthenticateData.php index e01cade1..25adcbd0 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/Google/AuthenticateData.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/Google/AuthenticateData.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/Google/ConfigurationData.php b/TwoFactorAuth/Model/Data/Provider/Engine/Google/ConfigurationData.php index 44378481..8018054a 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/Google/ConfigurationData.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/Google/ConfigurationData.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Data/Provider/Engine/U2fkey/WebAuthnRequest.php b/TwoFactorAuth/Model/Data/Provider/Engine/U2fkey/WebAuthnRequest.php index dc5de8a3..942206f8 100644 --- a/TwoFactorAuth/Model/Data/Provider/Engine/U2fkey/WebAuthnRequest.php +++ b/TwoFactorAuth/Model/Data/Provider/Engine/U2fkey/WebAuthnRequest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Data/UserConfig.php b/TwoFactorAuth/Model/Data/UserConfig.php index f67e25f6..7f1012cc 100644 --- a/TwoFactorAuth/Model/Data/UserConfig.php +++ b/TwoFactorAuth/Model/Data/UserConfig.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Data; diff --git a/TwoFactorAuth/Model/EmailUserNotifier.php b/TwoFactorAuth/Model/EmailUserNotifier.php index 7ab01949..c53ef6a7 100644 --- a/TwoFactorAuth/Model/EmailUserNotifier.php +++ b/TwoFactorAuth/Model/EmailUserNotifier.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Exception/NotificationException.php b/TwoFactorAuth/Model/Exception/NotificationException.php index 679cac51..4b676e8e 100644 --- a/TwoFactorAuth/Model/Exception/NotificationException.php +++ b/TwoFactorAuth/Model/Exception/NotificationException.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider.php b/TwoFactorAuth/Model/Provider.php index 90195248..8beca4bc 100644 --- a/TwoFactorAuth/Model/Provider.php +++ b/TwoFactorAuth/Model/Provider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/Provider/Engine/Authy.php b/TwoFactorAuth/Model/Provider/Engine/Authy.php index efc59c5e..c433c382 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Authy.php +++ b/TwoFactorAuth/Model/Provider/Engine/Authy.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine; diff --git a/TwoFactorAuth/Model/Provider/Engine/Authy/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/Authy/Authenticate.php index 6318608e..cc6f580b 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Authy/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/Authy/Authenticate.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/Authy/Configure.php b/TwoFactorAuth/Model/Provider/Engine/Authy/Configure.php index df68fcf3..4f34c1a0 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Authy/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/Authy/Configure.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/Authy/OneTouch.php b/TwoFactorAuth/Model/Provider/Engine/Authy/OneTouch.php index 84c03d08..5a6be704 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Authy/OneTouch.php +++ b/TwoFactorAuth/Model/Provider/Engine/Authy/OneTouch.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine\Authy; diff --git a/TwoFactorAuth/Model/Provider/Engine/Authy/Service.php b/TwoFactorAuth/Model/Provider/Engine/Authy/Service.php index 8278a02e..fe27d7d8 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Authy/Service.php +++ b/TwoFactorAuth/Model/Provider/Engine/Authy/Service.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine\Authy; diff --git a/TwoFactorAuth/Model/Provider/Engine/Authy/Token.php b/TwoFactorAuth/Model/Provider/Engine/Authy/Token.php index 9dd58cb7..c49fa8b0 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Authy/Token.php +++ b/TwoFactorAuth/Model/Provider/Engine/Authy/Token.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine\Authy; diff --git a/TwoFactorAuth/Model/Provider/Engine/Authy/Verification.php b/TwoFactorAuth/Model/Provider/Engine/Authy/Verification.php index 13730aca..fbdf7acb 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Authy/Verification.php +++ b/TwoFactorAuth/Model/Provider/Engine/Authy/Verification.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine\Authy; diff --git a/TwoFactorAuth/Model/Provider/Engine/Google.php b/TwoFactorAuth/Model/Provider/Engine/Google.php index 03fa8501..a8b69bdb 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Google.php +++ b/TwoFactorAuth/Model/Provider/Engine/Google.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine; diff --git a/TwoFactorAuth/Model/Provider/Engine/Google/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/Google/Authenticate.php index bdfdc447..75b0781f 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Google/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/Google/Authenticate.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/Google/Configure.php b/TwoFactorAuth/Model/Provider/Engine/Google/Configure.php index d1ecad49..d7c0f6b1 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Google/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/Google/Configure.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/Google/TotpFactory.php b/TwoFactorAuth/Model/Provider/Engine/Google/TotpFactory.php index b0a72090..18d78ed9 100644 --- a/TwoFactorAuth/Model/Provider/Engine/Google/TotpFactory.php +++ b/TwoFactorAuth/Model/Provider/Engine/Google/TotpFactory.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/U2fKey.php b/TwoFactorAuth/Model/Provider/Engine/U2fKey.php index a4a6b313..86ccfb58 100644 --- a/TwoFactorAuth/Model/Provider/Engine/U2fKey.php +++ b/TwoFactorAuth/Model/Provider/Engine/U2fKey.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\Provider\Engine; diff --git a/TwoFactorAuth/Model/Provider/Engine/U2fKey/Authenticate.php b/TwoFactorAuth/Model/Provider/Engine/U2fKey/Authenticate.php index 7b6abe21..865f88e1 100644 --- a/TwoFactorAuth/Model/Provider/Engine/U2fKey/Authenticate.php +++ b/TwoFactorAuth/Model/Provider/Engine/U2fKey/Authenticate.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/U2fKey/ConfigReader.php b/TwoFactorAuth/Model/Provider/Engine/U2fKey/ConfigReader.php index ef4adaa2..ad8f731e 100644 --- a/TwoFactorAuth/Model/Provider/Engine/U2fKey/ConfigReader.php +++ b/TwoFactorAuth/Model/Provider/Engine/U2fKey/ConfigReader.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/U2fKey/Configure.php b/TwoFactorAuth/Model/Provider/Engine/U2fKey/Configure.php index 1fab3fc1..89c92af5 100644 --- a/TwoFactorAuth/Model/Provider/Engine/U2fKey/Configure.php +++ b/TwoFactorAuth/Model/Provider/Engine/U2fKey/Configure.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/U2fKey/Session.php b/TwoFactorAuth/Model/Provider/Engine/U2fKey/Session.php index 7bec3c6f..206644d0 100644 --- a/TwoFactorAuth/Model/Provider/Engine/U2fKey/Session.php +++ b/TwoFactorAuth/Model/Provider/Engine/U2fKey/Session.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebApiConfigReader.php b/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebApiConfigReader.php index 1bdc7dda..bc7591dd 100644 --- a/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebApiConfigReader.php +++ b/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebApiConfigReader.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebAuthn.php b/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebAuthn.php index e9e499d2..b77c295e 100644 --- a/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebAuthn.php +++ b/TwoFactorAuth/Model/Provider/Engine/U2fKey/WebAuthn.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/ProviderPool.php b/TwoFactorAuth/Model/ProviderPool.php index b8502344..1a6e81f5 100644 --- a/TwoFactorAuth/Model/ProviderPool.php +++ b/TwoFactorAuth/Model/ProviderPool.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/ResourceModel/Country.php b/TwoFactorAuth/Model/ResourceModel/Country.php index ec5bdc26..026b64b8 100644 --- a/TwoFactorAuth/Model/ResourceModel/Country.php +++ b/TwoFactorAuth/Model/ResourceModel/Country.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\ResourceModel; diff --git a/TwoFactorAuth/Model/ResourceModel/Country/Collection.php b/TwoFactorAuth/Model/ResourceModel/Country/Collection.php index e0576182..9fd72690 100644 --- a/TwoFactorAuth/Model/ResourceModel/Country/Collection.php +++ b/TwoFactorAuth/Model/ResourceModel/Country/Collection.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\ResourceModel\Country; diff --git a/TwoFactorAuth/Model/ResourceModel/CountryRepository.php b/TwoFactorAuth/Model/ResourceModel/CountryRepository.php index 1b4abb0c..c9b01fda 100644 --- a/TwoFactorAuth/Model/ResourceModel/CountryRepository.php +++ b/TwoFactorAuth/Model/ResourceModel/CountryRepository.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\ResourceModel; diff --git a/TwoFactorAuth/Model/ResourceModel/UserConfig.php b/TwoFactorAuth/Model/ResourceModel/UserConfig.php index bce6d213..36cbddb6 100644 --- a/TwoFactorAuth/Model/ResourceModel/UserConfig.php +++ b/TwoFactorAuth/Model/ResourceModel/UserConfig.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\ResourceModel; diff --git a/TwoFactorAuth/Model/ResourceModel/UserConfig/Collection.php b/TwoFactorAuth/Model/ResourceModel/UserConfig/Collection.php index 53f6e0e9..d773c6b6 100644 --- a/TwoFactorAuth/Model/ResourceModel/UserConfig/Collection.php +++ b/TwoFactorAuth/Model/ResourceModel/UserConfig/Collection.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\ResourceModel\UserConfig; diff --git a/TwoFactorAuth/Model/ResourceModel/UserConfigRepository.php b/TwoFactorAuth/Model/ResourceModel/UserConfigRepository.php index dd865ec1..2a699c59 100644 --- a/TwoFactorAuth/Model/ResourceModel/UserConfigRepository.php +++ b/TwoFactorAuth/Model/ResourceModel/UserConfigRepository.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model\ResourceModel; diff --git a/TwoFactorAuth/Model/Tfa.php b/TwoFactorAuth/Model/Tfa.php index cd7c567c..3fa753cb 100644 --- a/TwoFactorAuth/Model/Tfa.php +++ b/TwoFactorAuth/Model/Tfa.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/TfaSession.php b/TwoFactorAuth/Model/TfaSession.php index 67a337eb..b7703e15 100644 --- a/TwoFactorAuth/Model/TfaSession.php +++ b/TwoFactorAuth/Model/TfaSession.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/TfatActions.php b/TwoFactorAuth/Model/TfatActions.php index c9856f0b..97406d69 100644 --- a/TwoFactorAuth/Model/TfatActions.php +++ b/TwoFactorAuth/Model/TfatActions.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/UserAuthenticator.php b/TwoFactorAuth/Model/UserAuthenticator.php index 14152961..3c0a6528 100644 --- a/TwoFactorAuth/Model/UserAuthenticator.php +++ b/TwoFactorAuth/Model/UserAuthenticator.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/UserConfig.php b/TwoFactorAuth/Model/UserConfig.php index d1619696..a8c91c94 100644 --- a/TwoFactorAuth/Model/UserConfig.php +++ b/TwoFactorAuth/Model/UserConfig.php @@ -3,6 +3,7 @@ * Copyright 2020 Adobe * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/UserConfig/HtmlAreaTokenVerifier.php b/TwoFactorAuth/Model/UserConfig/HtmlAreaTokenVerifier.php index 1192df29..6f6b7966 100644 --- a/TwoFactorAuth/Model/UserConfig/HtmlAreaTokenVerifier.php +++ b/TwoFactorAuth/Model/UserConfig/HtmlAreaTokenVerifier.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/UserConfig/SignedTokenManager.php b/TwoFactorAuth/Model/UserConfig/SignedTokenManager.php index 3d742871..1c72aebc 100644 --- a/TwoFactorAuth/Model/UserConfig/SignedTokenManager.php +++ b/TwoFactorAuth/Model/UserConfig/SignedTokenManager.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/UserConfig/UserConfigRequestManager.php b/TwoFactorAuth/Model/UserConfig/UserConfigRequestManager.php index 07f0460b..4121113a 100644 --- a/TwoFactorAuth/Model/UserConfig/UserConfigRequestManager.php +++ b/TwoFactorAuth/Model/UserConfig/UserConfigRequestManager.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Model/UserConfigManager.php b/TwoFactorAuth/Model/UserConfigManager.php index 2160d576..85928785 100644 --- a/TwoFactorAuth/Model/UserConfigManager.php +++ b/TwoFactorAuth/Model/UserConfigManager.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Model/UserConfigRegistry.php b/TwoFactorAuth/Model/UserConfigRegistry.php index 2cfe1e2c..3b46384f 100644 --- a/TwoFactorAuth/Model/UserConfigRegistry.php +++ b/TwoFactorAuth/Model/UserConfigRegistry.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Model; diff --git a/TwoFactorAuth/Observer/AdminUserLoadAfter.php b/TwoFactorAuth/Observer/AdminUserLoadAfter.php index d9c1dbc3..112ac549 100644 --- a/TwoFactorAuth/Observer/AdminUserLoadAfter.php +++ b/TwoFactorAuth/Observer/AdminUserLoadAfter.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Observer; diff --git a/TwoFactorAuth/Observer/AdminUserSaveAfter.php b/TwoFactorAuth/Observer/AdminUserSaveAfter.php index f5777997..c447b951 100644 --- a/TwoFactorAuth/Observer/AdminUserSaveAfter.php +++ b/TwoFactorAuth/Observer/AdminUserSaveAfter.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Observer; diff --git a/TwoFactorAuth/Observer/ControllerActionPredispatch.php b/TwoFactorAuth/Observer/ControllerActionPredispatch.php index 5028abd6..77695d2d 100644 --- a/TwoFactorAuth/Observer/ControllerActionPredispatch.php +++ b/TwoFactorAuth/Observer/ControllerActionPredispatch.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Observer; diff --git a/TwoFactorAuth/Plugin/AddTabToAdminUserEdit.php b/TwoFactorAuth/Plugin/AddTabToAdminUserEdit.php index 99bb9f3d..f563e4a4 100644 --- a/TwoFactorAuth/Plugin/AddTabToAdminUserEdit.php +++ b/TwoFactorAuth/Plugin/AddTabToAdminUserEdit.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Plugin; diff --git a/TwoFactorAuth/Plugin/AvoidRecursionOnPasswordChange.php b/TwoFactorAuth/Plugin/AvoidRecursionOnPasswordChange.php index 0caa8bd9..29bd46b8 100644 --- a/TwoFactorAuth/Plugin/AvoidRecursionOnPasswordChange.php +++ b/TwoFactorAuth/Plugin/AvoidRecursionOnPasswordChange.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Plugin; diff --git a/TwoFactorAuth/Plugin/DeleteCookieOnLogout.php b/TwoFactorAuth/Plugin/DeleteCookieOnLogout.php index cc15737d..f2618494 100644 --- a/TwoFactorAuth/Plugin/DeleteCookieOnLogout.php +++ b/TwoFactorAuth/Plugin/DeleteCookieOnLogout.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Plugin/FirstAvailableMenu.php b/TwoFactorAuth/Plugin/FirstAvailableMenu.php index b2841c9f..caad036e 100644 --- a/TwoFactorAuth/Plugin/FirstAvailableMenu.php +++ b/TwoFactorAuth/Plugin/FirstAvailableMenu.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Setup/Patch/Data/CopyConfigFromOldModule.php b/TwoFactorAuth/Setup/Patch/Data/CopyConfigFromOldModule.php index a627574b..67d2d254 100644 --- a/TwoFactorAuth/Setup/Patch/Data/CopyConfigFromOldModule.php +++ b/TwoFactorAuth/Setup/Patch/Data/CopyConfigFromOldModule.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Setup\Patch\Data; diff --git a/TwoFactorAuth/Setup/Patch/Data/EncryptConfiguration.php b/TwoFactorAuth/Setup/Patch/Data/EncryptConfiguration.php index 513b652e..30751571 100644 --- a/TwoFactorAuth/Setup/Patch/Data/EncryptConfiguration.php +++ b/TwoFactorAuth/Setup/Patch/Data/EncryptConfiguration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Setup\Patch\Data; diff --git a/TwoFactorAuth/Setup/Patch/Data/EncryptGoogleSecrets.php b/TwoFactorAuth/Setup/Patch/Data/EncryptGoogleSecrets.php index 686bdf31..3f8dbd7d 100644 --- a/TwoFactorAuth/Setup/Patch/Data/EncryptGoogleSecrets.php +++ b/TwoFactorAuth/Setup/Patch/Data/EncryptGoogleSecrets.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Setup\Patch\Data; diff --git a/TwoFactorAuth/Setup/Patch/Data/PopulateCountryTable.php b/TwoFactorAuth/Setup/Patch/Data/PopulateCountryTable.php index d49855dd..50652e81 100644 --- a/TwoFactorAuth/Setup/Patch/Data/PopulateCountryTable.php +++ b/TwoFactorAuth/Setup/Patch/Data/PopulateCountryTable.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Setup\Patch\Data; diff --git a/TwoFactorAuth/Setup/Patch/Data/ResetU2fConfig.php b/TwoFactorAuth/Setup/Patch/Data/ResetU2fConfig.php index 18986427..8c276fd4 100644 --- a/TwoFactorAuth/Setup/Patch/Data/ResetU2fConfig.php +++ b/TwoFactorAuth/Setup/Patch/Data/ResetU2fConfig.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Setup\Patch\Data; diff --git a/TwoFactorAuth/Setup/Patch/Schema/CopyTablesFromOldModule.php b/TwoFactorAuth/Setup/Patch/Schema/CopyTablesFromOldModule.php index 3392544e..35762a21 100644 --- a/TwoFactorAuth/Setup/Patch/Schema/CopyTablesFromOldModule.php +++ b/TwoFactorAuth/Setup/Patch/Schema/CopyTablesFromOldModule.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Setup\Patch\Schema; diff --git a/TwoFactorAuth/Test/Api/AdminIntegrationTokenTest.php b/TwoFactorAuth/Test/Api/AdminIntegrationTokenTest.php index 801d4a1f..c19ffe69 100644 --- a/TwoFactorAuth/Test/Api/AdminIntegrationTokenTest.php +++ b/TwoFactorAuth/Test/Api/AdminIntegrationTokenTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Api; diff --git a/TwoFactorAuth/Test/Api/GoogleActivateTest.php b/TwoFactorAuth/Test/Api/GoogleActivateTest.php index cdae4865..2511baa9 100644 --- a/TwoFactorAuth/Test/Api/GoogleActivateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleActivateTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Api; diff --git a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php index ef54a531..0222bf74 100644 --- a/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php +++ b/TwoFactorAuth/Test/Api/GoogleAuthenticateTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Api; diff --git a/TwoFactorAuth/Test/Api/GoogleConfigureTest.php b/TwoFactorAuth/Test/Api/GoogleConfigureTest.php index e92c856c..da46a0d7 100644 --- a/TwoFactorAuth/Test/Api/GoogleConfigureTest.php +++ b/TwoFactorAuth/Test/Api/GoogleConfigureTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Api; diff --git a/TwoFactorAuth/Test/Integration/Command/GoogleSecretTest.php b/TwoFactorAuth/Test/Integration/Command/GoogleSecretTest.php index d3d9daa9..0343816a 100644 --- a/TwoFactorAuth/Test/Integration/Command/GoogleSecretTest.php +++ b/TwoFactorAuth/Test/Integration/Command/GoogleSecretTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureTest.php index c22245b8..2576c35d 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigurepostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigurepostTest.php index e70afaa3..462a0413 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigurepostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigurepostTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureverifypostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureverifypostTest.php index b1517110..615d6a14 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureverifypostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Authy/ConfigureverifypostTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigureTest.php index a82c6348..5a7c45d3 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigureTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigurepostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigurepostTest.php index 7c96f339..fd8887ca 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigurepostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Google/ConfigurepostTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureTest.php index 3331daec..d4f09587 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigureTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigurepostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigurepostTest.php index bcd9cdee..aa9c68e6 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigurepostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/ConfigurepostTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/RequestconfigTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/RequestconfigTest.php index 35d488b8..fbd378d4 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/RequestconfigTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/Tfa/RequestconfigTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigureTest.php index 2dbe3e89..699d3355 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigureTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigurepostTest.php b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigurepostTest.php index 473fb882..ddc6b548 100644 --- a/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigurepostTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/Adminhtml/U2f/ConfigurepostTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Controller/SoapTest.php b/TwoFactorAuth/Test/Integration/Controller/SoapTest.php index 50bf11f0..6c921e4a 100644 --- a/TwoFactorAuth/Test/Integration/Controller/SoapTest.php +++ b/TwoFactorAuth/Test/Integration/Controller/SoapTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ namespace Magento\TwoFactorAuth\Test\Integration\Controller; diff --git a/TwoFactorAuth/Test/Integration/Model/Config/UserNotifierTest.php b/TwoFactorAuth/Test/Integration/Model/Config/UserNotifierTest.php index 48a3af34..56eaae95 100644 --- a/TwoFactorAuth/Test/Integration/Model/Config/UserNotifierTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Config/UserNotifierTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Config/WebApiUserNotifierTest.php b/TwoFactorAuth/Test/Integration/Model/Config/WebApiUserNotifierTest.php index bf6a6344..a7e245c5 100644 --- a/TwoFactorAuth/Test/Integration/Model/Config/WebApiUserNotifierTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Config/WebApiUserNotifierTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/AuthenticateTest.php index 4f3dcd37..02c68351 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/AuthenticateTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/ConfigureTest.php index a4f1ff69..609dde3e 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/Authy/ConfigureTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/AuthenticateTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/AuthenticateTest.php index 3448fc6a..f668eadc 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/AuthenticateTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/AuthenticateTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/ConfigureTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/ConfigureTest.php index f9f952a7..cd410ca9 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/ConfigureTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/ConfigureTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/SessionTest.php b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/SessionTest.php index 56039e51..1f1cbfc4 100644 --- a/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/SessionTest.php +++ b/TwoFactorAuth/Test/Integration/Model/Provider/Engine/U2fKey/SessionTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/Model/TfaSessionTest.php b/TwoFactorAuth/Test/Integration/Model/TfaSessionTest.php index 73195242..897d50e3 100644 --- a/TwoFactorAuth/Test/Integration/Model/TfaSessionTest.php +++ b/TwoFactorAuth/Test/Integration/Model/TfaSessionTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/UserConfigManagerTest.php b/TwoFactorAuth/Test/Integration/UserConfigManagerTest.php index 0ef7d110..50d8b00f 100644 --- a/TwoFactorAuth/Test/Integration/UserConfigManagerTest.php +++ b/TwoFactorAuth/Test/Integration/UserConfigManagerTest.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Integration; diff --git a/TwoFactorAuth/Test/Integration/UserConfigTokenManagerTest.php b/TwoFactorAuth/Test/Integration/UserConfigTokenManagerTest.php index c98419d6..49376665 100644 --- a/TwoFactorAuth/Test/Integration/UserConfigTokenManagerTest.php +++ b/TwoFactorAuth/Test/Integration/UserConfigTokenManagerTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Integration/_files/overrides.xml b/TwoFactorAuth/Test/Integration/_files/overrides.xml index c6109823..5ab2c0be 100644 --- a/TwoFactorAuth/Test/Integration/_files/overrides.xml +++ b/TwoFactorAuth/Test/Integration/_files/overrides.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <overrides> <test class="\Magento\Webapi\Controller\SoapTest" skip="true"/> <test class="\Magento\Webapi\Controller\SoapEnterpriseTest" skip="true"/> diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml index c235e474..b7cb2bd9 100644 --- a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateRoleActionGroup.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateUserRoleWithReportsActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateUserRoleWithReportsActionGroup.xml index b0fa4280..ad84b55c 100644 --- a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateUserRoleWithReportsActionGroup.xml +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminCreateUserRoleWithReportsActionGroup.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml index c756a363..7a8c5663 100644 --- a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminFillUserRoleRequiredDataActionGroup.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml index 97bd9001..34d315be 100644 --- a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> diff --git a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml index df848dcb..0c9ae61b 100644 --- a/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml +++ b/TwoFactorAuth/Test/Mftf/ActionGroup/AdminSaveUserRoleActionGroup.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- /** -* Copyright 2023 Adobe -* All Rights Reserved. -*/ + * Copyright 2023 Adobe + * All Rights Reserved. + */ --> - <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminSaveUserRoleActionGroup"> diff --git a/TwoFactorAuth/Test/Mftf/Data/TwoFactorAuthData.xml b/TwoFactorAuth/Test/Mftf/Data/TwoFactorAuthData.xml index dc75c491..bd3fed54 100644 --- a/TwoFactorAuth/Test/Mftf/Data/TwoFactorAuthData.xml +++ b/TwoFactorAuth/Test/Mftf/Data/TwoFactorAuthData.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2021 Adobe + * All Rights Reserved. + */ --> - <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="adminApiToken" type="adminToken"> <data key="username">{{_ENV.MAGENTO_ADMIN_USERNAME}}</data> diff --git a/TwoFactorAuth/Test/Mftf/Data/UserRoleData.xml b/TwoFactorAuth/Test/Mftf/Data/UserRoleData.xml index 16a4bca3..014f660a 100644 --- a/TwoFactorAuth/Test/Mftf/Data/UserRoleData.xml +++ b/TwoFactorAuth/Test/Mftf/Data/UserRoleData.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> - <entities xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd"> <entity name="adminRestrictedProductRole" type="user_role"> <array key="resource"> diff --git a/TwoFactorAuth/Test/Mftf/Helper/FillOtp.php b/TwoFactorAuth/Test/Mftf/Helper/FillOtp.php index 3135b8fe..94b6331c 100644 --- a/TwoFactorAuth/Test/Mftf/Helper/FillOtp.php +++ b/TwoFactorAuth/Test/Mftf/Helper/FillOtp.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Mftf/Helper/SetSharedSecret.php b/TwoFactorAuth/Test/Mftf/Helper/SetSharedSecret.php index 4d03d013..70487e5c 100644 --- a/TwoFactorAuth/Test/Mftf/Helper/SetSharedSecret.php +++ b/TwoFactorAuth/Test/Mftf/Helper/SetSharedSecret.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Mftf/Metadata/TwoFactorAuthMeta.xml b/TwoFactorAuth/Test/Mftf/Metadata/TwoFactorAuthMeta.xml index 81d2d1af..81b458ad 100644 --- a/TwoFactorAuth/Test/Mftf/Metadata/TwoFactorAuthMeta.xml +++ b/TwoFactorAuth/Test/Mftf/Metadata/TwoFactorAuthMeta.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2021 Adobe + * All Rights Reserved. + */ --> <operations xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd"> diff --git a/TwoFactorAuth/Test/Mftf/Section/AdminEditRoleInfoSection.xml b/TwoFactorAuth/Test/Mftf/Section/AdminEditRoleInfoSection.xml index 27240767..d50200c7 100644 --- a/TwoFactorAuth/Test/Mftf/Section/AdminEditRoleInfoSection.xml +++ b/TwoFactorAuth/Test/Mftf/Section/AdminEditRoleInfoSection.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="utf-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminEditRoleInfoSection"> diff --git a/TwoFactorAuth/Test/Mftf/Section/AdminGoogleTfaSection.xml b/TwoFactorAuth/Test/Mftf/Section/AdminGoogleTfaSection.xml index 9297b203..788f4636 100644 --- a/TwoFactorAuth/Test/Mftf/Section/AdminGoogleTfaSection.xml +++ b/TwoFactorAuth/Test/Mftf/Section/AdminGoogleTfaSection.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> - <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="AdminGoogleTfaSection"> diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml index 691b1750..739dc420 100644 --- a/TwoFactorAuth/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest"> diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminConfigurationPermissionTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminConfigurationPermissionTest.xml index 560f6986..b421cae0 100644 --- a/TwoFactorAuth/Test/Mftf/Test/AdminConfigurationPermissionTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/AdminConfigurationPermissionTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminConfigurationPermissionTest"> diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml index b7d31a8d..c35c251a 100644 --- a/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/AdminReviewOrderWithReportsPermissionTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="AdminReviewOrderWithReportsPermissionTest"> diff --git a/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml b/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml index 8404b4d0..67bda6ac 100644 --- a/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/AdminUpdateUserRoleTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2021 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> diff --git a/TwoFactorAuth/Test/Mftf/Test/RestrictedAdminCatalogMassActionPermissionTest.xml b/TwoFactorAuth/Test/Mftf/Test/RestrictedAdminCatalogMassActionPermissionTest.xml index 708291a0..646a546e 100644 --- a/TwoFactorAuth/Test/Mftf/Test/RestrictedAdminCatalogMassActionPermissionTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/RestrictedAdminCatalogMassActionPermissionTest.xml @@ -1,11 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> - <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="RestrictedAdminCatalogMassActionPermissionTest"> diff --git a/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleForProductRemovalTest.xml b/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleForProductRemovalTest.xml index 22b21c7e..fe9aa36d 100644 --- a/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleForProductRemovalTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleForProductRemovalTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="RestrictedUserRoleForProductRemovalTest"> diff --git a/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleProductAttributeTest.xml b/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleProductAttributeTest.xml index 49ecd5ba..83582449 100644 --- a/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleProductAttributeTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/RestrictedUserRoleProductAttributeTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="RestrictedUserRoleProductAttributeTest"> diff --git a/TwoFactorAuth/Test/Mftf/Test/StorefrontGiftWrappingCanBeAppliedOnOrderLevelAndOrderItemForAdditionalWebsiteTest.xml b/TwoFactorAuth/Test/Mftf/Test/StorefrontGiftWrappingCanBeAppliedOnOrderLevelAndOrderItemForAdditionalWebsiteTest.xml index a62c2d48..97be46a3 100644 --- a/TwoFactorAuth/Test/Mftf/Test/StorefrontGiftWrappingCanBeAppliedOnOrderLevelAndOrderItemForAdditionalWebsiteTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/StorefrontGiftWrappingCanBeAppliedOnOrderLevelAndOrderItemForAdditionalWebsiteTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="StorefrontGiftWrappingCanBeAppliedOnOrderLevelAndOrderItemForAdditionalWebsiteTest"> diff --git a/TwoFactorAuth/Test/Mftf/Test/StorefrontInvoiceFilterTest.xml b/TwoFactorAuth/Test/Mftf/Test/StorefrontInvoiceFilterTest.xml index 2ce65495..c1925049 100644 --- a/TwoFactorAuth/Test/Mftf/Test/StorefrontInvoiceFilterTest.xml +++ b/TwoFactorAuth/Test/Mftf/Test/StorefrontInvoiceFilterTest.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- - /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ +/** + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="StorefrontInvoiceFilterTest"> diff --git a/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php b/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php index 153d69cf..12b755de 100644 --- a/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Config/Backend/Duo/ApiHostnameTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Unit\Model\Config\Backend\Duo; diff --git a/TwoFactorAuth/Test/Unit/Model/Config/Backend/ForceProvidersTest.php b/TwoFactorAuth/Test/Unit/Model/Config/Backend/ForceProvidersTest.php index 248f8a19..51d36eea 100644 --- a/TwoFactorAuth/Test/Unit/Model/Config/Backend/ForceProvidersTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Config/Backend/ForceProvidersTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php index bb2d562c..4b1aae19 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/AuthyTest.php @@ -1,9 +1,9 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Test\Unit\Model\Provider\Engine; diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/GoogleTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/GoogleTest.php index ed6ba5b9..41eaa72d 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/GoogleTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/GoogleTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/ConfigReaderTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/ConfigReaderTest.php index 198d82d5..7d985860 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/ConfigReaderTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/ConfigReaderTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/WebApiConfigReaderTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/WebApiConfigReaderTest.php index a2c13442..32ee9c20 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/WebApiConfigReaderTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKey/WebApiConfigReaderTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKeyTest.php b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKeyTest.php index c30e3657..cacc3e90 100644 --- a/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKeyTest.php +++ b/TwoFactorAuth/Test/Unit/Model/Provider/Engine/U2fKeyTest.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/TfaTest.php b/TwoFactorAuth/Test/Unit/Model/TfaTest.php index 48dbe560..fc6c7ddf 100644 --- a/TwoFactorAuth/Test/Unit/Model/TfaTest.php +++ b/TwoFactorAuth/Test/Unit/Model/TfaTest.php @@ -1,8 +1,7 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php b/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php index 9cad922d..a85941d2 100644 --- a/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php +++ b/TwoFactorAuth/Test/Unit/Model/UserConfig/HtmlAreaTokenVerifierTest.php @@ -1,8 +1,7 @@ <?php /** * Copyright 2024 Adobe - * All rights reserved. - * See COPYING.txt for license details. + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/TestFramework/Plugin/BypassTwoFactorAuth.php b/TwoFactorAuth/TestFramework/Plugin/BypassTwoFactorAuth.php index ae084bff..d9b01fee 100644 --- a/TwoFactorAuth/TestFramework/Plugin/BypassTwoFactorAuth.php +++ b/TwoFactorAuth/TestFramework/Plugin/BypassTwoFactorAuth.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2021 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/TestFramework/TestCase/AbstractBackendController.php b/TwoFactorAuth/TestFramework/TestCase/AbstractBackendController.php index fc6d4155..19230e71 100644 --- a/TwoFactorAuth/TestFramework/TestCase/AbstractBackendController.php +++ b/TwoFactorAuth/TestFramework/TestCase/AbstractBackendController.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/TestFramework/TestCase/AbstractConfigureBackendController.php b/TwoFactorAuth/TestFramework/TestCase/AbstractConfigureBackendController.php index 50063cad..ec49b2fc 100644 --- a/TwoFactorAuth/TestFramework/TestCase/AbstractConfigureBackendController.php +++ b/TwoFactorAuth/TestFramework/TestCase/AbstractConfigureBackendController.php @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ declare(strict_types=1); diff --git a/TwoFactorAuth/Ui/Component/Form/User/DataProvider.php b/TwoFactorAuth/Ui/Component/Form/User/DataProvider.php index ee3a5dbc..c36ad129 100644 --- a/TwoFactorAuth/Ui/Component/Form/User/DataProvider.php +++ b/TwoFactorAuth/Ui/Component/Form/User/DataProvider.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); namespace Magento\TwoFactorAuth\Ui\Component\Form\User; diff --git a/TwoFactorAuth/etc/acl.xml b/TwoFactorAuth/etc/acl.xml index 0ff1cdeb..a754fac2 100644 --- a/TwoFactorAuth/etc/acl.xml +++ b/TwoFactorAuth/etc/acl.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ - --> +--> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> <acl> diff --git a/TwoFactorAuth/etc/adminhtml/events.xml b/TwoFactorAuth/etc/adminhtml/events.xml index 0d5c1f23..801ccb77 100644 --- a/TwoFactorAuth/etc/adminhtml/events.xml +++ b/TwoFactorAuth/etc/adminhtml/events.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/etc/adminhtml/routes.xml b/TwoFactorAuth/etc/adminhtml/routes.xml index bbc7e5c6..9fc65704 100644 --- a/TwoFactorAuth/etc/adminhtml/routes.xml +++ b/TwoFactorAuth/etc/adminhtml/routes.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/etc/adminhtml/system.xml b/TwoFactorAuth/etc/adminhtml/system.xml index 9dd505de..7ac2da7d 100755 --- a/TwoFactorAuth/etc/adminhtml/system.xml +++ b/TwoFactorAuth/etc/adminhtml/system.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2020 Adobe - * All Rights Reserved. - */ + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> diff --git a/TwoFactorAuth/etc/config.xml b/TwoFactorAuth/etc/config.xml index c8c56bc6..e9afc9f0 100644 --- a/TwoFactorAuth/etc/config.xml +++ b/TwoFactorAuth/etc/config.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2020 Adobe - * All Rights Reserved. - */ + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> diff --git a/TwoFactorAuth/etc/db_schema.xml b/TwoFactorAuth/etc/db_schema.xml index 711a24c2..f4fe7cb3 100644 --- a/TwoFactorAuth/etc/db_schema.xml +++ b/TwoFactorAuth/etc/db_schema.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/etc/di.xml b/TwoFactorAuth/etc/di.xml index 6e743e9a..5e04d31b 100644 --- a/TwoFactorAuth/etc/di.xml +++ b/TwoFactorAuth/etc/di.xml @@ -1,9 +1,9 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2020 Adobe - * All Rights Reserved. - */ + * Copyright 2020 Adobe + * All Rights Reserved. + */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> diff --git a/TwoFactorAuth/etc/email_templates.xml b/TwoFactorAuth/etc/email_templates.xml index addfd7bd..3bc386fe 100644 --- a/TwoFactorAuth/etc/email_templates.xml +++ b/TwoFactorAuth/etc/email_templates.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Email:etc/email_templates.xsd"> diff --git a/TwoFactorAuth/etc/module.xml b/TwoFactorAuth/etc/module.xml index 9f24769d..8a808c8c 100644 --- a/TwoFactorAuth/etc/module.xml +++ b/TwoFactorAuth/etc/module.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/etc/webapi.xml b/TwoFactorAuth/etc/webapi.xml index e9ab31e7..e947faca 100644 --- a/TwoFactorAuth/etc/webapi.xml +++ b/TwoFactorAuth/etc/webapi.xml @@ -1,10 +1,10 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2020 Adobe - * All Rights Reserved. - */ - --> + * Copyright 2020 Adobe + * All Rights Reserved. + */ +--> <routes xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Webapi:etc/webapi.xsd"> diff --git a/TwoFactorAuth/etc/webapi_rest/di.xml b/TwoFactorAuth/etc/webapi_rest/di.xml index 1f87ae33..4645f1c3 100644 --- a/TwoFactorAuth/etc/webapi_rest/di.xml +++ b/TwoFactorAuth/etc/webapi_rest/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/etc/webapi_soap/di.xml b/TwoFactorAuth/etc/webapi_soap/di.xml index 1f87ae33..4645f1c3 100644 --- a/TwoFactorAuth/etc/webapi_soap/di.xml +++ b/TwoFactorAuth/etc/webapi_soap/di.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/registration.php b/TwoFactorAuth/registration.php index 3048cf3a..94a265b9 100644 --- a/TwoFactorAuth/registration.php +++ b/TwoFactorAuth/registration.php @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + declare(strict_types=1); \Magento\Framework\Component\ComponentRegistrar::register( diff --git a/TwoFactorAuth/view/adminhtml/email/app_config_required.html b/TwoFactorAuth/view/adminhtml/email/app_config_required.html index 6bf3684d..0745f72b 100644 --- a/TwoFactorAuth/view/adminhtml/email/app_config_required.html +++ b/TwoFactorAuth/view/adminhtml/email/app_config_required.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <!--@subject {{trans "2FA configuration required for %name" name=$store_name}} @--> <!--@vars { diff --git a/TwoFactorAuth/view/adminhtml/email/user_config_required.html b/TwoFactorAuth/view/adminhtml/email/user_config_required.html index efffe609..4531aa24 100644 --- a/TwoFactorAuth/view/adminhtml/email/user_config_required.html +++ b/TwoFactorAuth/view/adminhtml/email/user_config_required.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <!--@subject {{trans "2FA configuration required for %name" name=$username}} @--> <!--@vars { diff --git a/TwoFactorAuth/view/adminhtml/layout/adminhtml_user_edit.xml b/TwoFactorAuth/view/adminhtml/layout/adminhtml_user_edit.xml index c9771d6c..c4160316 100644 --- a/TwoFactorAuth/view/adminhtml/layout/adminhtml_user_edit.xml +++ b/TwoFactorAuth/view/adminhtml/layout/adminhtml_user_edit.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_authy_auth.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_authy_auth.xml index 2d8327df..207bc585 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_authy_auth.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_authy_auth.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_authy_configure.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_authy_configure.xml index 1a79da42..f3e0f3a0 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_authy_configure.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_authy_configure.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_duo_auth.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_duo_auth.xml index 273a7cdf..a74818ec 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_duo_auth.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_duo_auth.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_google_auth.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_google_auth.xml index 8288e39e..dbd087fb 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_google_auth.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_google_auth.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_google_configure.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_google_configure.xml index a571f628..5214002b 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_google_configure.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_google_configure.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_screen.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_screen.xml index 419048cc..a9106150 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_screen.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_screen.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_accessdenied.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_accessdenied.xml index 956b8550..9e72f173 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_accessdenied.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_accessdenied.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_configure.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_configure.xml index bb56d4a7..b4e4a97e 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_configure.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_configure.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_requestconfig.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_requestconfig.xml index 43643774..82b07e11 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_requestconfig.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_tfa_requestconfig.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_auth.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_auth.xml index 5aa91757..99454163 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_auth.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_auth.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_configure.xml b/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_configure.xml index 8a7d202d..3bf808bd 100644 --- a/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_configure.xml +++ b/TwoFactorAuth/view/adminhtml/layout/tfa_u2f_configure.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/templates/system/config/providers/modal_content_body.phtml b/TwoFactorAuth/view/adminhtml/templates/system/config/providers/modal_content_body.phtml index 91fc1a52..89888e33 100644 --- a/TwoFactorAuth/view/adminhtml/templates/system/config/providers/modal_content_body.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/system/config/providers/modal_content_body.phtml @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ ?> diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/change_provider.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/change_provider.phtml index c9fda998..19241e05 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/change_provider.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/change_provider.phtml @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + ?> <div id="tfa-change-provider-container" data-bind="scope:'tfa-change-provider'"> <!-- ko template: getTemplate() --><!-- /ko --> diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/configure.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/configure.phtml index 2c6fc570..1e3e6795 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/configure.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/configure.phtml @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ /** @var \Magento\TwoFactorAuth\Block\Configure $block */ diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/configure_later.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/configure_later.phtml index d46edab2..975b5d17 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/configure_later.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/configure_later.phtml @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + ?> <?php /** @var $block Magento\TwoFactorAuth\Block\ConfigureLater */ diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml index 71a1d935..6530c810 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/auth.phtml @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + ?> <div id="tfa-auth-container" data-bind="scope:'tfa-auth'"> <!-- ko template: getTemplate() --><!-- /ko --> diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/configure.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/configure.phtml index 5a891c33..6984dd26 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/provider/configure.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/provider/configure.phtml @@ -1,8 +1,9 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + ?> <div id="tfa-configure-container" data-bind="scope:'tfa-configure'"> <!-- ko template: getTemplate() --><!-- /ko --> diff --git a/TwoFactorAuth/view/adminhtml/templates/tfa/request_config.phtml b/TwoFactorAuth/view/adminhtml/templates/tfa/request_config.phtml index e78affe8..c4c52d53 100644 --- a/TwoFactorAuth/view/adminhtml/templates/tfa/request_config.phtml +++ b/TwoFactorAuth/view/adminhtml/templates/tfa/request_config.phtml @@ -1,7 +1,7 @@ <?php /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ /** @var \Magento\Backend\Block\Template $block */ diff --git a/TwoFactorAuth/view/adminhtml/ui_component/tfa_edit_user_form.xml b/TwoFactorAuth/view/adminhtml/ui_component/tfa_edit_user_form.xml index 72e9597f..4d625e74 100644 --- a/TwoFactorAuth/view/adminhtml/ui_component/tfa_edit_user_form.xml +++ b/TwoFactorAuth/view/adminhtml/ui_component/tfa_edit_user_form.xml @@ -1,8 +1,8 @@ <?xml version="1.0"?> <!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ --> <form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" diff --git a/TwoFactorAuth/view/adminhtml/web/css/auth.css b/TwoFactorAuth/view/adminhtml/web/css/auth.css index 77e18ee8..cdc3d78c 100644 --- a/TwoFactorAuth/view/adminhtml/web/css/auth.css +++ b/TwoFactorAuth/view/adminhtml/web/css/auth.css @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ .page-wrapper { diff --git a/TwoFactorAuth/view/adminhtml/web/css/authy.css b/TwoFactorAuth/view/adminhtml/web/css/authy.css index 22f3cf12..abcc43ba 100644 --- a/TwoFactorAuth/view/adminhtml/web/css/authy.css +++ b/TwoFactorAuth/view/adminhtml/web/css/authy.css @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ .tfa-authy-actions-list button span { diff --git a/TwoFactorAuth/view/adminhtml/web/css/duo.css b/TwoFactorAuth/view/adminhtml/web/css/duo.css index e59eac41..db8c4af6 100644 --- a/TwoFactorAuth/view/adminhtml/web/css/duo.css +++ b/TwoFactorAuth/view/adminhtml/web/css/duo.css @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ #duo_iframe { diff --git a/TwoFactorAuth/view/adminhtml/web/css/google.css b/TwoFactorAuth/view/adminhtml/web/css/google.css index 8dcfc278..9d15ae21 100644 --- a/TwoFactorAuth/view/adminhtml/web/css/google.css +++ b/TwoFactorAuth/view/adminhtml/web/css/google.css @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ .tfa-google-qr { diff --git a/TwoFactorAuth/view/adminhtml/web/css/tfa-screen.css b/TwoFactorAuth/view/adminhtml/web/css/tfa-screen.css index f2372469..d0a1f13a 100644 --- a/TwoFactorAuth/view/adminhtml/web/css/tfa-screen.css +++ b/TwoFactorAuth/view/adminhtml/web/css/tfa-screen.css @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ .login-content > li { diff --git a/TwoFactorAuth/view/adminhtml/web/css/tfa.css b/TwoFactorAuth/view/adminhtml/web/css/tfa.css index b2070e76..4235f652 100644 --- a/TwoFactorAuth/view/adminhtml/web/css/tfa.css +++ b/TwoFactorAuth/view/adminhtml/web/css/tfa.css @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ .tfa-forced-providers ul { diff --git a/TwoFactorAuth/view/adminhtml/web/css/u2f.css b/TwoFactorAuth/view/adminhtml/web/css/u2f.css index 97eee42d..f3cad401 100644 --- a/TwoFactorAuth/view/adminhtml/web/css/u2f.css +++ b/TwoFactorAuth/view/adminhtml/web/css/u2f.css @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ fieldset { diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js index 5048adc0..c7ae8cb1 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/auth.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/configure.js b/TwoFactorAuth/view/adminhtml/web/js/authy/configure.js index 04fe4c9b..8dce65a5 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/configure.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/configure.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/configure/register.js b/TwoFactorAuth/view/adminhtml/web/js/authy/configure/register.js index a40f6142..59bc2103 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/configure/register.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/configure/register.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/configure/registry.js b/TwoFactorAuth/view/adminhtml/web/js/authy/configure/registry.js index dcf101a8..55bc3cb4 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/configure/registry.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/configure/registry.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/authy/configure/verify.js b/TwoFactorAuth/view/adminhtml/web/js/authy/configure/verify.js index 95be978d..6082d5b0 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/authy/configure/verify.js +++ b/TwoFactorAuth/view/adminhtml/web/js/authy/configure/verify.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/change_provider.js b/TwoFactorAuth/view/adminhtml/web/js/change_provider.js index 431ecc47..67e3f39e 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/change_provider.js +++ b/TwoFactorAuth/view/adminhtml/web/js/change_provider.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/error.js b/TwoFactorAuth/view/adminhtml/web/js/error.js index 3708cf6f..5ceef8b9 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/error.js +++ b/TwoFactorAuth/view/adminhtml/web/js/error.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/form/element/providers.js b/TwoFactorAuth/view/adminhtml/web/js/form/element/providers.js index 207c3fd1..0ab67fda 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/form/element/providers.js +++ b/TwoFactorAuth/view/adminhtml/web/js/form/element/providers.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define(['Magento_Ui/js/form/element/abstract'], function (Abstract) { diff --git a/TwoFactorAuth/view/adminhtml/web/js/form/element/reset_providers.js b/TwoFactorAuth/view/adminhtml/web/js/form/element/reset_providers.js index 0feacc76..0161e412 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/form/element/reset_providers.js +++ b/TwoFactorAuth/view/adminhtml/web/js/form/element/reset_providers.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/form/provider.js b/TwoFactorAuth/view/adminhtml/web/js/form/provider.js index ad74c487..e1b8f170 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/form/provider.js +++ b/TwoFactorAuth/view/adminhtml/web/js/form/provider.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js index 02f57d3d..5169412a 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/google/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/google/auth.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js index fe96e0f9..02491489 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/auth.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js index 81838d1f..9f732af4 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/configure.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([ diff --git a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/utils.js b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/utils.js index 0052ca9d..993c4f40 100644 --- a/TwoFactorAuth/view/adminhtml/web/js/u2fkey/utils.js +++ b/TwoFactorAuth/view/adminhtml/web/js/u2fkey/utils.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ define([], function () { diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html b/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html index 6c1ade31..ea19cde3 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <form autocomplete="off"> <fieldset class="admin__fieldset"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html b/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html index 2ae8f030..28131f1c 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html index aaa9bd81..d63a1944 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div> <form autocomplete="off"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html index a4a7a71d..702cb936 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <form autocomplete="off"> <fieldset class="admin__fieldset"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/change_provider.html b/TwoFactorAuth/view/adminhtml/web/template/change_provider.html index 27ef96af..27a7bd4b 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/change_provider.html +++ b/TwoFactorAuth/view/adminhtml/web/template/change_provider.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div visible="getProviders().length > 0"> <a visible='!showChangeMethod()' href="#" class="tfa-change-provider-trigger" click="displayChangeMethod"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html b/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html index 180e14c5..8c608726 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html +++ b/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <!-- ko if: getForcedProviders().length --> <div class="tfa-forced-providers"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html b/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html index 94bbe574..f4ee205c 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html +++ b/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <!-- ko if: getResetProviders().length --> <div class="tfa-reset-providers"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/google/auth.html b/TwoFactorAuth/view/adminhtml/web/template/google/auth.html index 8fec6136..4b444295 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/google/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/google/auth.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/google/configure.html b/TwoFactorAuth/view/adminhtml/web/template/google/configure.html index 2e7b2c16..0f01e561 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/google/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/google/configure.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html index 621d3f9c..047cab03 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div afterRender="onAfterRender"> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html index be297a64..1c0e1537 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html @@ -1,8 +1,10 @@ -<!-- /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2020 Adobe + * All Rights Reserved. */ + +<!-- + --> <div afterRender="onAfterRender"> <div visible='currentStep() === "register"'> diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js index 70229ccd..b89706ef 100644 --- a/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js +++ b/dev/tests/js/jasmine/tests/app/code/Magento/ReCaptchaCheckout/frontend/js/model/place-order-mixin.test.js @@ -1,6 +1,6 @@ /** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. + * Copyright 2022 Adobe + * All Rights Reserved. */ define(['squire' From 368ff6fa472b2f34df17f672b4e1974d18de92e7 Mon Sep 17 00:00:00 2001 From: Alexandra Zota <zota@adobe.com> Date: Sun, 18 May 2025 15:27:41 +0300 Subject: [PATCH 197/208] ACP2E-3920: update copyrights --- ReCaptchaContact/etc/frontend/di.xml | 2 +- ReCaptchaNewsletter/etc/frontend/di.xml | 2 +- ReCaptchaReview/etc/frontend/di.xml | 2 +- ReCaptchaSendFriend/etc/frontend/di.xml | 2 +- ReCaptchaWishlist/view/frontend/web/css/source/_module.less | 3 ++- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ReCaptchaContact/etc/frontend/di.xml b/ReCaptchaContact/etc/frontend/di.xml index 47bf3e1c..da2ef61e 100644 --- a/ReCaptchaContact/etc/frontend/di.xml +++ b/ReCaptchaContact/etc/frontend/di.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2022 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/ReCaptchaNewsletter/etc/frontend/di.xml b/ReCaptchaNewsletter/etc/frontend/di.xml index d3a20fd2..1a46121e 100644 --- a/ReCaptchaNewsletter/etc/frontend/di.xml +++ b/ReCaptchaNewsletter/etc/frontend/di.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2022 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/ReCaptchaReview/etc/frontend/di.xml b/ReCaptchaReview/etc/frontend/di.xml index cc25e6b6..c45d4584 100644 --- a/ReCaptchaReview/etc/frontend/di.xml +++ b/ReCaptchaReview/etc/frontend/di.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2022 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/ReCaptchaSendFriend/etc/frontend/di.xml b/ReCaptchaSendFriend/etc/frontend/di.xml index 1c4c4dbc..15ec5b30 100644 --- a/ReCaptchaSendFriend/etc/frontend/di.xml +++ b/ReCaptchaSendFriend/etc/frontend/di.xml @@ -1,7 +1,7 @@ <?xml version="1.0"?> <!-- /** - * Copyright 2022 Adobe + * Copyright 2020 Adobe * All Rights Reserved. */ --> diff --git a/ReCaptchaWishlist/view/frontend/web/css/source/_module.less b/ReCaptchaWishlist/view/frontend/web/css/source/_module.less index 3c64e884..c80e1934 100644 --- a/ReCaptchaWishlist/view/frontend/web/css/source/_module.less +++ b/ReCaptchaWishlist/view/frontend/web/css/source/_module.less @@ -1,7 +1,8 @@ /** * Copyright 2024 Adobe - * All rights reserved. + * All Rights Reserved. */ + .form.wishlist.share .g-recaptcha { margin-bottom: 40px; } From 0d9355c0f30aa25a9ceb17797ad3d2e21c45bc7e Mon Sep 17 00:00:00 2001 From: Alexandra Zota <zota@adobe.com> Date: Mon, 19 May 2025 15:34:57 +0300 Subject: [PATCH 198/208] ACP2E-3920: fix static errors --- .../view/adminhtml/web/css/source/_module.less | 4 +++- .../web/template/payment-recaptcha-container.html | 4 +--- .../view/frontend/web/template/reCaptcha.html | 4 +--- ReCaptchaContact/Observer/ContactFormObserver.php | 5 ++--- .../Model/AjaxLogin/CaptchaResponseResolver.php | 2 +- ReCaptchaCustomer/Observer/CreateCustomerObserver.php | 5 ++--- ReCaptchaCustomer/Observer/ForgotPasswordObserver.php | 5 ++--- ReCaptchaCustomer/Observer/LoginObserver.php | 5 +++-- .../Account/InjectRecaptchaInAuthenticationPopup.php | 2 ++ .../Test/Api/AccountManagementCaptchaTest.php | 2 -- ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php | 4 +++- .../view/frontend/web/css/source/_module.less | 10 +++++----- .../view/frontend/web/template/reCaptcha.html | 4 +--- .../Patch/Data/MigrateConfigToRecaptchaModules.php | 2 ++ ReCaptchaNewsletter/Observer/NewsletterObserver.php | 5 ++--- ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php | 1 - ReCaptchaReview/Observer/ReviewFormObserver.php | 5 ++--- ReCaptchaReview/Test/Integration/ReviewFormTest.php | 2 +- ReCaptchaSendFriend/Observer/SendFriendObserver.php | 5 ++--- ReCaptchaUi/Block/ReCaptcha.php | 5 +++-- ReCaptchaUi/Model/ValidationConfigResolver.php | 2 +- ReCaptchaUser/Observer/ForgotPasswordObserver.php | 5 ++--- ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml | 3 ++- ReCaptchaUser/view/adminhtml/web/css/recaptcha.less | 4 ++-- .../Api/Data/ValidationConfigInterface.php | 1 + .../view/adminhtml/email/app_config_required.html | 4 +--- .../view/adminhtml/email/user_config_required.html | 4 +--- .../view/adminhtml/web/template/authy/auth.html | 4 +--- .../view/adminhtml/web/template/authy/configure.html | 4 +--- .../web/template/authy/configure/register.html | 4 +--- .../adminhtml/web/template/authy/configure/verify.html | 4 +--- .../view/adminhtml/web/template/change_provider.html | 4 +--- .../adminhtml/web/template/form/element/providers.html | 4 +--- .../web/template/form/element/reset_providers.html | 4 +--- .../view/adminhtml/web/template/google/auth.html | 4 +--- .../view/adminhtml/web/template/google/configure.html | 4 +--- .../view/adminhtml/web/template/u2fkey/auth.html | 4 +--- .../view/adminhtml/web/template/u2fkey/configure.html | 4 +--- 38 files changed, 59 insertions(+), 89 deletions(-) diff --git a/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less b/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less index 1ac8ac9b..ee7e40cc 100644 --- a/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less +++ b/ReCaptchaAdminUi/view/adminhtml/web/css/source/_module.less @@ -2,7 +2,9 @@ * Copyright 2020 Adobe * All Rights Reserved. */ - +/* + * @codingStandardsIgnoreFile + */ .recaptcha_backend_type_for_recaptcha_backend_info_heading_notice, .recaptcha_frontend_type_for_recaptcha_frontend_info_heading_notice { strong { diff --git a/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html b/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html index 9f5884ff..ad367c9c 100644 --- a/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html +++ b/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div> <each args="data: getRegion('place-order-recaptcha'), as: 'recaptcha'" render=""></each> diff --git a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html index adfe3202..c2e4f37f 100644 --- a/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaCheckout/view/frontend/web/template/reCaptcha.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2022 Adobe * All Rights Reserved. */ - -<!-- - --> <!-- ko if: (isCheckoutReCaptchaRequiredFor($parents[1]))--> <div class="recaptcha-checkout-place-order" data-bind="{ diff --git a/ReCaptchaContact/Observer/ContactFormObserver.php b/ReCaptchaContact/Observer/ContactFormObserver.php index 287b1dd0..c83c340d 100644 --- a/ReCaptchaContact/Observer/ContactFormObserver.php +++ b/ReCaptchaContact/Observer/ContactFormObserver.php @@ -16,9 +16,6 @@ use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; -/** - * ContactFormObserver - */ class ContactFormObserver implements ObserverInterface { /** @@ -52,6 +49,8 @@ public function __construct( } /** + * Checking if captcha is enabled for contact form and if so, validate the captcha + * * @param Observer $observer * @return void * @throws LocalizedException diff --git a/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php b/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php index beae9ad7..bc3ba267 100644 --- a/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php +++ b/ReCaptchaCustomer/Model/AjaxLogin/CaptchaResponseResolver.php @@ -33,7 +33,7 @@ public function __construct(SerializerInterface $serializer) } /** - * {@inheritdoc} + * @inheritdoc * * @param RequestInterface|PlainTextRequestInterface $request * @return string diff --git a/ReCaptchaCustomer/Observer/CreateCustomerObserver.php b/ReCaptchaCustomer/Observer/CreateCustomerObserver.php index d5e332b9..7e39997c 100644 --- a/ReCaptchaCustomer/Observer/CreateCustomerObserver.php +++ b/ReCaptchaCustomer/Observer/CreateCustomerObserver.php @@ -15,9 +15,6 @@ use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; -/** - * CreateCustomerObserver - */ class CreateCustomerObserver implements ObserverInterface { /** @@ -51,6 +48,8 @@ public function __construct( } /** + * Checking if captcha is enabled for customer create form and if so, validate the captcha + * * @param Observer $observer * @return void * @throws \Magento\Framework\Exception\LocalizedException diff --git a/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php b/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php index a5a2628d..ac3590d0 100644 --- a/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php +++ b/ReCaptchaCustomer/Observer/ForgotPasswordObserver.php @@ -16,9 +16,6 @@ use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; -/** - * ForgotPasswordObserver - */ class ForgotPasswordObserver implements ObserverInterface { /** @@ -52,6 +49,8 @@ public function __construct( } /** + * Checking if captcha is enabled for customer forgot password form and if so, validate the captcha + * * @param Observer $observer * @return void * @throws LocalizedException diff --git a/ReCaptchaCustomer/Observer/LoginObserver.php b/ReCaptchaCustomer/Observer/LoginObserver.php index 9eec902b..1b3be182 100644 --- a/ReCaptchaCustomer/Observer/LoginObserver.php +++ b/ReCaptchaCustomer/Observer/LoginObserver.php @@ -14,12 +14,11 @@ use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\Session\SessionManagerInterface; use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; /** - * LoginObserver + * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class LoginObserver implements ObserverInterface { @@ -62,6 +61,8 @@ public function __construct( } /** + * Checking if captcha is enabled for customer login form and if so, validate the captcha + * * @param Observer $observer * @return void * @throws LocalizedException diff --git a/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php b/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php index b08cb63e..1109b1e1 100644 --- a/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php +++ b/ReCaptchaCustomer/Plugin/Block/Account/InjectRecaptchaInAuthenticationPopup.php @@ -50,6 +50,8 @@ public function __construct( } /** + * Inject reCAPTCHA in authentication popup layout + * * @param AuthenticationPopup $subject * @param string $result * @return string diff --git a/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php b/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php index 7edae82a..e5635129 100644 --- a/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php +++ b/ReCaptchaCustomer/Test/Api/AccountManagementCaptchaTest.php @@ -14,7 +14,6 @@ use Magento\Framework\Webapi\Rest\Request; use Magento\Integration\Api\CustomerTokenServiceInterface; - /** * Test class for Magento\Customer\Api\AccountManagementInterface * @@ -133,5 +132,4 @@ public function testPasswordReset(): void $this->_webApiCall($serviceInfo, $requestData); } - } diff --git a/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php b/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php index 50233e0d..2f898bdb 100644 --- a/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php +++ b/ReCaptchaFrontendUi/Plugin/ExcludeFromMinification.php @@ -16,9 +16,11 @@ class ExcludeFromMinification { /** + * Exclude external recaptcha from minification + * * @param Minification $subject * @param callable $proceed - * @param $contentType + * @param string $contentType * @return array * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ diff --git a/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less b/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less index 6f07f7db..f88dc49e 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less +++ b/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less @@ -3,12 +3,12 @@ * All Rights Reserved. */ -.required-captcha.checkbox{ - position: absolute; +.required-captcha.checkbox { display: block; - visibility: visible; - overflow: hidden; + height: 1px; + position: absolute; opacity: 0; + overflow: hidden; + visibility: visible; width: 1px; - height: 1px; } diff --git a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html index 019a721c..351302e0 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html +++ b/ReCaptchaFrontendUi/view/frontend/web/template/reCaptcha.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div data-bind="{ diff --git a/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php b/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php index 8203178d..c64736df 100644 --- a/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php +++ b/ReCaptchaMigration/Setup/Patch/Data/MigrateConfigToRecaptchaModules.php @@ -70,6 +70,8 @@ public function apply() $this->copyEnabledRecaptcha($scope); $this->disableLegacyRecaptcha($scope); } + + return $this; } /** diff --git a/ReCaptchaNewsletter/Observer/NewsletterObserver.php b/ReCaptchaNewsletter/Observer/NewsletterObserver.php index 7ba04cc8..c2ddd741 100644 --- a/ReCaptchaNewsletter/Observer/NewsletterObserver.php +++ b/ReCaptchaNewsletter/Observer/NewsletterObserver.php @@ -16,9 +16,6 @@ use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; -/** - * NewsletterObserver - */ class NewsletterObserver implements ObserverInterface { /** @@ -52,6 +49,8 @@ public function __construct( } /** + * Checking if captcha is enabled for newsletter, validate the captcha + * * @param Observer $observer * @return void * @throws LocalizedException diff --git a/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php b/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php index b1f2ac0f..de7c4cc3 100644 --- a/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php +++ b/ReCaptchaPaypal/Test/Api/PayflowCaptchaGlaphQLTest.php @@ -75,5 +75,4 @@ public function testCreatePayflowProToken(): void $this->graphQlMutation($query); } - } diff --git a/ReCaptchaReview/Observer/ReviewFormObserver.php b/ReCaptchaReview/Observer/ReviewFormObserver.php index 88c870b4..c9f0100b 100644 --- a/ReCaptchaReview/Observer/ReviewFormObserver.php +++ b/ReCaptchaReview/Observer/ReviewFormObserver.php @@ -16,9 +16,6 @@ use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; -/** - * ReviewFormObserver - */ class ReviewFormObserver implements ObserverInterface { /** @@ -52,6 +49,8 @@ public function __construct( } /** + * Checking if captcha enabled for product review, validate it + * * @param Observer $observer * @return void * @throws LocalizedException diff --git a/ReCaptchaReview/Test/Integration/ReviewFormTest.php b/ReCaptchaReview/Test/Integration/ReviewFormTest.php index c36c6d74..c97fbe61 100644 --- a/ReCaptchaReview/Test/Integration/ReviewFormTest.php +++ b/ReCaptchaReview/Test/Integration/ReviewFormTest.php @@ -39,7 +39,7 @@ class ReviewFormTest extends AbstractController private $formKey; /** - * @var + * @var ReviewResourceModel */ private $reviewResourceModel; diff --git a/ReCaptchaSendFriend/Observer/SendFriendObserver.php b/ReCaptchaSendFriend/Observer/SendFriendObserver.php index 9397452e..8be500ce 100644 --- a/ReCaptchaSendFriend/Observer/SendFriendObserver.php +++ b/ReCaptchaSendFriend/Observer/SendFriendObserver.php @@ -16,9 +16,6 @@ use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; -/** - * SendFriendObserver - */ class SendFriendObserver implements ObserverInterface { /** @@ -52,6 +49,8 @@ public function __construct( } /** + * Checking if captcha enabled for sendfriend, validate it + * * @param Observer $observer * @return void * @throws LocalizedException diff --git a/ReCaptchaUi/Block/ReCaptcha.php b/ReCaptchaUi/Block/ReCaptcha.php index e998caa2..7c1f2290 100644 --- a/ReCaptchaUi/Block/ReCaptcha.php +++ b/ReCaptchaUi/Block/ReCaptcha.php @@ -63,7 +63,7 @@ public function getRecaptchaId() } /** - * {@inheritdoc} + * @inheritdoc * * @return string * @throws InputException @@ -107,8 +107,9 @@ public function getCaptchaUiConfig(): array return $uiConfig; } - /** + * Generate HTML for reCAPTCHA + * * @return string * @throws InputException */ diff --git a/ReCaptchaUi/Model/ValidationConfigResolver.php b/ReCaptchaUi/Model/ValidationConfigResolver.php index 163fd152..b13335a9 100644 --- a/ReCaptchaUi/Model/ValidationConfigResolver.php +++ b/ReCaptchaUi/Model/ValidationConfigResolver.php @@ -45,7 +45,7 @@ public function __construct( foreach ($validationConfigProviders as $validationConfigProvider) { if (!$validationConfigProvider instanceof ValidationConfigProviderInterface) { throw new InputException( - __('Validation config provider must implement %1.', [ConfigProviderInterface::class]) + __('Validation config provider must implement %1.', [ValidationConfigProviderInterface::class]) ); } } diff --git a/ReCaptchaUser/Observer/ForgotPasswordObserver.php b/ReCaptchaUser/Observer/ForgotPasswordObserver.php index 0c267bb8..99a730eb 100644 --- a/ReCaptchaUser/Observer/ForgotPasswordObserver.php +++ b/ReCaptchaUser/Observer/ForgotPasswordObserver.php @@ -16,9 +16,6 @@ use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\RequestHandlerInterface; -/** - * ForgotPasswordObserver - */ class ForgotPasswordObserver implements ObserverInterface { /** @@ -52,6 +49,8 @@ public function __construct( } /** + * Checking if captcha is enabled for user forgot password form and if so, validate the captcha + * * @param Observer $observer * @return void * @throws LocalizedException diff --git a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml index 9f492881..cae29d35 100644 --- a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml +++ b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml @@ -5,6 +5,7 @@ */ /** @var $block Magento\ReCaptchaUi\Block\ReCaptcha */ +/** @var $escaper \Magento\Framework\Escaper */ $config = $block->getCaptchaUiConfig(); $renderingOptions = $config['rendering'] ?? []; $isInvisible = !empty($config['invisible']); @@ -68,7 +69,7 @@ $isInvisible = !empty($config['invisible']); widgetId = grecaptcha.render('admin-recaptcha', { <?php foreach ($renderingOptions as $key => $value): ?> - '<?= $block->escapeJs($key) ?>': '<?= $block->escapeJs($value) ?>', + '<?= $escaper->escapeJs($key) ?>': '<?= $escaper->escapeJs($value) ?>', <?php endforeach; ?> 'callback': function (_token) { <?php if ($isInvisible): ?> token = _token; diff --git a/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less b/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less index acd06e2f..13ee3f86 100644 --- a/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less +++ b/ReCaptchaUser/view/adminhtml/web/css/recaptcha.less @@ -9,8 +9,8 @@ } .field-invisible-recaptcha { - padding-left: 30px !important; - margin-top: -10px; margin-bottom: 35px; + margin-top: -10px; + padding-left: 30px !important; } } diff --git a/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php b/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php index 192e3ee1..94d37af3 100644 --- a/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php +++ b/ReCaptchaValidationApi/Api/Data/ValidationConfigInterface.php @@ -33,6 +33,7 @@ public function getRemoteIp(): string; * Get validation failure message TODO * * @deprecated use TODO + * @see not used anymore * @return string */ public function getValidationFailureMessage(): string; diff --git a/TwoFactorAuth/view/adminhtml/email/app_config_required.html b/TwoFactorAuth/view/adminhtml/email/app_config_required.html index 0745f72b..1c3a3ffb 100644 --- a/TwoFactorAuth/view/adminhtml/email/app_config_required.html +++ b/TwoFactorAuth/view/adminhtml/email/app_config_required.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <!--@subject {{trans "2FA configuration required for %name" name=$store_name}} @--> <!--@vars { diff --git a/TwoFactorAuth/view/adminhtml/email/user_config_required.html b/TwoFactorAuth/view/adminhtml/email/user_config_required.html index 4531aa24..ffc8d9ad 100644 --- a/TwoFactorAuth/view/adminhtml/email/user_config_required.html +++ b/TwoFactorAuth/view/adminhtml/email/user_config_required.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <!--@subject {{trans "2FA configuration required for %name" name=$username}} @--> <!--@vars { diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html b/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html index ea19cde3..239ba37f 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/auth.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <form autocomplete="off"> <fieldset class="admin__fieldset"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html b/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html index 28131f1c..6c0905a9 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/configure.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html index d63a1944..878f8082 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/register.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div> <form autocomplete="off"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html index 702cb936..a410985b 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html +++ b/TwoFactorAuth/view/adminhtml/web/template/authy/configure/verify.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <form autocomplete="off"> <fieldset class="admin__fieldset"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/change_provider.html b/TwoFactorAuth/view/adminhtml/web/template/change_provider.html index 27a7bd4b..46ce1f61 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/change_provider.html +++ b/TwoFactorAuth/view/adminhtml/web/template/change_provider.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div visible="getProviders().length > 0"> <a visible='!showChangeMethod()' href="#" class="tfa-change-provider-trigger" click="displayChangeMethod"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html b/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html index 8c608726..57de3214 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html +++ b/TwoFactorAuth/view/adminhtml/web/template/form/element/providers.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <!-- ko if: getForcedProviders().length --> <div class="tfa-forced-providers"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html b/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html index f4ee205c..b5976d42 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html +++ b/TwoFactorAuth/view/adminhtml/web/template/form/element/reset_providers.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <!-- ko if: getResetProviders().length --> <div class="tfa-reset-providers"> diff --git a/TwoFactorAuth/view/adminhtml/web/template/google/auth.html b/TwoFactorAuth/view/adminhtml/web/template/google/auth.html index 4b444295..cd9cb6a5 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/google/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/google/auth.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/google/configure.html b/TwoFactorAuth/view/adminhtml/web/template/google/configure.html index 0f01e561..f4f2df0e 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/google/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/google/configure.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html index 047cab03..6c87d5d3 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/auth.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div afterRender="onAfterRender"> <div visible='currentStep() === "register"'> diff --git a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html index 1c0e1537..0a0655cc 100644 --- a/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html +++ b/TwoFactorAuth/view/adminhtml/web/template/u2fkey/configure.html @@ -1,10 +1,8 @@ +<!-- /** * Copyright 2020 Adobe * All Rights Reserved. */ - -<!-- - --> <div afterRender="onAfterRender"> <div visible='currentStep() === "register"'> From 3cd8c7b5c3b3a6d7ac240811537597efcb73f379 Mon Sep 17 00:00:00 2001 From: Alexandra Zota <zota@adobe.com> Date: Mon, 19 May 2025 15:44:29 +0300 Subject: [PATCH 199/208] ACP2E-3920: fix static errors --- .../view/frontend/web/js/model/place-order-mixin.js | 2 +- ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js | 2 +- .../view/frontend/web/js/webapiReCaptchaRegistry-mixin.js | 6 +++--- .../view/frontend/web/js/checkout-sales-rule.js | 5 +++-- ReCaptchaFrontendUi/view/frontend/requirejs-config.js | 2 +- .../view/frontend/web/js/nonInlineReCaptchaRenderer.js | 2 +- ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js | 2 +- .../view/frontend/web/js/reCaptchaScriptLoader.js | 2 +- ReCaptchaFrontendUi/view/frontend/web/js/registry.js | 2 +- .../view/frontend/web/js/ui-messages-mixin.js | 2 +- .../view/frontend/web/js/payflowpro-method-mixin.js | 2 +- ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js | 2 +- .../view/frontend/web/js/reCaptchaStorePickup.js | 2 +- 13 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js index 7ea7751f..32b558a0 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/model/place-order-mixin.js @@ -10,7 +10,7 @@ define([ 'mage/utils/wrapper', 'Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry' ], function ($, wrapper, recaptchaRegistry) { - 'use strict'; + 'use strict'; // eslint-disable-line return function (placeOrder) { return wrapper.wrap(placeOrder, function (originalAction, serviceUrl, payload, messageContainer) { diff --git a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js index 9d60f3f8..60740c3b 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js +++ b/ReCaptchaCheckout/view/frontend/web/js/reCaptchaCheckout.js @@ -9,7 +9,7 @@ define( 'jquery' ], function (Component, $) { - 'use strict'; + 'use strict'; // eslint-disable-line var reCaptchaIds = new WeakMap(), uuid = 0; diff --git a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js index 315ba718..9a3723dc 100644 --- a/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js +++ b/ReCaptchaCheckout/view/frontend/web/js/webapiReCaptchaRegistry-mixin.js @@ -4,15 +4,15 @@ */ define([], function () { - 'use strict'; + 'use strict'; // eslint-disable-line return function (originalFunction) { /** * {@inheritDoc} */ - originalFunction.addListener = function (id , func) { + originalFunction.addListener = function (id , func) { this._listeners[id] = func; - }; + }; return originalFunction; }; diff --git a/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js index 1d12f2b2..b6a5ead3 100644 --- a/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js +++ b/ReCaptchaCheckoutSalesRule/view/frontend/web/js/checkout-sales-rule.js @@ -14,7 +14,7 @@ define( 'Magento_Checkout/js/model/quote', 'ko' ], function (Component, recaptchaRegistry, $, setCouponCodeAction, cancelCouponAction, quote, ko) { - 'use strict'; + 'use strict'; // eslint-disable-line var totals = quote.getTotals(), couponCode = ko.observable(null), @@ -87,4 +87,5 @@ define( }); } }); - }); + } +); diff --git a/ReCaptchaFrontendUi/view/frontend/requirejs-config.js b/ReCaptchaFrontendUi/view/frontend/requirejs-config.js index b62d9b69..169bc785 100644 --- a/ReCaptchaFrontendUi/view/frontend/requirejs-config.js +++ b/ReCaptchaFrontendUi/view/frontend/requirejs-config.js @@ -5,7 +5,7 @@ /*eslint strict: ["error", "global"]*/ -'use strict'; +'use strict'; // eslint-disable-line var config = { config: { diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js b/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js index ccec8338..c201e197 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/nonInlineReCaptchaRenderer.js @@ -8,7 +8,7 @@ define([ 'jquery', 'jquery/z-index' ], function ($) { - 'use strict'; + 'use strict'; // eslint-disable-line var reCaptchaEntities = [], initialized = false, diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index 995de4ea..cfce885b 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -14,7 +14,7 @@ define( 'Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader', 'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer' ], function (Component, $, ko, _, registry, reCaptchaLoader, nonInlineReCaptchaRenderer) { - 'use strict'; + 'use strict'; // eslint-disable-line return Component.extend({ diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js index a241974c..43ff3087 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptchaScriptLoader.js @@ -4,7 +4,7 @@ */ define([], function () { - 'use strict'; + 'use strict'; // eslint-disable-line var scriptTagAdded = false; diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/registry.js b/ReCaptchaFrontendUi/view/frontend/web/js/registry.js index e5909097..1da0c183 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/registry.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/registry.js @@ -4,7 +4,7 @@ */ define(['ko'], function (ko) { - 'use strict'; + 'use strict'; // eslint-disable-line return { ids: ko.observableArray([]), diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js b/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js index 5e67ffdf..e142ee70 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/ui-messages-mixin.js @@ -4,7 +4,7 @@ */ define(['Magento_ReCaptchaFrontendUi/js/registry'], function (registry) { - 'use strict'; + 'use strict'; // eslint-disable-line return function (originalComponent) { return originalComponent.extend({ diff --git a/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js b/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js index 2f498b80..486a9497 100644 --- a/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js +++ b/ReCaptchaPaypal/view/frontend/web/js/payflowpro-method-mixin.js @@ -7,7 +7,7 @@ define([ 'jquery', 'Magento_Checkout/js/model/payment/additional-validators' ], function ($, additionalValidators) { - 'use strict'; + 'use strict'; // eslint-disable-line return function (originalComponent) { return originalComponent.extend({ diff --git a/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js b/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js index daa240fd..7c08aaa0 100644 --- a/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js +++ b/ReCaptchaPaypal/view/frontend/web/js/reCaptchaPaypal.js @@ -9,7 +9,7 @@ define( 'jquery' ], function (Component, $) { - 'use strict'; + 'use strict'; // eslint-disable-line return Component.extend({ diff --git a/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js b/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js index bced9f85..bc42bd5a 100644 --- a/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js +++ b/ReCaptchaStorePickup/view/frontend/web/js/reCaptchaStorePickup.js @@ -4,7 +4,7 @@ */ define(['Magento_ReCaptchaFrontendUi/js/reCaptcha'], function (reCaptcha) { - 'use strict'; + 'use strict'; // eslint-disable-line return reCaptcha.extend({ From 10fb3bab518c06a121e57e2f3e1037e96fa834d6 Mon Sep 17 00:00:00 2001 From: Alexandra Zota <zota@adobe.com> Date: Mon, 19 May 2025 17:27:35 +0300 Subject: [PATCH 200/208] ACP2E-3920: fix static errors --- .../view/frontend/web/template/payment-recaptcha-container.html | 2 +- ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html b/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html index ad367c9c..711c5080 100644 --- a/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html +++ b/ReCaptchaCheckout/view/frontend/web/template/payment-recaptcha-container.html @@ -7,4 +7,4 @@ <div> <each args="data: getRegion('place-order-recaptcha'), as: 'recaptcha'" render=""></each> </div> -<hr /> +<hr></hr> diff --git a/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less b/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less index f88dc49e..29a5085d 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less +++ b/ReCaptchaFrontendUi/view/frontend/web/css/source/_module.less @@ -6,9 +6,9 @@ .required-captcha.checkbox { display: block; height: 1px; - position: absolute; opacity: 0; overflow: hidden; + position: absolute; visibility: visible; width: 1px; } From 084047e9c83ec2580fab6c01c5508e2e4ba3374d Mon Sep 17 00:00:00 2001 From: Dima Shevtsov <shevtsov@adobe.com> Date: Fri, 23 May 2025 21:22:59 -0500 Subject: [PATCH 201/208] Fix module READMEs --- ReCaptchaAdminUi/README.md | 6 ++--- ReCaptchaCheckout/README.md | 6 ++--- ReCaptchaCheckoutSalesRule/README.md | 7 +++--- ReCaptchaContact/README.md | 6 ++--- ReCaptchaCustomer/README.md | 6 ++--- ReCaptchaFrontendUi/README.md | 6 ++--- ReCaptchaMigration/README.md | 4 ++-- ReCaptchaNewsletter/README.md | 6 ++--- ReCaptchaPaypal/README.md | 6 ++--- ReCaptchaResendConfirmationEmail/README.md | 6 ++--- ReCaptchaReview/README.md | 6 ++--- ReCaptchaSendFriend/README.md | 6 ++--- ReCaptchaStorePickup/README.md | 6 ++--- ReCaptchaUi/README.md | 6 ++--- ReCaptchaUser/README.md | 26 +++++++++++--------- ReCaptchaValidation/README.md | 6 ++--- ReCaptchaValidationApi/README.md | 6 ++--- ReCaptchaVersion2Checkbox/README.md | 6 ++--- ReCaptchaVersion2Invisible/README.md | 6 ++--- ReCaptchaVersion3Invisible/README.md | 6 ++--- ReCaptchaWebapiApi/README.md | 6 ++--- ReCaptchaWebapiGraphQl/README.md | 6 ++--- ReCaptchaWebapiRest/README.md | 6 ++--- ReCaptchaWebapiUi/README.md | 6 ++--- ReCaptchaWishlist/README.md | 8 ++++++- Securitytxt/README.md | 28 ++++++++++++---------- TwoFactorAuth/README.md | 2 +- 27 files changed, 107 insertions(+), 94 deletions(-) diff --git a/ReCaptchaAdminUi/README.md b/ReCaptchaAdminUi/README.md index 4ac86160..dde4c74f 100644 --- a/ReCaptchaAdminUi/README.md +++ b/ReCaptchaAdminUi/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaAdminUi module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA UI files related to views in the admin panel. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaCheckout/README.md b/ReCaptchaCheckout/README.md index 50e9cf12..af9c06be 100644 --- a/ReCaptchaCheckout/README.md +++ b/ReCaptchaCheckout/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaCheckout module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to checkout. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaCheckoutSalesRule/README.md b/ReCaptchaCheckoutSalesRule/README.md index 469f5ec6..450653a1 100644 --- a/ReCaptchaCheckoutSalesRule/README.md +++ b/ReCaptchaCheckoutSalesRule/README.md @@ -1,6 +1,7 @@ -Magento reCAPTCHA -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +# Magento_ReCaptchaCheckoutSalesRule module + +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to coupon code apply action on checkout cart & payment. -For more information please visit the Magento document for reCAPTCHA. +For more information, see the Magento document for reCAPTCHA. diff --git a/ReCaptchaContact/README.md b/ReCaptchaContact/README.md index 3d7c29df..a8699b09 100644 --- a/ReCaptchaContact/README.md +++ b/ReCaptchaContact/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaContact module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to the contact page. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaCustomer/README.md b/ReCaptchaCustomer/README.md index ac8b823e..5a70b2a6 100644 --- a/ReCaptchaCustomer/README.md +++ b/ReCaptchaCustomer/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaCustomer module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to customer actions. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaFrontendUi/README.md b/ReCaptchaFrontendUi/README.md index 0cc95680..8e514b0b 100644 --- a/ReCaptchaFrontendUi/README.md +++ b/ReCaptchaFrontendUi/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaFrontendUi module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the UI related to customer-facing reCAPTCHA views. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaMigration/README.md b/ReCaptchaMigration/README.md index 1b7eb14d..371dcf61 100644 --- a/ReCaptchaMigration/README.md +++ b/ReCaptchaMigration/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaMigration module Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module helps migrate data from the old reCAPTCHA implementation to the new one. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaNewsletter/README.md b/ReCaptchaNewsletter/README.md index a468a8fc..06bd17f7 100644 --- a/ReCaptchaNewsletter/README.md +++ b/ReCaptchaNewsletter/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaNewsletter module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to newsletter subscriptions. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaPaypal/README.md b/ReCaptchaPaypal/README.md index 8193b708..61065443 100644 --- a/ReCaptchaPaypal/README.md +++ b/ReCaptchaPaypal/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaPaypal module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to PayPal payments. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaResendConfirmationEmail/README.md b/ReCaptchaResendConfirmationEmail/README.md index c07b1646..0b438d6c 100644 --- a/ReCaptchaResendConfirmationEmail/README.md +++ b/ReCaptchaResendConfirmationEmail/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaResendConfirmationEmail module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to resend confirmation email action. -For more information please visit the [Magento document for reCAPTCHA](https://docs.magento.com/user-guide/stores/security-google-recaptcha.html). +For more information, see the [document for reCAPTCHA]((https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha)). diff --git a/ReCaptchaReview/README.md b/ReCaptchaReview/README.md index cd06808e..3caa8f28 100644 --- a/ReCaptchaReview/README.md +++ b/ReCaptchaReview/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaReview module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to product reviews. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaSendFriend/README.md b/ReCaptchaSendFriend/README.md index b37ba418..2192e904 100644 --- a/ReCaptchaSendFriend/README.md +++ b/ReCaptchaSendFriend/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaSendFriend module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to store send to friend actions. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaStorePickup/README.md b/ReCaptchaStorePickup/README.md index 0eb382f6..8536634e 100644 --- a/ReCaptchaStorePickup/README.md +++ b/ReCaptchaStorePickup/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaStorePickup module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to store pickup actions. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaUi/README.md b/ReCaptchaUi/README.md index 7e5fbac4..43fbac81 100644 --- a/ReCaptchaUi/README.md +++ b/ReCaptchaUi/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaUi module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module contains the base UI related to all reCAPTCHA features. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaUser/README.md b/ReCaptchaUser/README.md index 5872c22d..e73178b0 100644 --- a/ReCaptchaUser/README.md +++ b/ReCaptchaUser/README.md @@ -1,23 +1,27 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaUser module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementations related to user actions. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). -## Emergency commandline disable for Admin panel Login page: +## Emergency commandline disable for Admin panel Login page -Can disable Google reCAPTCHA for Admin Panel Login page from command-line: +To disable Google reCAPTCHA for Admin Panel Login page from command-line: -`php bin/magento security:recaptcha:disable-for-user-login` +```bash +php bin/magento security:recaptcha:disable-for-user-login +``` -This will disable Google reCAPTCHA for Admin Panel Login page form. +This disables Google reCAPTCHA for Admin Panel Login page form. -## Emergency commandline disable for Admin panel Reset Password page: +## Emergency commandline disable for Admin panel Reset Password page -Can disable Google reCAPTCHA for Admin panel Reset Password page from command-line: +To disable Google reCAPTCHA for Admin panel Reset Password page from command-line: -`php bin/magento security:recaptcha:disable-for-user-forgot-password` +```bash +php bin/magento security:recaptcha:disable-for-user-forgot-password +``` -This will disable Google reCAPTCHA for Admin panel Reset Password page form. +This disables Google reCAPTCHA for Admin panel Reset Password page form. diff --git a/ReCaptchaValidation/README.md b/ReCaptchaValidation/README.md index 5e733e7e..5cdd4095 100644 --- a/ReCaptchaValidation/README.md +++ b/ReCaptchaValidation/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaValidation module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the base implementation for reCAPTCHA. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaValidationApi/README.md b/ReCaptchaValidationApi/README.md index 96c4ecfc..55fbfe35 100644 --- a/ReCaptchaValidationApi/README.md +++ b/ReCaptchaValidationApi/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaValidationApi module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the service contracts for the base reCAPTCHA implementation. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaVersion2Checkbox/README.md b/ReCaptchaVersion2Checkbox/README.md index 9c34cefa..63aa5d5a 100644 --- a/ReCaptchaVersion2Checkbox/README.md +++ b/ReCaptchaVersion2Checkbox/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaVersion2Checkbox module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementation for the V2 Checkbox variation. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaVersion2Invisible/README.md b/ReCaptchaVersion2Invisible/README.md index b0b1a769..5ba66a6a 100644 --- a/ReCaptchaVersion2Invisible/README.md +++ b/ReCaptchaVersion2Invisible/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaVersion2Invisible module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementation for the V2 Invisible variation. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaVersion3Invisible/README.md b/ReCaptchaVersion3Invisible/README.md index b9e29e54..dc429f38 100644 --- a/ReCaptchaVersion3Invisible/README.md +++ b/ReCaptchaVersion3Invisible/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaVersion3Invisible module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the reCAPTCHA implementation for the V3 Invisible variation. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiApi/README.md b/ReCaptchaWebapiApi/README.md index 00796604..526047f8 100644 --- a/ReCaptchaWebapiApi/README.md +++ b/ReCaptchaWebapiApi/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaWebapiApi module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the service contracts related to the base reCAPTCHA implementation. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiGraphQl/README.md b/ReCaptchaWebapiGraphQl/README.md index 317ab6d7..0ec9a66b 100644 --- a/ReCaptchaWebapiGraphQl/README.md +++ b/ReCaptchaWebapiGraphQl/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaWebapiGraphQl module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the GraphQl implementation of reCAPTCHA. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiRest/README.md b/ReCaptchaWebapiRest/README.md index de2986ae..d3454253 100644 --- a/ReCaptchaWebapiRest/README.md +++ b/ReCaptchaWebapiRest/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaWebapiRest module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the WebAPI REST implementation of reCAPTCHA. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWebapiUi/README.md b/ReCaptchaWebapiUi/README.md index e128292b..6c4b20d0 100644 --- a/ReCaptchaWebapiUi/README.md +++ b/ReCaptchaWebapiUi/README.md @@ -1,7 +1,7 @@ -# Magento reCAPTCHA +# Magento_ReCaptchaWebapiUi module -Google reCAPTCHA ensures that a human being, rather than a computer (or “bot”), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. This module provides the UI files related to the WebAPI implementation of reCAPTCHA. -For more information please visit the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/ReCaptchaWishlist/README.md b/ReCaptchaWishlist/README.md index 2eb34c63..6c36ee1d 100644 --- a/ReCaptchaWishlist/README.md +++ b/ReCaptchaWishlist/README.md @@ -1 +1,7 @@ -Please refer to: https://github.com/magento/security-package \ No newline at end of file +# Magento_ReCaptchaWishlist module + +Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), is interacting with your website. Unlike the standard Magento CAPTCHA, Google reCAPTCHA provides enhanced security with a selection of different display options and methods. Additional website traffic information is available in the dashboard of your Google reCAPTCHA account. + +This module provides the reCAPTCHA implementations related to wishlist. + +For more information, see the [reCAPTCHA documentation](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). diff --git a/Securitytxt/README.md b/Securitytxt/README.md index 9564eaf1..ab77ca8d 100644 --- a/Securitytxt/README.md +++ b/Securitytxt/README.md @@ -1,18 +1,16 @@ -# Security.txt +# Magento_Securitytxt module -### Summary -> -> When security vulnerabilities are discovered by researchers, proper reporting channels are often lacking. As a result, vulnerabilities may be left unreported. This document defines a format ("security.txt") to help organizations describe their vulnerability disclosure practices to make it easier for researchers to report vulnerabilities. +> When security vulnerabilities are discovered by researchers, proper reporting channels are often lacking. As a result, vulnerabilities may be left unreported. This document defines a format ("security.txt") to help organizations describe their vulnerability disclosure practices to make it easier for researchers to report vulnerabilities. -Source: https://tools.ietf.org/html/draft-foudil-securitytxt-09 +_Source: <https://datatracker.ietf.org/doc/html/draft-foudil-securitytxt-09>_ The Magento_Securitytxt module provides the following functionality: * allows to save the security configurations in the admin panel -* contains a router to match application action class for requests to the `.well-known/security.txt` and `.well-known/security.txt.sig` files. -* serves the content of the `.well-known/security.txt` and `.well-known/security.txt.sig` files. +* contains a router to match application action class for requests to the `.well-known/security.txt` and `.well-known/security.txt.sig` files +* serves the content of the `.well-known/security.txt` and `.well-known/security.txt.sig` files -A valid security.txt file could look like the following example: +A valid _security.txt_ file could look like the following example: ```txt Contact: mailto:security@example.com @@ -23,13 +21,17 @@ Policy: https://example.com/security-policy.html Signature: https://example.com/.well-known/security.txt.sig ``` -Security.txt can be accessed at below location: +_Security.txt_ can be accessed at the location of the following format: `https://example.com/.well-known/security.txt` -To create security.txt signature (security.txt.sig) file: +To create _security.txt_ signature (_security.txt.sig_) file, run the following command: -`gpg -u KEYID --output security.txt.sig --armor --detach-sig security.txt` +```bash +gpg -u KEYID --output security.txt.sig --armor --detach-sig security.txt +``` -To verify the security.txt file's signature: +To verify the _security.txt_ file's signature, run the following command: -`gpg --verify security.txt.sig security.txt` +```bash +gpg --verify security.txt.sig security.txt +``` diff --git a/TwoFactorAuth/README.md b/TwoFactorAuth/README.md index 9b0544ab..73629a91 100644 --- a/TwoFactorAuth/README.md +++ b/TwoFactorAuth/README.md @@ -1,4 +1,4 @@ -# Magento Two Factor Authentication +# Magento_TwoFactorAuth module The Magento Admin provides all access to your store, orders, and customer data. To prevent unauthorized access to your data, all users who attempt to sign in to the Admin of your Magento installation must complete a second step to verify their identity. From b12b21ea6cf382960a4a9231e89f543895afa961 Mon Sep 17 00:00:00 2001 From: Dima Shevtsov <shevtsov@adobe.com> Date: Tue, 8 Jul 2025 13:22:14 -0500 Subject: [PATCH 202/208] Fix the link --- ReCaptchaResendConfirmationEmail/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReCaptchaResendConfirmationEmail/README.md b/ReCaptchaResendConfirmationEmail/README.md index 0b438d6c..0b06d107 100644 --- a/ReCaptchaResendConfirmationEmail/README.md +++ b/ReCaptchaResendConfirmationEmail/README.md @@ -4,4 +4,4 @@ Google reCAPTCHA ensures that a human being, rather than a computer (or "bot"), This module provides the reCAPTCHA implementations related to resend confirmation email action. -For more information, see the [document for reCAPTCHA]((https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha)). +For more information, see the [document for reCAPTCHA](https://experienceleague.adobe.com/en/docs/commerce-admin/systems/security/captcha/security-google-recaptcha). From 8b574cc5357edcb46e7bb149ed17165faa079473 Mon Sep 17 00:00:00 2001 From: Sumesh P <sumesh.p@globallogic.com> Date: Tue, 15 Jul 2025 15:07:24 +0530 Subject: [PATCH 203/208] AC-3179: "Can not resolve reCAPTCHA parameter" entries in exception.log for Google reCAPTCHA Admin Panel Update exception logging to handle it gracefully --- ReCaptchaUi/Model/RequestHandler.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReCaptchaUi/Model/RequestHandler.php b/ReCaptchaUi/Model/RequestHandler.php index e1b35196..a953b0ea 100644 --- a/ReCaptchaUi/Model/RequestHandler.php +++ b/ReCaptchaUi/Model/RequestHandler.php @@ -112,8 +112,8 @@ public function execute( try { $reCaptchaResponse = $this->captchaResponseResolver->resolve($request); } catch (InputException $e) { - $this->logger->error($e); - $this->processError($response, [], $redirectOnFailureUrl, $key); + $errorMessages['missing-input-response'] = $e->getMessage(); + $this->processError($response, $errorMessages, $redirectOnFailureUrl, $key); return; } From 32715135d8c5ce8a9f48806e9b31144b7d31bff0 Mon Sep 17 00:00:00 2001 From: Sumesh P <sumesh.p@globallogic.com> Date: Thu, 17 Jul 2025 15:14:27 +0530 Subject: [PATCH 204/208] AC-3179: "Can not resolve reCAPTCHA parameter" entries in exception.log for Google reCAPTCHA Admin Panel Unit test coverage for Model/RequestHandler.php --- .../Test/Unit/Model/RequestHandlerTest.php | 387 ++++++++++++++++++ 1 file changed, 387 insertions(+) create mode 100644 ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php diff --git a/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php b/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php new file mode 100644 index 00000000..6e530b40 --- /dev/null +++ b/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php @@ -0,0 +1,387 @@ +<?php +/** + * Copyright 2025 Adobe + * All Rights Reserved. + */ + +declare(strict_types=1); + +namespace Magento\ReCaptchaUi\Test\Unit\Model; + +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\ActionFlag; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface; +use Magento\Framework\Exception\InputException; +use Magento\Framework\Message\ManagerInterface as MessageManagerInterface; +use Magento\ReCaptchaUi\Model\CaptchaResponseResolverInterface; +use Magento\ReCaptchaUi\Model\ErrorMessageConfigInterface; +use Magento\ReCaptchaUi\Model\RequestHandler; +use Magento\ReCaptchaUi\Model\ValidationConfigResolverInterface; +use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface as ApiValidationConfigInterface; +use Magento\Framework\Validation\ValidationResult; +use Magento\ReCaptchaValidationApi\Api\ValidatorInterface; +use Magento\ReCaptchaValidationApi\Model\ValidationErrorMessagesProvider; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; + +class RequestHandlerTest extends TestCase +{ + /** + * @var CaptchaResponseResolverInterface|MockObject + */ + private $captchaResponseResolverMock; + + /** + * @var ValidationConfigResolverInterface|MockObject + */ + private $validationConfigResolverMock; + + /** + * @var ValidatorInterface|MockObject + */ + private $captchaValidatorMock; + + /** + * @var MessageManagerInterface|MockObject + */ + private $messageManagerMock; + + /** + * @var ActionFlag|MockObject + */ + private $actionFlagMock; + + /** + * @var LoggerInterface|MockObject + */ + private $loggerMock; + + /** + * @var ErrorMessageConfigInterface|MockObject + */ + private $errorMessageConfigMock; + + /** + * @var ValidationErrorMessagesProvider|MockObject + */ + private $validationErrorMessagesProviderMock; + + /** + * @var RequestInterface|MockObject + */ + private $requestMock; + + /** + * @var HttpResponseInterface|MockObject + */ + private $responseMock; + + /** + * @var ApiValidationConfigInterface|MockObject + */ + private $validationConfigMock; + + /** + * @var ValidationResult|MockObject + */ + private $validationResultMock; + + /** + * @var RequestHandler + */ + private $requestHandler; + + protected function setUp(): void + { + $this->captchaResponseResolverMock = $this->createMock(CaptchaResponseResolverInterface::class); + $this->validationConfigResolverMock = $this->createMock(ValidationConfigResolverInterface::class); + $this->captchaValidatorMock = $this->createMock(ValidatorInterface::class); + $this->messageManagerMock = $this->createMock(MessageManagerInterface::class); + $this->actionFlagMock = $this->createMock(ActionFlag::class); + $this->loggerMock = $this->createMock(LoggerInterface::class); + $this->errorMessageConfigMock = $this->createMock(ErrorMessageConfigInterface::class); + $this->validationErrorMessagesProviderMock = $this->createMock(ValidationErrorMessagesProvider::class); + $this->requestMock = $this->createMock(RequestInterface::class); + $this->responseMock = $this->createMock(HttpResponseInterface::class); + $this->validationConfigMock = $this->createMock(ApiValidationConfigInterface::class); + $this->validationResultMock = $this->createMock(ValidationResult::class); + + $this->requestHandler = new RequestHandler( + $this->captchaResponseResolverMock, + $this->validationConfigResolverMock, + $this->captchaValidatorMock, + $this->messageManagerMock, + $this->actionFlagMock, + $this->loggerMock, + $this->errorMessageConfigMock, + $this->validationErrorMessagesProviderMock + ); + } + + /** + * Test successful reCAPTCHA validation + */ + public function testExecuteWithValidCaptchaResponse() + { + $key = 'customer_login'; + $redirectOnFailureUrl = '/customer/account/login'; + $reCaptchaResponse = 'valid-captcha-response'; + + $this->validationConfigResolverMock->expects($this->once()) + ->method('get') + ->with($key) + ->willReturn($this->validationConfigMock); + + $this->captchaResponseResolverMock->expects($this->once()) + ->method('resolve') + ->with($this->requestMock) + ->willReturn($reCaptchaResponse); + + $this->validationResultMock->expects($this->once()) + ->method('isValid') + ->willReturn(true); + + $this->captchaValidatorMock->expects($this->once()) + ->method('isValid') + ->with($reCaptchaResponse, $this->validationConfigMock) + ->willReturn($this->validationResultMock); + + // These should not be called for successful validation + $this->messageManagerMock->expects($this->never())->method('addErrorMessage'); + $this->actionFlagMock->expects($this->never())->method('set'); + $this->responseMock->expects($this->never())->method('setRedirect'); + + $this->requestHandler->execute($key, $this->requestMock, $this->responseMock, $redirectOnFailureUrl); + } + + /** + * Test reCAPTCHA validation failure + */ + public function testExecuteWithInvalidCaptchaResponse() + { + $key = 'customer_login'; + $redirectOnFailureUrl = '/customer/account/login'; + $reCaptchaResponse = 'invalid-captcha-response'; + $errorMessages = ['invalid-input-response' => 'Invalid reCAPTCHA response']; + $validationErrorText = 'reCAPTCHA validation failed'; + + $this->validationConfigResolverMock->expects($this->once()) + ->method('get') + ->with($key) + ->willReturn($this->validationConfigMock); + + $this->captchaResponseResolverMock->expects($this->once()) + ->method('resolve') + ->with($this->requestMock) + ->willReturn($reCaptchaResponse); + + $this->validationResultMock->expects($this->once()) + ->method('isValid') + ->willReturn(false); + + $this->validationResultMock->expects($this->once()) + ->method('getErrors') + ->willReturn($errorMessages); + + $this->captchaValidatorMock->expects($this->once()) + ->method('isValid') + ->with($reCaptchaResponse, $this->validationConfigMock) + ->willReturn($this->validationResultMock); + + $this->errorMessageConfigMock->expects($this->once()) + ->method('getValidationFailureMessage') + ->willReturn($validationErrorText); + + $this->validationErrorMessagesProviderMock->expects($this->once()) + ->method('getErrorMessage') + ->with('invalid-input-response') + ->willReturn('Invalid reCAPTCHA response'); + + $this->messageManagerMock->expects($this->once()) + ->method('addErrorMessage') + ->with($validationErrorText); + + $this->actionFlagMock->expects($this->once()) + ->method('set') + ->with('', Action::FLAG_NO_DISPATCH, true); + + $this->responseMock->expects($this->once()) + ->method('setRedirect') + ->with($redirectOnFailureUrl); + + $this->requestHandler->execute($key, $this->requestMock, $this->responseMock, $redirectOnFailureUrl); + } + + /** + * Test InputException handling - this covers the specific change made + */ + public function testExecuteWithInputException() + { + $key = 'customer_login'; + $redirectOnFailureUrl = '/customer/account/login'; + $errorMessage = 'Missing reCAPTCHA response'; + $validationErrorText = 'reCAPTCHA validation failed'; + + $inputException = new InputException(__($errorMessage)); + + $this->validationConfigResolverMock->expects($this->once()) + ->method('get') + ->with($key) + ->willReturn($this->validationConfigMock); + + $this->captchaResponseResolverMock->expects($this->once()) + ->method('resolve') + ->with($this->requestMock) + ->willThrowException($inputException); + + // The validator should not be called when InputException is thrown + $this->captchaValidatorMock->expects($this->never())->method('isValid'); + + $this->errorMessageConfigMock->expects($this->once()) + ->method('getValidationFailureMessage') + ->willReturn($validationErrorText); + + $this->validationErrorMessagesProviderMock->expects($this->once()) + ->method('getErrorMessage') + ->with('missing-input-response') + ->willReturn('Missing reCAPTCHA response'); + + $this->messageManagerMock->expects($this->once()) + ->method('addErrorMessage') + ->with($validationErrorText); + + $this->actionFlagMock->expects($this->once()) + ->method('set') + ->with('', Action::FLAG_NO_DISPATCH, true); + + $this->responseMock->expects($this->once()) + ->method('setRedirect') + ->with($redirectOnFailureUrl); + + $this->requestHandler->execute($key, $this->requestMock, $this->responseMock, $redirectOnFailureUrl); + } + + /** + * Test technical error handling + */ + public function testExecuteWithTechnicalError() + { + $key = 'customer_login'; + $redirectOnFailureUrl = '/customer/account/login'; + $reCaptchaResponse = 'captcha-response'; + $errorMessages = ['unknown-error' => 'Unknown technical error']; + $technicalErrorText = 'Technical error occurred'; + + $this->validationConfigResolverMock->expects($this->once()) + ->method('get') + ->with($key) + ->willReturn($this->validationConfigMock); + + $this->captchaResponseResolverMock->expects($this->once()) + ->method('resolve') + ->with($this->requestMock) + ->willReturn($reCaptchaResponse); + + $this->validationResultMock->expects($this->once()) + ->method('isValid') + ->willReturn(false); + + $this->validationResultMock->expects($this->once()) + ->method('getErrors') + ->willReturn($errorMessages); + + $this->captchaValidatorMock->expects($this->once()) + ->method('isValid') + ->with($reCaptchaResponse, $this->validationConfigMock) + ->willReturn($this->validationResultMock); + + $this->errorMessageConfigMock->expects($this->once()) + ->method('getTechnicalFailureMessage') + ->willReturn($technicalErrorText); + + $this->validationErrorMessagesProviderMock->expects($this->once()) + ->method('getErrorMessage') + ->with('unknown-error') + ->willReturn('unknown-error'); + + $this->loggerMock->expects($this->once()) + ->method('error') + ->with($this->callback(function ($phrase) { + // The logger receives a Magento\Framework\Phrase object + return (string)$phrase === (string)__( + "reCAPTCHA '%1' form error: %2", + 'customer_login', + 'Unknown technical error' + ); + })); + + $this->messageManagerMock->expects($this->once()) + ->method('addErrorMessage') + ->with($technicalErrorText); + + $this->actionFlagMock->expects($this->once()) + ->method('set') + ->with('', Action::FLAG_NO_DISPATCH, true); + + $this->responseMock->expects($this->once()) + ->method('setRedirect') + ->with($redirectOnFailureUrl); + + $this->requestHandler->execute($key, $this->requestMock, $this->responseMock, $redirectOnFailureUrl); + } + + /** + * Test empty error messages handling + */ + public function testExecuteWithEmptyErrorMessages() + { + $key = 'customer_login'; + $redirectOnFailureUrl = '/customer/account/login'; + $reCaptchaResponse = 'captcha-response'; + $errorMessages = []; + $technicalErrorText = 'Technical error occurred'; + + $this->validationConfigResolverMock->expects($this->once()) + ->method('get') + ->with($key) + ->willReturn($this->validationConfigMock); + + $this->captchaResponseResolverMock->expects($this->once()) + ->method('resolve') + ->with($this->requestMock) + ->willReturn($reCaptchaResponse); + + $this->validationResultMock->expects($this->once()) + ->method('isValid') + ->willReturn(false); + + $this->validationResultMock->expects($this->once()) + ->method('getErrors') + ->willReturn($errorMessages); + + $this->captchaValidatorMock->expects($this->once()) + ->method('isValid') + ->with($reCaptchaResponse, $this->validationConfigMock) + ->willReturn($this->validationResultMock); + + $this->errorMessageConfigMock->expects($this->once()) + ->method('getTechnicalFailureMessage') + ->willReturn($technicalErrorText); + + $this->messageManagerMock->expects($this->once()) + ->method('addErrorMessage') + ->with($technicalErrorText); + + $this->actionFlagMock->expects($this->once()) + ->method('set') + ->with('', Action::FLAG_NO_DISPATCH, true); + + $this->responseMock->expects($this->once()) + ->method('setRedirect') + ->with($redirectOnFailureUrl); + + $this->requestHandler->execute($key, $this->requestMock, $this->responseMock, $redirectOnFailureUrl); + } +} From b0a1f308b86fa2685233cf04151f99ae424a8926 Mon Sep 17 00:00:00 2001 From: Sumesh P <sumesh.p@globallogic.com> Date: Thu, 17 Jul 2025 21:04:33 +0530 Subject: [PATCH 205/208] AC-3179: "Can not resolve reCAPTCHA parameter" entries in exception.log for Google reCAPTCHA Admin Panel Fix cyclometric complexity --- ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php b/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php index 6e530b40..674bb501 100644 --- a/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php +++ b/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php @@ -26,6 +26,11 @@ use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +/** + * Request Handler Test + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + */ class RequestHandlerTest extends TestCase { /** From 17c19655a6377397a9b5d9c0e5999829d777900a Mon Sep 17 00:00:00 2001 From: Sumesh P <sumesh.p@globallogic.com> Date: Fri, 18 Jul 2025 10:27:51 +0530 Subject: [PATCH 206/208] AC-3179: "Can not resolve reCAPTCHA parameter" entries in exception.log for Google reCAPTCHA Admin Panel Added a meaningful title and description to the PHP doc comment --- ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php b/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php index 674bb501..e848392e 100644 --- a/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php +++ b/ReCaptchaUi/Test/Unit/Model/RequestHandlerTest.php @@ -27,7 +27,10 @@ use Psr\Log\LoggerInterface; /** - * Request Handler Test + * Unit test for RequestHandler class + * + * Tests the reCAPTCHA request handling functionality including validation, + * error handling, and response processing for various scenarios. * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ From a34aaa3accb75c1a87d784e0946e67a1f683dc3e Mon Sep 17 00:00:00 2001 From: Shantanu Dasgupta <108055538+cod40403@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:00:08 +0530 Subject: [PATCH 207/208] LYNX-942: [AC-2.4.9] [EE] Implement ReCaptcha for missing GraphQl mutations --- .../Test/Api/CouponApplyFormRecaptchaTest.php | 186 ++++++++++++------ .../Test/Api/CouponApplyGraphQLTest.php | 143 ++++++++++---- ReCaptchaCheckoutSalesRule/etc/module.xml | 6 +- 3 files changed, 231 insertions(+), 104 deletions(-) diff --git a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php index a9c937b7..200f0e44 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyFormRecaptchaTest.php @@ -8,10 +8,27 @@ namespace Magento\ReCaptchaCheckoutSalesRule\Test\Api; +use Magento\Catalog\Test\Fixture\Product as ProductFixture; +use Magento\Checkout\Test\Fixture\SetGuestEmail as SetGuestEmailFixture; +use Magento\Checkout\Test\Fixture\SetShippingAddress; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Framework\Exception\AuthenticationException; +use Magento\Framework\Exception\EmailNotConfirmedException; use Magento\Framework\Webapi\Rest\Request; -use Magento\Quote\Model\Quote; +use Magento\Integration\Api\CustomerTokenServiceInterface; use Magento\Quote\Model\QuoteFactory; +use Magento\Quote\Test\Fixture\AddProductToCart; +use Magento\Quote\Test\Fixture\CustomerCart; +use Magento\Quote\Test\Fixture\GuestCart; +use Magento\Quote\Test\Fixture\QuoteIdMask; +use Magento\SalesRule\Test\Fixture\Rule as SalesRuleFixture; +use Magento\TestFramework\Fixture\Config as ConfigFixture; +use Magento\TestFramework\Fixture\DataFixture; +use Magento\TestFramework\Fixture\DataFixtureStorage; +use Magento\TestFramework\Fixture\DataFixtureStorageManager; +use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\WebapiAbstract; +use Throwable; /** * Test that Coupon APIs are covered with ReCaptcha @@ -19,18 +36,22 @@ class CouponApplyFormRecaptchaTest extends WebapiAbstract { private const API_ROUTE = '/V1/carts/mine/coupons/%s'; - private const COUPON_CODE = 'testCoupon'; /** - * @var \Magento\TestFramework\ObjectManager + * @var CustomerTokenServiceInterface */ - protected $objectManager; + private $customerTokenService; /** * @var QuoteFactory */ private $quoteFactory; + /** + * @var DataFixtureStorage + */ + private $fixtures; + /** * @inheritDoc */ @@ -39,78 +60,115 @@ protected function setUp(): void parent::setUp(); $this->_markTestAsRestOnly(); - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->quoteFactory = $this->objectManager->get(QuoteFactory::class); + $this->quoteFactory = Bootstrap::getObjectManager()->get(QuoteFactory::class); + $this->fixtures = Bootstrap::getObjectManager()->get(DataFixtureStorageManager::class)->getStorage(); + $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); } - /** - * @magentoApiDataFixture Magento/Checkout/_files/quote.php - * @magentoApiDataFixture Magento/Customer/_files/customer.php - * @magentoConfigFixture default_store customer/captcha/enable 0 - * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key - * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key - * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible - */ + #[ + ConfigFixture('recaptcha_frontend/type_invisible/public_key', 'test_public_key'), + ConfigFixture('recaptcha_frontend/type_invisible/private_key', 'test_private_key'), + ConfigFixture('recaptcha_frontend/type_for/coupon_code', 'invisible'), + DataFixture(ProductFixture::class, as: 'product'), + DataFixture(Customer::class, as: 'customer'), + DataFixture(CustomerCart::class, ['customer_id' => '$customer.id$'], as: 'cart'), + DataFixture( + AddProductToCart::class, + ['cart_id' => '$cart.id$', 'product_id' => '$product.id$', 'qty' => 5], + 'cart_item' + ), + DataFixture(SetShippingAddress::class, ['cart_id' => '$cart.id$']), + DataFixture( + SalesRuleFixture::class, + [ + 'coupon_code' => 'coupon%uniqid%', + 'discount_amount' => 5.00, + 'coupon_type' => 2, + 'simple_action' => 'by_fixed' + ], + 'sales_rule' + ) + ] public function testRequired(): void { - $this->expectException(\Throwable::class); + $this->expectException(Throwable::class); $this->expectExceptionCode(400); - $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again"}'); - - // get customer ID token - /** @var \Magento\Integration\Api\CustomerTokenServiceInterface $customerTokenService */ - $customerTokenService = $this->objectManager->create( - \Magento\Integration\Api\CustomerTokenServiceInterface::class + $this->expectExceptionMessageMatches('/.*ReCaptcha validation failed, please try again.*/'); + + $this->_webApiCall( + [ + 'rest' => [ + 'resourcePath' => sprintf( + self::API_ROUTE, + $this->fixtures->get('sales_rule')->getCouponCode() + ), + 'httpMethod' => Request::HTTP_METHOD_PUT, + 'token' => $this->getCustomerAuthToken( + $this->fixtures->get('customer')->getEmail() + ), + ], + ], + [ + 'cart_id' => $this->fixtures->get('cart')->getId() + ] ); - $token = $customerTokenService->createCustomerAccessToken('customer@example.com', 'password'); - - /** @var Quote $quote */ - $quote = $this->quoteFactory->create(); - $quote->load('test_order_1', 'reserved_order_id'); - $cartId = $quote->getId(); + } - $api_url = sprintf(self::API_ROUTE, self::COUPON_CODE); - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $api_url, - 'httpMethod' => Request::HTTP_METHOD_PUT, - 'token' => $token, + #[ + ConfigFixture('recaptcha_frontend/type_invisible/public_key', 'test_public_key'), + ConfigFixture('recaptcha_frontend/type_invisible/private_key', 'test_private_key'), + ConfigFixture('recaptcha_frontend/type_for/coupon_code', 'invisible'), + DataFixture(ProductFixture::class, as: 'product'), + DataFixture(GuestCart::class, as: 'quote'), + DataFixture(QuoteIdMask::class, ['cart_id' => '$quote.id$'], 'cart_mask'), + DataFixture(SetGuestEmailFixture::class, ['cart_id' => '$quote.id$']), + DataFixture( + AddProductToCart::class, + ['cart_id' => '$quote.id$', 'product_id' => '$product.id$', 'qty' => 5], + 'cart_item' + ), + DataFixture(SetShippingAddress::class, ['cart_id' => '$quote.id$']), + DataFixture( + SalesRuleFixture::class, + [ + 'coupon_code' => 'coupon%uniqid%', + 'discount_amount' => 5.00, + 'coupon_type' => 2, + 'simple_action' => 'by_fixed' ], - ]; - $requestData = [ - 'cart_id' => $cartId - ]; - - $this->_webApiCall($serviceInfo, $requestData); + 'sales_rule' + ) + ] + public function testGuestCartTest(): void + { + $this->expectException(Throwable::class); + $this->expectExceptionCode(400); + $this->expectExceptionMessageMatches('/.*ReCaptcha validation failed, please try again.*/'); + + $cartId = $this->fixtures->get('cart_mask')->getMaskedId(); + $couponCode = $this->fixtures->get('sales_rule')->getCouponCode(); + $this->_webApiCall( + [ + 'rest' => [ + 'resourcePath' => "/V1/guest-carts/$cartId/coupons/" . $couponCode, + 'httpMethod' => Request::HTTP_METHOD_PUT, + 'token' => null + ], + ], + [] + ); } /** - * @magentoApiDataFixture Magento/Checkout/_files/quote.php - * @magentoConfigFixture default_store customer/captcha/enable 0 - * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key - * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key - * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible + * Get customer authentication token + * + * @param string $email + * @return string + * @throws AuthenticationException + * @throws EmailNotConfirmedException */ - public function testGuestCartTest(): void + private function getCustomerAuthToken(string $email): string { - $this->expectException(\Throwable::class); - $this->expectExceptionCode(400); - $this->expectExceptionMessage('{"message":"ReCaptcha validation failed, please try again"}'); - - /** @var Quote $quote */ - $quote = $this->quoteFactory->create(); - $quote->load('test_order_1', 'reserved_order_id'); - $cartId = $quote->getId(); - $api_url = "/V1/guest-carts/$cartId/coupons/".self::COUPON_CODE; - - $serviceInfo = [ - 'rest' => [ - 'resourcePath' => $api_url, - 'httpMethod' => Request::HTTP_METHOD_PUT, - 'token' => null - ], - ]; - $requestData = []; - $this->_webApiCall($serviceInfo, $requestData); + return $this->customerTokenService->createCustomerAccessToken($email, 'password'); } } diff --git a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php index bdba974a..4653f817 100644 --- a/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php +++ b/ReCaptchaCheckoutSalesRule/Test/Api/CouponApplyGraphQLTest.php @@ -8,10 +8,22 @@ namespace Magento\ReCaptchaCheckoutSalesRule\Test\Api; +use Magento\Catalog\Test\Fixture\Product as ProductFixture; +use Magento\Checkout\Test\Fixture\SetShippingAddress; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Framework\Exception\AuthenticationException; +use Magento\Framework\Exception\EmailNotConfirmedException; +use Magento\Integration\Api\CustomerTokenServiceInterface; +use Magento\Quote\Test\Fixture\AddProductToCart; +use Magento\Quote\Test\Fixture\CustomerCart; +use Magento\Quote\Test\Fixture\QuoteIdMask; +use Magento\SalesRule\Test\Fixture\Rule as SalesRuleFixture; +use Magento\TestFramework\Fixture\Config as ConfigFixture; +use Magento\TestFramework\Fixture\DataFixture; +use Magento\TestFramework\Fixture\DataFixtureStorage; +use Magento\TestFramework\Fixture\DataFixtureStorageManager; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\TestCase\GraphQlAbstract; -use Magento\Quote\Model\Quote; -use Magento\Quote\Model\QuoteFactory; /** * Test graphql for couponApply @@ -19,55 +31,108 @@ class CouponApplyGraphQLTest extends GraphQlAbstract { /** - * @var QuoteFactory + * @var CustomerTokenServiceInterface */ - private $quoteFactory; + private $customerTokenService; + + /** + * @var DataFixtureStorage + */ + private $fixtures; protected function setUp(): void { - $objectManager = Bootstrap::getObjectManager(); - $this->quoteFactory = $objectManager->get(QuoteFactory::class); + parent::setUp(); + $this->fixtures = Bootstrap::getObjectManager()->get(DataFixtureStorageManager::class)->getStorage(); + $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); } - /** - * @magentoApiDataFixture Magento/Checkout/_files/quote.php - * @magentoConfigFixture default_store customer/captcha/enable 0 - * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/public_key test_public_key - * @magentoConfigFixture base_website recaptcha_frontend/type_invisible/private_key test_private_key - * @magentoConfigFixture base_website recaptcha_frontend/type_for/coupon_code invisible - */ + #[ + DataFixture(ProductFixture::class, as: 'product'), + DataFixture(Customer::class, as: 'customer'), + DataFixture(CustomerCart::class, ['customer_id' => '$customer.id$'], as: 'cart'), + DataFixture( + AddProductToCart::class, + ['cart_id' => '$cart.id$', 'product_id' => '$product.id$', 'qty' => 5], + 'cart_item' + ), + DataFixture(SetShippingAddress::class, ['cart_id' => '$cart.id$']), + DataFixture(QuoteIdMask::class, ['cart_id' => '$cart.id$'], 'cart_mask'), + DataFixture( + SalesRuleFixture::class, + [ + 'coupon_code' => 'coupon%uniqid%', + 'discount_amount' => 5.00, + 'coupon_type' => 2, + 'simple_action' => 'by_fixed' + ], + 'sales_rule' + ), + ConfigFixture('customer/captcha/enable', '0'), + ConfigFixture('recaptcha_frontend/type_invisible/public_key', 'test_public_key'), + ConfigFixture('recaptcha_frontend/type_invisible/private_key', 'test_private_key'), + ConfigFixture('recaptcha_frontend/type_for/coupon_code', 'invisible') + ] public function testCreateCouponApply(): void { + $this->expectException(\Throwable::class); $this->expectExceptionMessage('ReCaptcha validation failed, please try again'); - /** @var Quote $quote */ - $quote = $this->quoteFactory->create(); - $quote->load('test_order_1', 'reserved_order_id'); - $cartId = $quote->getId(); + $this->graphQlMutation( + $this->getApplyCouponToCartMutation( + $this->fixtures->get('cart_mask')->getMaskedId(), + $this->fixtures->get('sales_rule')->getCouponCode() + ), + [], + '', + $this->getCustomerAuthHeaders($this->fixtures->get('customer')->getEmail()) + ); + } - $query = <<<QUERY -mutation { - applyCouponToCart( - input: { - cart_id:"{$cartId}", - coupon_code: "{testCoupon}" + /** + * Prepare mutation for applying coupon to cart + * + * @param string $cartId + * @return string + */ + private function getApplyCouponToCartMutation(string $cartId, string $couponCode): string + { + return <<<MUTATION + mutation { + applyCouponToCart( + input: { + cart_id:"{$cartId}", + coupon_code: "{$couponCode}" + } + ) { + cart{ + applied_coupons { + code + } + prices { + grand_total{ + value + currency + } + } + } + } + } + MUTATION; } - ) { - cart{ - applied_coupons { - code - } - prices { - grand_total{ - value - currency - } - } - } - } -} -QUERY; - $this->graphQlMutation($query); + /** + * Get customer authentication headers + * + * @param string $email + * @return array + * @throws AuthenticationException + * @throws EmailNotConfirmedException + */ + private function getCustomerAuthHeaders(string $email): array + { + $token = $this->customerTokenService->createCustomerAccessToken($email, 'password'); + + return ['Authorization' => 'Bearer ' . $token]; } } diff --git a/ReCaptchaCheckoutSalesRule/etc/module.xml b/ReCaptchaCheckoutSalesRule/etc/module.xml index 8fc9b371..47b46b1c 100644 --- a/ReCaptchaCheckoutSalesRule/etc/module.xml +++ b/ReCaptchaCheckoutSalesRule/etc/module.xml @@ -7,5 +7,9 @@ --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> - <module name="Magento_ReCaptchaCheckoutSalesRule"/> + <module name="Magento_ReCaptchaCheckoutSalesRule"> + <sequence> + <module name="Magento_ReCaptchaWebapiRest" /> + </sequence> + </module> </config> From 7ebe0c6ddab94a897d4249cffbbaddfa03291902 Mon Sep 17 00:00:00 2001 From: Deepak Soni <deepaksoni@adobe.com> Date: Tue, 9 Sep 2025 13:46:15 +0530 Subject: [PATCH 208/208] LYNX-941: [AC-2.4.9] [CE] Implement ReCaptcha for missing GraphQl mutations --- .../Model/WebapiConfigProvider.php | 47 +++++++ .../Api/GraphQl/Contact/ContactUsTest.php | 50 +++++++ ReCaptchaContact/composer.json | 5 +- ReCaptchaContact/etc/di.xml | 17 +++ .../Model/WebapiConfigProvider.php | 55 ++++++-- .../GraphQl/Customer/UpdateCustomerTest.php | 131 ++++++++++++++++++ 6 files changed, 290 insertions(+), 15 deletions(-) create mode 100644 ReCaptchaContact/Model/WebapiConfigProvider.php create mode 100644 ReCaptchaContact/Test/Api/GraphQl/Contact/ContactUsTest.php create mode 100644 ReCaptchaContact/etc/di.xml create mode 100644 ReCaptchaCustomer/Test/Api/GraphQl/Customer/UpdateCustomerTest.php diff --git a/ReCaptchaContact/Model/WebapiConfigProvider.php b/ReCaptchaContact/Model/WebapiConfigProvider.php new file mode 100644 index 00000000..6c33ad4d --- /dev/null +++ b/ReCaptchaContact/Model/WebapiConfigProvider.php @@ -0,0 +1,47 @@ +<?php +/** + * Copyright 2025 Adobe + * All Rights Reserved. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaContact\Model; + +use Magento\ContactGraphQl\Model\Resolver\ContactUs; +use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; +use Magento\ReCaptchaUi\Model\ValidationConfigResolverInterface; +use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; +use Magento\ReCaptchaWebapiApi\Api\Data\EndpointInterface; +use Magento\ReCaptchaWebapiApi\Api\WebapiValidationConfigProviderInterface; + +class WebapiConfigProvider implements WebapiValidationConfigProviderInterface +{ + private const CAPTCHA_ID = 'contact'; + + /** + * WebapiConfigProvider constructor + * + * @param IsCaptchaEnabledInterface $isEnabled + * @param ValidationConfigResolverInterface $configResolver + */ + public function __construct( + private readonly IsCaptchaEnabledInterface $isEnabled, + private readonly ValidationConfigResolverInterface $configResolver + ) { + } + + /** + * @inheritDoc + */ + public function getConfigFor(EndpointInterface $endpoint): ?ValidationConfigInterface + { + if ($endpoint->getServiceMethod() === 'resolve' + && $endpoint->getServiceClass() === ContactUs::class + && $this->isEnabled->isCaptchaEnabledFor(self::CAPTCHA_ID) + ) { + return $this->configResolver->get(self::CAPTCHA_ID); + } + + return null; + } +} diff --git a/ReCaptchaContact/Test/Api/GraphQl/Contact/ContactUsTest.php b/ReCaptchaContact/Test/Api/GraphQl/Contact/ContactUsTest.php new file mode 100644 index 00000000..6f125b35 --- /dev/null +++ b/ReCaptchaContact/Test/Api/GraphQl/Contact/ContactUsTest.php @@ -0,0 +1,50 @@ +<?php +/** + * Copyright 2025 Adobe + * All Rights Reserved. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaContact\Test\Api\GraphQl\Contact; + +use Magento\TestFramework\Fixture\Config as ConfigFixture; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * GraphQl test for contact us functionality with ReCaptcha enabled. + */ +class ContactUsTest extends GraphQlAbstract +{ + #[ + ConfigFixture('recaptcha_frontend/type_invisible/public_key', 'test_public_key'), + ConfigFixture('recaptcha_frontend/type_invisible/private_key', 'test_private_key'), + ConfigFixture('recaptcha_frontend/type_for/contact', 'invisible') + ] + public function testContactUsReCaptchaValidationFailed(): void + { + $this->expectExceptionMessage('ReCaptcha validation failed, please try again'); + $this->graphQlMutation($this->getContactUsMutation()); + } + + /** + * Get contact us graphql mutation query + * + * @return string + */ + private function getContactUsMutation(): string + { + return <<<MUTATION + mutation { + contactUs(input: { + comment:"Test Contact Us", + email:"test@adobe.com", + name:"John Doe", + telephone:"1111111111" + }) + { + status + } + } + MUTATION; + } +} diff --git a/ReCaptchaContact/composer.json b/ReCaptchaContact/composer.json index c4e01be6..d0148354 100644 --- a/ReCaptchaContact/composer.json +++ b/ReCaptchaContact/composer.json @@ -4,7 +4,10 @@ "require": { "php": "~8.2.0||~8.3.0||~8.4.0", "magento/framework": "*", - "magento/module-re-captcha-ui": "*" + "magento/module-contact-graph-ql": "*", + "magento/module-re-captcha-ui": "*", + "magento/module-re-captcha-validation-api": "*", + "magento/module-re-captcha-webapi-api": "*" }, "type": "magento2-module", "license": "OSL-3.0", diff --git a/ReCaptchaContact/etc/di.xml b/ReCaptchaContact/etc/di.xml new file mode 100644 index 00000000..8b1bba05 --- /dev/null +++ b/ReCaptchaContact/etc/di.xml @@ -0,0 +1,17 @@ +<?xml version="1.0"?> +<!-- +/** + * Copyright 2025 Adobe + * All Rights Reserved. + */ +--> +<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> + <type name="Magento\ReCaptchaWebapiApi\Model\CompositeWebapiValidationConfigProvider"> + <arguments> + <argument name="providers" xsi:type="array"> + <item name="recaptcha_on_contact_form" xsi:type="object">Magento\ReCaptchaContact\Model\WebapiConfigProvider</item> + </argument> + </arguments> + </type> +</config> diff --git a/ReCaptchaCustomer/Model/WebapiConfigProvider.php b/ReCaptchaCustomer/Model/WebapiConfigProvider.php index 94c97190..974bb05c 100644 --- a/ReCaptchaCustomer/Model/WebapiConfigProvider.php +++ b/ReCaptchaCustomer/Model/WebapiConfigProvider.php @@ -8,6 +8,11 @@ namespace Magento\ReCaptchaCustomer\Model; +use Magento\CustomerGraphQl\Model\Resolver\ChangePassword; +use Magento\CustomerGraphQl\Model\Resolver\RequestPasswordResetEmail; +use Magento\CustomerGraphQl\Model\Resolver\ResetPassword; +use Magento\CustomerGraphQl\Model\Resolver\UpdateCustomer; +use Magento\Framework\Exception\InputException; use Magento\ReCaptchaUi\Model\IsCaptchaEnabledInterface; use Magento\ReCaptchaUi\Model\ValidationConfigResolverInterface; use Magento\ReCaptchaValidationApi\Api\Data\ValidationConfigInterface; @@ -21,7 +26,7 @@ class WebapiConfigProvider implements WebapiValidationConfigProviderInterface { private const RESET_PASSWORD_CAPTCHA_ID = 'customer_forgot_password'; - private const CHANGE_PASSWORD_CAPTCHA_ID = 'customer_edit'; + private const CUSTOMER_EDIT_CAPTCHA_ID = 'customer_edit'; private const LOGIN_CAPTCHA_ID = 'customer_login'; @@ -53,27 +58,49 @@ public function __construct(IsCaptchaEnabledInterface $isEnabled, ValidationConf * @param string $serviceMethod * @param string $serviceClass * @return ValidationConfigInterface|null + * @throws InputException */ private function validateChangePasswordCaptcha($serviceMethod, $serviceClass): ?ValidationConfigInterface { - //phpcs:disable Magento2.PHP.LiteralNamespaces - if ($serviceMethod === 'resetPassword' || $serviceMethod === 'initiatePasswordReset' - || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\ResetPassword' - || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\RequestPasswordResetEmail' - ) { - return $this->isEnabled->isCaptchaEnabledFor(self::RESET_PASSWORD_CAPTCHA_ID) ? - $this->configResolver->get(self::RESET_PASSWORD_CAPTCHA_ID) : null; - } elseif ($serviceMethod === 'changePasswordById' - || $serviceClass === 'Magento\CustomerGraphQl\Model\Resolver\ChangePassword' - ) { - return $this->isEnabled->isCaptchaEnabledFor(self::CHANGE_PASSWORD_CAPTCHA_ID) ? - $this->configResolver->get(self::CHANGE_PASSWORD_CAPTCHA_ID) : null; + if ($this->isResetPasswordCase($serviceMethod, $serviceClass)) { + $captchaId = self::RESET_PASSWORD_CAPTCHA_ID; + } elseif ($this->isChangePasswordCase($serviceMethod, $serviceClass)) { + $captchaId = self::CUSTOMER_EDIT_CAPTCHA_ID; + } + + if (isset($captchaId) && $this->isEnabled->isCaptchaEnabledFor($captchaId)) { + return $this->configResolver->get($captchaId); } - //phpcs:enable Magento2.PHP.LiteralNamespaces return null; } + /** + * Check if the request is related to reset password + * + * @param string $serviceMethod + * @param string $serviceClass + * @return bool + */ + private function isResetPasswordCase(string $serviceMethod, string $serviceClass): bool + { + return in_array($serviceMethod, ['resetPassword', 'initiatePasswordReset'], true) + || in_array($serviceClass, [ResetPassword::class, RequestPasswordResetEmail::class], true); + } + + /** + * Check if the request is related to change password + * + * @param string $serviceMethod + * @param string $serviceClass + * @return bool + */ + private function isChangePasswordCase(string $serviceMethod, string $serviceClass): bool + { + return $serviceMethod === 'changePasswordById' + || in_array($serviceClass, [ChangePassword::class, UpdateCustomer::class], true); + } + /** * Validates ifLoginCaptchaEnabled using captcha_id * diff --git a/ReCaptchaCustomer/Test/Api/GraphQl/Customer/UpdateCustomerTest.php b/ReCaptchaCustomer/Test/Api/GraphQl/Customer/UpdateCustomerTest.php new file mode 100644 index 00000000..e2ff2cbb --- /dev/null +++ b/ReCaptchaCustomer/Test/Api/GraphQl/Customer/UpdateCustomerTest.php @@ -0,0 +1,131 @@ +<?php +/** + * Copyright 2025 Adobe + * All Rights Reserved. + */ +declare(strict_types=1); + +namespace Magento\ReCaptchaCustomer\Test\Api\GraphQl\Customer; + +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Customer\Test\Fixture\Customer; +use Magento\Framework\Exception\AuthenticationException; +use Magento\Integration\Api\CustomerTokenServiceInterface; +use Magento\TestFramework\Fixture\Config as ConfigFixture; +use Magento\TestFramework\Fixture\DataFixture; +use Magento\TestFramework\Fixture\DataFixtureStorageManager; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\GraphQlAbstract; + +/** + * GraphQl test for update customer functionality with ReCaptcha enabled. + */ +class UpdateCustomerTest extends GraphQlAbstract +{ + /** + * @var CustomerTokenServiceInterface + */ + private $customerTokenService; + + /** + * @var CustomerInterface + */ + private $customer; + + protected function setUp(): void + { + $this->customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class); + $this->customer = DataFixtureStorageManager::getStorage()->get('customer'); + } + + #[ + DataFixture(Customer::class, as: 'customer'), + ConfigFixture('recaptcha_frontend/type_invisible/public_key', 'test_public_key'), + ConfigFixture('recaptcha_frontend/type_invisible/private_key', 'test_private_key'), + ConfigFixture('recaptcha_frontend/type_for/customer_edit', 'invisible') + ] + public function testUpdateCustomerV2ReCaptchaValidationFailed(): void + { + $this->expectExceptionMessage('ReCaptcha validation failed, please try again'); + $this->graphQlMutation( + $this->getUpdateCustomerV2Mutation(), + [], + '', + $this->getCustomerAuthHeaders($this->customer->getEmail()) + ); + } + + #[ + DataFixture(Customer::class, as: 'customer'), + ConfigFixture('recaptcha_frontend/type_invisible/public_key', 'test_public_key'), + ConfigFixture('recaptcha_frontend/type_invisible/private_key', 'test_private_key'), + ConfigFixture('recaptcha_frontend/type_for/customer_edit', 'invisible') + ] + public function testUpdateCustomerReCaptchaValidationFailed(): void + { + $this->expectExceptionMessage('ReCaptcha validation failed, please try again'); + $this->graphQlMutation( + $this->getUpdateCustomerMutation(), + [], + '', + $this->getCustomerAuthHeaders($this->customer->getEmail()) + ); + } + + /** + * Get update customer graphql mutation + * + * @return string + */ + private function getUpdateCustomerMutation(): string + { + return <<<MUTATION + mutation { + updateCustomer( + input: { + firstname: "Test User" + } + ) { + customer { + firstname + } + } + } + MUTATION; + } + + /** + * Get update customer V2 graphql mutation + * + * @return string + */ + private function getUpdateCustomerV2Mutation(): string + { + return <<<MUTATION + mutation { + updateCustomerV2( + input: { + firstname: "Test User" + } + ) { + customer { + firstname + } + } + } + MUTATION; + } + + /** + * Get customer auth headers + * + * @param string $email + * @return array + * @throws AuthenticationException + */ + private function getCustomerAuthHeaders(string $email): array + { + $customerToken = $this->customerTokenService->createCustomerAccessToken($email, 'password'); + return ['Authorization' => 'Bearer ' . $customerToken]; + } +}