From e36d65d30a4c95de77a3d9403493d07af71f8011 Mon Sep 17 00:00:00 2001 From: magentix Date: Fri, 31 Mar 2023 15:03:42 +0200 Subject: [PATCH 1/5] Config path updated --- CHANGELOG.md | 4 ++++ Helper/Config.php | 10 +++++----- composer.json | 2 +- etc/acl.xml | 2 +- etc/adminhtml/system.xml | 6 +++--- etc/config.xml | 8 ++++---- view/frontend/layout/catalog_product_view.xml | 2 +- view/frontend/layout/contact_index_index.xml | 2 +- view/frontend/layout/customer_account_create.xml | 2 +- .../layout/customer_account_forgotpassword.xml | 2 +- view/frontend/layout/customer_account_login.xml | 2 +- view/frontend/layout/default.xml | 2 +- 12 files changed, 24 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b85422..a67db0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 100.1.2 + +- Config path updated + ## 100.1.1 - Fix review data persistor diff --git a/Helper/Config.php b/Helper/Config.php index a43eb8f..0c1e953 100644 --- a/Helper/Config.php +++ b/Helper/Config.php @@ -14,11 +14,11 @@ class Config extends AbstractHelper { - public const TURNSTILE_CONFIG_PATH_ENABLED = 'pixel_open/cloudflare_turnstile/enabled'; - public const TURNSTILE_CONFIG_PATH_SECRET_KEY = 'pixel_open/cloudflare_turnstile/secret_key'; - public const TURNSTILE_CONFIG_PATH_SITEKEY = 'pixel_open/cloudflare_turnstile/sitekey'; - public const TURNSTILE_CONFIG_PATH_THEME = 'pixel_open/cloudflare_turnstile/theme'; - public const TURNSTILE_CONFIG_PATH_FORMS = 'pixel_open/cloudflare_turnstile/forms'; + public const TURNSTILE_CONFIG_PATH_ENABLED = 'pixel_open_cloudflare_turnstile/settings/enabled'; + public const TURNSTILE_CONFIG_PATH_SECRET_KEY = 'pixel_open_cloudflare_turnstile/settings/secret_key'; + public const TURNSTILE_CONFIG_PATH_SITEKEY = 'pixel_open_cloudflare_turnstile/settings/sitekey'; + public const TURNSTILE_CONFIG_PATH_THEME = 'pixel_open_cloudflare_turnstile/settings/theme'; + public const TURNSTILE_CONFIG_PATH_FORMS = 'pixel_open_cloudflare_turnstile/settings/forms'; /** * Is Turnstile enabled diff --git a/composer.json b/composer.json index 6cd6f50..0bacda4 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "magento/framework": "*" }, "type": "magento2-module", - "version": "100.1.1", + "version": "100.1.2", "autoload": { "files": [ "registration.php" diff --git a/etc/acl.xml b/etc/acl.xml index da00f1c..77d0dac 100644 --- a/etc/acl.xml +++ b/etc/acl.xml @@ -14,7 +14,7 @@ - + diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml index 0678b69..e9ce4d1 100644 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -9,11 +9,11 @@ --> -
+
customer - Pixel_CloudflareTurnstile::settings - + PixelOpen_CloudflareTurnstile::settings + diff --git a/etc/config.xml b/etc/config.xml index f6ba908..f7b2f4c 100644 --- a/etc/config.xml +++ b/etc/config.xml @@ -9,11 +9,11 @@ --> - - + + 0 light - - + + diff --git a/view/frontend/layout/catalog_product_view.xml b/view/frontend/layout/catalog_product_view.xml index 58c9abe..327e737 100644 --- a/view/frontend/layout/catalog_product_view.xml +++ b/view/frontend/layout/catalog_product_view.xml @@ -10,7 +10,7 @@ - + review diff --git a/view/frontend/layout/contact_index_index.xml b/view/frontend/layout/contact_index_index.xml index ed47b8c..da9d497 100644 --- a/view/frontend/layout/contact_index_index.xml +++ b/view/frontend/layout/contact_index_index.xml @@ -10,7 +10,7 @@ - + contact diff --git a/view/frontend/layout/customer_account_create.xml b/view/frontend/layout/customer_account_create.xml index 69737a9..c4bca0d 100644 --- a/view/frontend/layout/customer_account_create.xml +++ b/view/frontend/layout/customer_account_create.xml @@ -10,7 +10,7 @@ - + register diff --git a/view/frontend/layout/customer_account_forgotpassword.xml b/view/frontend/layout/customer_account_forgotpassword.xml index 8cd6651..4c5cd71 100644 --- a/view/frontend/layout/customer_account_forgotpassword.xml +++ b/view/frontend/layout/customer_account_forgotpassword.xml @@ -10,7 +10,7 @@ - + password diff --git a/view/frontend/layout/customer_account_login.xml b/view/frontend/layout/customer_account_login.xml index 3965b21..88878df 100644 --- a/view/frontend/layout/customer_account_login.xml +++ b/view/frontend/layout/customer_account_login.xml @@ -10,7 +10,7 @@ - + login diff --git a/view/frontend/layout/default.xml b/view/frontend/layout/default.xml index a64e71e..1e352df 100644 --- a/view/frontend/layout/default.xml +++ b/view/frontend/layout/default.xml @@ -13,7 +13,7 @@ - + From c4e45965b7c366a2454cdd50f11192fb282feaf5 Mon Sep 17 00:00:00 2001 From: magentix Date: Fri, 31 Mar 2023 15:04:51 +0200 Subject: [PATCH 2/5] Copyright updated --- Block/Turnstile.php | 2 +- Block/Turnstile/Config.php | 2 +- Helper/Config.php | 2 +- LICENCE | 2 +- Model/Config/Source/Forms.php | 2 +- Model/Config/Source/Theme.php | 2 +- Model/Turnstile/ConfigProvider.php | 2 +- Model/Validator.php | 2 +- Observer/Validate.php | 2 +- etc/acl.xml | 2 +- etc/adminhtml/system.xml | 2 +- etc/config.xml | 2 +- etc/frontend/di.xml | 2 +- etc/frontend/events.xml | 2 +- etc/module.xml | 2 +- view/frontend/layout/catalog_product_view.xml | 2 +- view/frontend/layout/contact_index_index.xml | 2 +- view/frontend/layout/customer_account_create.xml | 2 +- view/frontend/layout/customer_account_forgotpassword.xml | 2 +- view/frontend/layout/customer_account_login.xml | 2 +- view/frontend/layout/default.xml | 2 +- view/frontend/web/js/view/turnstile.js | 2 +- 22 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Block/Turnstile.php b/Block/Turnstile.php index c0759b3..eb11df6 100644 --- a/Block/Turnstile.php +++ b/Block/Turnstile.php @@ -1,6 +1,6 @@ + + + + + challenges.cloudflare.com + + + + + challenges.cloudflare.com + + + + From 6597597879d58dadd19d8ef3e103c53b29296659 Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 13 Apr 2023 10:00:03 +0200 Subject: [PATCH 4/5] Fix version --- CHANGELOG.md | 5 +---- composer.json | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a69fc44..32e9325 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,7 @@ -## 100.1.3 - -- CSP Whitelist added - ## 100.1.2 - Config path updated +- CSP Whitelist added ## 100.1.1 diff --git a/composer.json b/composer.json index f1928f2..0bacda4 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "magento/framework": "*" }, "type": "magento2-module", - "version": "100.1.3", + "version": "100.1.2", "autoload": { "files": [ "registration.php" From 21c5450568281e9c2170b6a528bb1ff93eb5ea3d Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 13 Apr 2023 10:11:39 +0200 Subject: [PATCH 5/5] Fix form validator when Turnstile is disabled --- CHANGELOG.md | 1 + Observer/Validate.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32e9325..7f07416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ - Config path updated - CSP Whitelist added +- Fix form validator when Turnstile is disabled ## 100.1.1 diff --git a/Observer/Validate.php b/Observer/Validate.php index 23505bb..b8f10ed 100644 --- a/Observer/Validate.php +++ b/Observer/Validate.php @@ -28,6 +28,7 @@ use Magento\Framework\Serialize\Serializer\Json; use Magento\Framework\Session\Generic; use Magento\Review\Controller\Product\Post as ReviewPost; +use PixelOpen\CloudflareTurnstile\Helper\Config; use PixelOpen\CloudflareTurnstile\Model\Config\Source\Forms; use PixelOpen\CloudflareTurnstile\Model\Validator; @@ -47,6 +48,8 @@ class Validate implements ObserverInterface protected Json $json; + protected Config $config; + /** * @param ManagerInterface $messageManager * @param Response $response @@ -55,6 +58,7 @@ class Validate implements ObserverInterface * @param Generic $reviewSession * @param Validator $validator * @param Json $json + * @param Config $config */ public function __construct( ManagerInterface $messageManager, @@ -63,7 +67,8 @@ public function __construct( CustomerSession $customerSession, Generic $reviewSession, Validator $validator, - Json $json + Json $json, + Config $config ) { $this->messageManager = $messageManager; $this->response = $response; @@ -72,6 +77,7 @@ public function __construct( $this->reviewSession = $reviewSession; $this->validator = $validator; $this->json = $json; + $this->config = $config; } /** @@ -130,6 +136,9 @@ public function getCfResponse(Request $request, ActionInterface $action): ?strin */ public function canValidate(Request $request, ActionInterface $action): bool { + if (!$this->config->isEnabled()) { + return false; + } if (!$request->isPost()) { return false; }