You did not pass the validation check used to prevent spam submissions


#1

In have enabled recaptcha from config.inc.php and getting this error “You did not pass the validation check used to prevent spam submissions.”

Please Guide …


#2

@asmecher
Please guide
I followed the settings suggested by Jurnal_agrouqa in How to enable reCAPTCHA V2?


#3

Hi @Haroon_Sattar,

What version of OJS are you using? (Please include this in your posts.)

Regards,
Alec Smecher
Public Knowledge Project Team


#4

Hi,
I have the same problem. OJS version is 3.1.1.4
In config.inc.php the option allow_url_fopen = On

Thank you
sds, Nicolás.


#5

Any help would be wellcome, configuration seems to be foolproof:

recaptcha = on
recaptcha_public_key = pubKeyFromWwwGoogleCom-recaptcha
recaptcha_private_key = privKeyFromWwwGoogleCom-recaptcha
captcha_on_register = on

but when I try to register, " You did not pass the validation check used to prevent spam submissions" error occurs.

I swear that I’m choosing only automobiles, or traffic signs as I’m asked to :stuck_out_tongue:

OJS is behind apache reverse-proxy, maybe some redirection is missing?

¿any log file I can read?

Saludos, Nicolás.


#6

You may find helpful information in your server’s PHP error log. Check with your system administrator or hosting provider regarding how to access the PHP error log.

If your reverse proxy configuration requires a proxy for your server to reach out to other internet sites over HTTP, you need to configure that here:


#7

Thanks for the answer.
I found in apache’s log PHP WARNINGS (last two warnings refer about recaptcha). I’ve changed my real OJS path to OJSPATH and my real site to mySite.edu for posting.

[from the last warning]
failed to open stream: No file or directory in FormValidatorReCaptcha.inc.php on line 85:

[FormValidatorReCaptcha.inc.php on line 85]
$response = file_get_contents(RECAPTCHA_HOST . RECAPTCHA_PATH, false, $requestContext);

[first lines of file FormValidatorReCaptcha.inc.php]
define(‘RECAPTCHA_RESPONSE_FIELD’, ‘g-recaptcha-response’);
define(‘RECAPTCHA_HOST’, ‘https://www.google.com’);
define(“RECAPTCHA_PATH”, “/recaptcha/api/siteverify”);

[Warnings in apache’s log]
PHP Warning: Declaration of AddThisPlugin::register($category, $path) should be compatible with LazyLoadPlugin::register($category, $path, $mainContextId = NULL) in /OJSPATH/plugins/generic/addThis/AddThisPlugin.inc.php on line 175, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: Declaration of CustomBlockPlugin::getBlockContext() should be compatible with BlockPlugin::getBlockContext($contextId = NULL) in /OJSPATH/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 134, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: Declaration of CustomBlockPlugin::getEnabled() should be compatible with BlockPlugin::getEnabled($contextId = NULL) in /OJSPATH/plugins/generic/customBlockManager/CustomBlockPlugin.inc.php on line 134, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: Declaration of RegistrationHandler::validate($request) should be compatible with PKPHandler::validate($requiredContexts = NULL, $request = NULL) in /OJSPATH/lib/pkp/pages/user/RegistrationHandler.inc.php on line 19, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: Declaration of RegistrationHandler::initialize($request, &$args) should be compatible with PKPHandler::initialize($request) in /OJSPATH/lib/pkp/pages/user/RegistrationHandler.inc.php on line 19, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: Declaration of RegistrationForm::initData($request) should be compatible with Form::initData() in /OJSPATH/lib/pkp/classes/user/form/RegistrationForm.inc.php on line 21, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: Declaration of RegistrationForm::validate() should be compatible with Form::validate($callHooks = true) in /OJSPATH/lib/pkp/classes/user/form/RegistrationForm.inc.php on line 21, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: Declaration of RegistrationForm::execute($request) should be compatible with Form::execute() in /OJSPATH/lib/pkp/classes/user/form/RegistrationForm.inc.php on line 21, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: file_get_contents(): Unable to find the wrapper "https" - did you forget to enable it when you configured PHP? in /OJSPATH/lib/pkp/classes/form/validation/FormValidatorReCaptcha.inc.php on line 85, referer: https://mySite.edu/index.php/index/user/register

PHP Warning: file_get_contents(https://www.google.com/recaptcha/api/siteverify): failed to open stream: No existe el fichero o el directorio in /OJSPATH/lib/pkp/classes/form/validation/FormValidatorReCaptcha.inc.php on line 85, referer: https://mySite.edu/index.php/index/user/register


#8

My server can reach out others internet sites without any restrictions, no proxy configuration is needed.
I’m using apache-reverse-proxy in order to define multiple VirtualHosts.


#9

The line with the error message is where OJS is trying to make an HTTP connection to https://www.google.com/recaptcha/api/siteverify. This appears to be failing.

If you server can successfully connect, it is possible that PHP is restricting remote fopen access. Check to see if your PHP install has the allow_url_fopen directive turned “off”.
http://php.net/manual/en/filesystem.configuration.php


#10

Testing connection from OJS server

wget https://www.google.com/recaptcha/api/siteverify
–2019-02-08 12:04:12-- https://www.google.com/recaptcha/api/siteverify
Resolviendo www.google.com (www.google.com)… 64.233.186.105, 64.233.186.106, 64.233.186.147, …
Conectando con www.google.com (www.google.com)[64.233.186.105]:443… conectado.
Petición HTTP enviada, esperando respuesta… 200 OK
Longitud: no especificado [application/json]
Grabando a: “siteverify”

siteverify [ <=> ] 103 --.-KB/s en 0s

2019-02-08 12:04:13 (8,59 MB/s) - “siteverify” guardado [103]


#11

I checked in /etc/php7/apache2/php.ini the option “allow_url_fopen = On” and in OJS’s config file is also On value… what else can I check


#12

Oops. I missed the actual error you referenced above:

PHP Warning: file_get_contents(): Unable to find the wrapper “https” - did you forget to enable it when you configured PHP


#13

Excelent!
I did’t know openssh module for PHP was requirement for enabling re-captcha!
unbelievable how installing one PHP module can make someone that happy! :slight_smile: :slight_smile:

thank you so much!
Saludos Nicolás.