You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Captcha feature enable/disable is ignored and captcha header is always sent
Tell us the version of Spartacus
2211.28 (also happens on latest)
To Reproduce
Implement captcha feature and make sure it is working
Disable the captcha in backoffice (Base Commerce -> Base Store -> [select basestore] -> Disable 'Captcha Widget Enabled' toggle
Register a new user in your app using Spartacus
Check 'users' HTML request. sap-commerce-cloud-captcha-token header is still present
Expected behavior
sap-commerce-cloud-captcha-token header should only be sent if the 'Captcha Widget Enabled' toggle is enabled.
Desktop:
OS: Windows 11
Browser Chrome 131.0.6778.86
Explanation and Solution
OccUserProfileAdapter.appendCaptchaToken() creates a const isCaptchaEnabled to decide if the header should be sent. isCaptchaEnabled is a Subscription and will always resolve as truthy:
protectedappendCaptchaToken(currentHeaders: HttpHeaders): HttpHeaders{if(this.injector&&this.captchaConfig?.captchaRenderer){constprovider=this.injector.get<CaptchaRenderer>(this.captchaConfig.captchaRenderer);constisCaptchaEnabled=provider.getCaptchaConfig().subscribe((config)=>{returnconfig.enabled;});if(provider?.getToken()&&isCaptchaEnabled){//isCaptchaEnabled is always truthyreturncurrentHeaders.append(USE_CAPTCHA_TOKEN,provider.getToken());}}returncurrentHeaders;}
The text was updated successfully, but these errors were encountered:
Describe the bug
Captcha feature enable/disable is ignored and captcha header is always sent
Tell us the version of Spartacus
2211.28 (also happens on latest)
To Reproduce
Expected behavior
sap-commerce-cloud-captcha-token header should only be sent if the 'Captcha Widget Enabled' toggle is enabled.
Desktop:
Explanation and Solution
OccUserProfileAdapter.appendCaptchaToken() creates a const isCaptchaEnabled to decide if the header should be sent. isCaptchaEnabled is a Subscription and will always resolve as truthy:
The text was updated successfully, but these errors were encountered: