From 52a46c5156dd494cba74f366a14d566127c59d37 Mon Sep 17 00:00:00 2001 From: Alexander Steshuk Date: Wed, 1 Apr 2020 13:22:35 +0300 Subject: [PATCH 1/2] security-package/incorrect-language-of-recaptcha: Update for reCaptcha Frontend, all types, set param hl in call to render. --- ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js | 3 +-- ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php | 3 ++- ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php | 1 + ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js index 154cc2fd..4d672ed3 100644 --- a/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js +++ b/ReCaptchaFrontendUi/view/frontend/web/js/reCaptcha.js @@ -55,8 +55,7 @@ define( element.async = true; element.src = 'https://www.google.com/recaptcha/api.js' + - '?onload=globalOnRecaptchaOnLoadCallback&render=explicit' + - (this.settings.rendering.lang ? '&hl=' + this.settings.rendering.lang : ''); + '?onload=globalOnRecaptchaOnLoadCallback&render=explicit'; scriptTag.parentNode.insertBefore(element, scriptTag); diff --git a/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php index 8966051c..898de08c 100644 --- a/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php @@ -45,7 +45,8 @@ public function get(): array 'sitekey' => $this->getPublicKey(), 'size' => $this->getSize(), 'theme' => $this->getTheme(), - 'lang' => $this->getLanguageCode(), + 'hl' => $this->getLanguageCode(), + 'lang' => $this->getLanguageCode() ], 'invisible' => false, ]; diff --git a/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php index 3bccb957..252a1f39 100644 --- a/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php @@ -46,6 +46,7 @@ public function get(): array 'badge' => $this->getInvisibleBadgePosition(), 'size' => 'invisible', 'theme' => $this->getTheme(), + 'hl' => $this->getLanguageCode(), 'lang' => $this->getLanguageCode() ], 'invisible' => true, diff --git a/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php index 77c6512a..40242d0c 100644 --- a/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php @@ -46,7 +46,8 @@ public function get(): array 'badge' => $this->getInvisibleBadgePosition(), 'size' => 'invisible', 'theme' => $this->getTheme(), - 'lang'=> $this->getLanguageCode() + 'hl' => $this->getLanguageCode(), + 'lang' => $this->getLanguageCode() ], 'invisible' => true, ]; From d11404fe37fe9e99f3ff90af11f7e06f5e7160a3 Mon Sep 17 00:00:00 2001 From: Alexander Steshuk Date: Thu, 2 Apr 2020 11:37:55 +0300 Subject: [PATCH 2/2] security-package/incorrect-language-of-recaptcha: Update for reCaptcha Admin panel, all types. Reformat code. --- ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml | 4 +--- .../Model/Adminhtml/UiConfigProvider.php | 2 +- ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php | 3 +-- .../Model/Adminhtml/UiConfigProvider.php | 2 +- .../Model/Frontend/UiConfigProvider.php | 3 +-- .../Model/Adminhtml/UiConfigProvider.php | 2 +- .../Model/Frontend/UiConfigProvider.php | 3 +-- 7 files changed, 7 insertions(+), 12 deletions(-) diff --git a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml index e9c76038..facac60d 100644 --- a/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml +++ b/ReCaptchaUser/view/adminhtml/templates/recaptcha.phtml @@ -7,7 +7,6 @@ $config = $block->getCaptchaUiConfig(); $renderingOptions = $config['rendering'] ?? []; $isInvisible = !empty($config['invisible']); -$languageCode = $config['rendering']['lang'] ?? null; ?>
; + + '?onload=globalOnRecaptchaOnLoadCallback&render=explicit'; window.globalOnRecaptchaOnLoadCallback = function () { let token = ''; diff --git a/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php b/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php index 8300ad6f..e0bf8948 100644 --- a/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php +++ b/ReCaptchaVersion2Checkbox/Model/Adminhtml/UiConfigProvider.php @@ -44,7 +44,7 @@ public function get(): array 'sitekey' => $this->getPublicKey(), 'size' => $this->getSize(), 'theme' => $this->getTheme(), - 'lang' => $this->getLanguageCode(), + 'hl' => $this->getLanguageCode(), ], 'invisible' => false, ]; diff --git a/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php index 898de08c..d2745a2f 100644 --- a/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion2Checkbox/Model/Frontend/UiConfigProvider.php @@ -45,8 +45,7 @@ public function get(): array 'sitekey' => $this->getPublicKey(), 'size' => $this->getSize(), 'theme' => $this->getTheme(), - 'hl' => $this->getLanguageCode(), - 'lang' => $this->getLanguageCode() + 'hl' => $this->getLanguageCode() ], 'invisible' => false, ]; diff --git a/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php b/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php index 87e99676..e39215dc 100644 --- a/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php +++ b/ReCaptchaVersion2Invisible/Model/Adminhtml/UiConfigProvider.php @@ -45,7 +45,7 @@ public function get(): array 'badge' => $this->getInvisibleBadgePosition(), 'size' => 'invisible', 'theme' => $this->getTheme(), - 'lang'=> $this->getLanguageCode() + 'hl' => $this->getLanguageCode() ], 'invisible' => true, ]; diff --git a/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php index 252a1f39..47d6cb25 100644 --- a/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion2Invisible/Model/Frontend/UiConfigProvider.php @@ -46,8 +46,7 @@ public function get(): array 'badge' => $this->getInvisibleBadgePosition(), 'size' => 'invisible', 'theme' => $this->getTheme(), - 'hl' => $this->getLanguageCode(), - 'lang' => $this->getLanguageCode() + 'hl' => $this->getLanguageCode() ], 'invisible' => true, ]; diff --git a/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php b/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php index 35056517..354b16d1 100644 --- a/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php +++ b/ReCaptchaVersion3Invisible/Model/Adminhtml/UiConfigProvider.php @@ -45,7 +45,7 @@ public function get(): array 'badge' => $this->getInvisibleBadgePosition(), 'size' => 'invisible', 'theme' => $this->getTheme(), - 'lang'=> $this->getLanguageCode() + 'hl'=> $this->getLanguageCode() ], 'invisible' => true, ]; diff --git a/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php b/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php index 40242d0c..7f36312b 100644 --- a/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php +++ b/ReCaptchaVersion3Invisible/Model/Frontend/UiConfigProvider.php @@ -46,8 +46,7 @@ public function get(): array 'badge' => $this->getInvisibleBadgePosition(), 'size' => 'invisible', 'theme' => $this->getTheme(), - 'hl' => $this->getLanguageCode(), - 'lang' => $this->getLanguageCode() + 'hl' => $this->getLanguageCode() ], 'invisible' => true, ];