Captcha issue? Always invalid...

jhdesign 02 Sep, 2011
Testing a new form in CF4.

Captch ALWAYS returns error "You have entered a wrong verification code!"

Anyone come across this issue?

Jacob
GreyHead 03 Sep, 2011
Hi Jacob,

It looks to be working OK here.

Bob
Max_admin 09 Sep, 2011
Hi Jacob,

Try the reCaptcha, or are you using V4 Rc2.0 ?

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
critter42 18 Sep, 2011
I just upgraded to RC2.0 now and am experiencing the same issue. How could I downgrade to 1.9 until this bug is found?

Edited to note I am referring to the Load reCaptcha/Check reCaptcha actions
critter42 18 Sep, 2011
OK, so I saw Bob's note that one of the items were updating reCaptcha to handle the Google API, so I created new API keys and updated the Load reCaptcha/Check reCaptcha actions with the appropriate public or private key AND updated the API URLs in both locations, but the check is still failing.

I enabled Maximum error reporting, but there is no extra error info that indicates what might be failing.


Edit: found the fix for the missing formcheck_fix.css file, disregard this item if you saw the earlier edit.

Edit 2: There is extra error info, I had to fix an inherited CSS issue of my own doing to see it :
Notice: Constant RECAPTCHA_VERIFY_SERVER already defined in
/home/myusername/mydomain.com/administrator/components/com_chronoforms/form_actions/check_recaptcha/check_recaptcha.php on line 19

Notice: Constant RECAPTCHA_API_SERVER already defined in /home/myusername/mydomain.com/administrator/components/com_chronoforms/form_actions/load_recaptcha/load_recaptcha.php on line 20

Notice: Constant RECAPTCHA_API_SECURE_SERVER already defined in /home/myusername/mydomain.com/administrator/components/com_chronoforms/form_actions/load_recaptcha/load_recaptcha.php on line 21

And when I went back into the Load reCaptcha and Check reCaptcha action settings, they defaulted back to the recaptcha.net URL and what I think is your default Public/Private keys
GreyHead 19 Sep, 2011
Hi critter42,

I think that Max has updated the ReCaptcha URLs in RC2.0

From the errors here it looks as though you may have two ReCaptcha on the page. Here's a fix for the define errors.

Open administrator/components/com_chronoforms/form_actions/load_recaptcha/load_recaptcha.php and find these lines around line 20
		define('RECAPTCHA_API_SERVER', $params->get('api_server'));
		define('RECAPTCHA_API_SECURE_SERVER', $params->get('api_secure_server'));
and replace them with these lines
		if ( !defined('RECAPTCHA_API_SERVER') ) {
			define('RECAPTCHA_API_SERVER', $params->get('api_server'));
		}
		if ( !defined('RECAPTCHA_API_SECURE_SERVER') ) {
			define('RECAPTCHA_API_SECURE_SERVER', $params->get('api_secure_server'));
		}

and in administrator/components/com_chronoforms/form_actions/check_recaptcha/check_recaptcha.php find this line around line 19
		define('RECAPTCHA_VERIFY_SERVER', $params->get('verify_server'));
and replace it with these lines
		if ( !defined('RECAPTCHA_VERIFY_SERVER') ) {
			define('RECAPTCHA_VERIFY_SERVER', $params->get('verify_server'));
		}

Bob
critter42 19 Sep, 2011
I think there's something going on with the parameters being written to the database.
When I look in the jos_chronoforms_actions table, the parameters for the Load reCaptcha actions still show their initial values:

theme=red
lang=en
public_key=(removed for security)
api_server=http://api.recaptcha.net
api_secure_server=https://api-secure.recaptcha.net


Now I explicitly changed the server api URLs to the http(s)://www.google.com/recaptcha/api URLs in the action parameters via the CF4 Wizard Edit interface, but when I hit Apply, then Save and checked the database, those values did not show up - the record WAS updated, but the default values were either not overwritten, or were rewritten when the database save was made.
GreyHead 19 Sep, 2011
Hi critter42,

If you are using CFv4 RC2.0 then the default values are already set to the Google URLs and you shouldn't need to change them.

I have confirmed that if you change the APIs they are saved correctly.

What I suspect is happening here is that the defined terms that we are using (taken from the old ReCaptcha API examples) are being set somewhere else in the PHP in your page and are overwriting the values set by the action parameters.

The best answer to this would be to re-write the code so that it no longer uses the defined terms.

Bob
critter42 19 Sep, 2011
OK got it sorted.

What I actually had to do was edit the Check reCaptcha actions - I had entered the entire verify url - aka http://www.google.com/recaptcha/api/verify - in the URL parameter instead of just <!-- w --><a class="postlink" href="http://www.google.com">www.google.com</a><!-- w -->

In the Load reCaptcha actions, the entire URL is required.
fhenry 29 Dec, 2011
Hello all,
I set the the Check reCaptcha to http://www.google.com/recaptcha/api/verify. The plubic key and private key to my key provide by google in the event part, but I always get a wrong answer on the verification.
Did I miss something ?
I use the ChromoForm Chronoforms_V4_RC3.0_J1.6 (non validated for test purpose) on Joomla 1.7.
By the way, I also use Joo Recaptcha on contact form without problem with the private and public key without any problem.
Kind regards
GreyHead 29 Dec, 2011
Hi fhenry,

