File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
app/code/Magento/Captcha/Plugin Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1111use Magento \Customer \Block \Account \AuthenticationPopup ;
1212use Magento \Customer \Model \Context ;
1313use 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 /**
You can’t perform that action at this time.
0 commit comments