1
votes

I've taken a reCaptcha plugin from this guy (github link of the plugin)

I've entered the following code form in my view:

[form creation]
[table]
[inputs]
[/table]
echo $this->Recaptcha->show(array('theme' => 'white'));
echo $this->Recaptcha->error();  

[/form] 

I've followed the steps suggested, and the reCaptcha window appears properly, but no matter what I enter in the captcha, it never gets verified and I always receive the 'message' field of beforeValidate (I've set it to "You've entered a wrong message" etc).

I'm not even sure how to debug it to see at which point it fails. Even if I just replace all the code in checkRecaptcha function with "return true" to try and skip the validation with the keys and just see if the rule itself is correct, it still remains the same, and I'm generally not getting any of the specific incorrect-captcha-sol messages that I read around.

Am I correct to assume that the only code I need inside my controller function (assuming I've already included the component and helper in the controller) is Configure::load('Recaptcha.key'); and no further manual validation checks?

(unfortunately I can't link you my whole project due to rights)

1
I do not know this guys code but you can try ours: github.com/cakedc/recaptcha/tree/2.0floriank

1 Answers

2
votes

I had a similar issue. Try removing the 2 response and challenge field lines in the component and overwrite them with these:

$controller->$modelClass->set('recaptcha_response_field',  
$controller->request->data['recaptcha_response_field']);  
$controller->$modelClass->set('recaptcha_challenge_field',  
$controller->request->data['recaptcha_challenge_field']);