reCAPTCHA integration problem

Elena Stefanova, modified 7 Years ago. Junior Member Posts: 42 Join Date: 8/24/15 Recent Posts

Hi, there!

I have an issue with non-working captcha input in my web form, which is a standard form created with the form builder app and reCAPTCHA enabled into form settings. I also activated reCAPTCHA into portal configurations under section Control Panel -> Configuration -> Sever administration -> CAPTCHA as I put valid keys too. However, on frontend it is not working for me as I constantly get the following error message in browser's console:

Refused to load the script 'https://www.gstatic.com/recaptcha/api2/v1528855115741/recaptcha__es.js' because it violates the following Content Security Policy directive: "script-src 'nonce-vYybKbwtEcEKeyqZn3vZTa+++5k' 'unsafe-inline' 'strict-dynamic' https: http: 'unsafe-eval'". 'strict-dynamic' is present, so host-based whitelisting is disabled.

I have two projects - one running on liferay-ce-portal-7.0-ga5 and another one running on the older liferay-portal-6.2-ce-ga4 version, but in both projects I face the same issue with reCAPTCHA integration.

Can you give me an idea how to solve this problem? Any help will be appreciated!

Thanks in advance,

Eli

thumbnail
Samuel Kong, modified 7 Years ago. Liferay Legend Posts: 1902 Join Date: 3/10/08 Recent Posts

As indicated by the error message, the captcha is not loading because of your Content Security Policy (CSP). CSP is something you added since this isn't an OOTB feature in the portal. You'll need to configure your CSP to allow the captcha to load.