For now I had to manipulate the sessions to make sure the first value
is used and not over written.

/**
 * Validate recaptcha
 * @param array $data
 * @return boolean
 */
function recaptcha($data) {
        App::import('Vendor', 'recaptcha', array('file' => 'recaptcha.php'));
        App::import('Component', 'Session');

        $Session = new SessionComponent();
        $private = Configure::read('Settings.captcha_private');
        $public = Configure::read('Settings.captcha_public');

        $verify = recaptcha_check_answer($private, env('REMOTE_ADDR'), $this-
>data[$this->name]['recaptcha_challenge'], $this->data[$this->name]
['recaptcha']);

        if ($Session->read('Recaptcha.time') == time()) {
                $response = $Session->read('Recaptcha.response');
        } else {
                $response = ($verify->is_valid) ? 'pass' : 'fail';
                $Session->write('Recaptcha.response', $response);
                $Session->write('Recaptcha.time', time());
        }

        return ($response == 'pass') ? true : false;
}

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to