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 11
11
use Magento \Customer \Block \Account \AuthenticationPopup ;
12
12
use Magento \Customer \Model \Context ;
13
13
use Magento \Framework \App \Http \Context as HttpContext ;
14
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
15
+ use Magento \Store \Model \ScopeInterface ;
14
16
15
17
/**
16
18
* Check need captcha for authentication popup
@@ -25,7 +27,8 @@ class CheckCaptchaOnStorefront
25
27
*/
26
28
public function __construct (
27
29
private readonly HelperCaptcha $ helper ,
28
- private readonly HttpContext $ httpContext
30
+ private readonly HttpContext $ httpContext ,
31
+ private readonly ScopeConfigInterface $ scopeConfig
29
32
) {
30
33
}
31
34
@@ -40,13 +43,16 @@ public function __construct(
40
43
*/
41
44
public function afterGetTemplate (
42
45
AuthenticationPopup $ subject ,
43
- string $ result
46
+ ? string $ result
44
47
): 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 )) {
46
52
return '' ;
47
53
}
48
54
49
- return $ result ;
55
+ return $ result ?? '' ;
50
56
}
51
57
52
58
/**
You can’t perform that action at this time.
0 commit comments