I just built a test form and the default settings work OK.

The Check Captcha should be www.google.com

The Load ReCaptcha should be http://www.google.com/recaptcha/api

Bob
fhenry 29 Dec, 2011
I found the problem, it's come from the Joo Recaptcha plugin that define the constant RECAPTCHA_VERIFY_SERVER to api-verify.recaptcha.net instead of http://www.google.com/.
I try to define it agin but it didn't work.

So the validation is not done on the good google URL.

Some var_dump says so :RECAPTCHA_VERIFY_SERVER:api-verify.recaptcha.netarray(0)
host:api-verify.recaptcha.net
path:/recaptcha/api/verify

404. That’s an error.

The requested URL /recaptcha/api/verify was not found on this server. That’s all we know. " }

I'll try to figure out how do it correctly, and I 'll post the solution here.
GreyHead 29 Dec, 2011
Hi fhenry,

You probably need to hack or upgrade the Joo ReCaptcha plug-in*. You can't redefine terms like this in PHP (once defined they are fixed). You should also upgrade ChronoForms to the new RC 3.0 as Max added some fixes to prevent ChronoForms causing errors by trying to redefine RECAPTCHA_VERIFY_SERVER

Bob

* I just checked the current version of Joo ReCaptcha and it's still using the old URLs. Open up plugins/joo_recaptcha/joo_recaptchalib.php and you'll see them around line 40.

It looks to me as though the plug-in is just a wrapper round the old ReCaptcha PHP library. You can get the current library on Google Code here
fhenry 29 Dec, 2011
I didn't see your previous answser before posting my previous post.
By the way I redefine new constant name only use by chronoform. But still it do not work.
I already use the RC3.
I download the API for PHP of google, and make a lot of try and diff between ChronoForm ReCaptcha file an google file but I didn't notice any différence.
The joo ReCaptcha on contact form work fine even if it use the old google validation URL. I'll try to hack it to make it up to date.
I'll continue to find out a solution, may be by sedactivate the Joo ReCaptcha plug'in, I'll let you know.
Thank for your help. Once this problem will be solve, I will donate for your product because it deserve it !
Thank again.
fhenry 29 Dec, 2011
Ok, When I inactivate the Joo Recaptcha plugin it works !!!
I have to found another one that do not interact badly with ChronoForm.
But I still do not understand why, I'm curious so I will continue to investigate.
If I found I'll let you know.
fhenry 29 Dec, 2011
I hack the plugins/joo_recaptcha/joo_recaptchalib.php to replace with the new google URL and on the contact form where this plugin is display it still work fine. But as soon as it's activate, I can't use the Chronoform ReCaptcha validation.
I continue my investigation. I don't understand why. The constant use to define google PI are unique to chronofrom, input field name (I change them in case of) too, I'll try to rename all Chronoform method to be sure that it's not another that joomla call. I'll tell you.
fhenry 03 Jan, 2012
Hello all. I found the why and the solution.
The plugin JOO Recapchta difine the event onAfterInitialise() and always proceed the JooReCaptcha::process() of his own process.
By the ways Joomla check the recaptcha one time first with this JooReCaptcha and after with the crhonofrom check. The second time the challange change, and so it expire...
the solution is to hack the file joo_recaptcha.php locate the function onAfterInitialise and test if it's a crhonoform action or not to process :

function onAfterInitialise()
	{
		if (JRequest::getCmd('option') != 'com_chronoforms')
		{
			JooReCaptcha::process();
		}
	}


Thank's for your answer, and I hope it will help other people with the same shit problem.

Kind regards
Max_admin 03 Jan, 2012
Thank you for sharing this!🙂

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
fhenry 03 Jan, 2012
And also add a hidden field at the end of your form field name=option value=com_chronoforms.

I find out that during testing. On Joomla 1.7 if you link a menu directly on the ChronoForm From display the URL is not the same than the "view form" during the config (Admin part).
The "view form" during the config (Admin part) send the option in query string, this is not the case with the link of the menu that is only the alias define in the menu.

Well, I still wonder if it a good idea to keep a plugin like Joo Recaptcha install that run a method to validate a Recaptacha after each onAfterInitialise() even if the loaded page is completly not related with that because this method is call on each page display...

I've got some question on Auto Javascript validation plugin, but I will first chek on the forum, and open a thread if I do not found.

Kind regards
Max_admin 13 Jan, 2012
Hi fhenry,

Well, I still wonder if it a good idea to keep a plugin like Joo Recaptcha install that run a method to validate a Recaptacha after each onAfterInitialise() even if the loaded page is completly not related with that because this method is call on each page display...



Of course not a good idea, but if they don't know at which page the reCaptcha will exist then there is no other way to do it, but if you don't have a reCaptcha which needs it then simply disable it.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.