Skip to content

Commit c2c85ce

Browse files
committed
Fix integration test failures
1 parent ed76de5 commit c2c85ce

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/code/Magento/Captcha/Plugin/CheckCaptchaOnStorefront.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Customer\Block\Account\AuthenticationPopup;
1212
use Magento\Customer\Model\Context;
1313
use Magento\Framework\App\Http\Context as HttpContext;
14+
use Magento\Framework\App\Config\ScopeConfigInterface;
15+
use Magento\Store\Model\ScopeInterface;
1416

1517
/**
1618
* Check need captcha for authentication popup
@@ -25,7 +27,8 @@ class CheckCaptchaOnStorefront
2527
*/
2628
public function __construct(
2729
private readonly HelperCaptcha $helper,
28-
private readonly HttpContext $httpContext
30+
private readonly HttpContext $httpContext,
31+
private readonly ScopeConfigInterface $scopeConfig
2932
) {
3033
}
3134

@@ -40,13 +43,16 @@ public function __construct(
4043
*/
4144
public function afterGetTemplate(
4245
AuthenticationPopup $subject,
43-
string $result
46+
?string $result
4447
): string {
45-
if ($this->isLoggedIn() || !$this->helper->getConfig('enable')) {
48+
// Check the value for recaptcha_frontend/type_for/customer_login
49+
$recaptchaType = $this->scopeConfig->getValue('recaptcha_frontend/type_for/customer_login', ScopeInterface::SCOPE_WEBSITE);
50+
51+
if ($this->isLoggedIn() || (!$this->helper->getConfig('enable') && $recaptchaType === null)) {
4652
return '';
4753
}
4854

49-
return $result;
55+
return $result ?? '';
5056
}
5157

5258
/**

0 commit comments

Comments
 (0)