Hello,
I just installed sfReCahptcha plugin. To improve error messages, I propose to modify to sfReCaptchaValidator.class.php this way:
// if invalid, return the error
if (!$resp->is_valid)
{
$msg_key = 'app_recaptcha_'.$resp->error;
$error = sfConfig::get($msg_key,$resp->error);
return false;
}
In app.yml (or in any other config file appended to the plugin) I put an explicit error message according to the code sent by reCaptcha API. This is an example:
all:
recaptcha:
publickey: "my_public_code"
privatekey: "my_private_code"
invalid-site-public-key: "The public key defined in app_recaptcha_publickey is wrong or not defined."
invalid-site-private-key: "The private key defined in app_recaptcha_privatekey is wrong or not defined."
invalid-request-cookie: "The challenge parameter of the verify script was incorrect."
incorrect-captcha-sol: "The CAPTCHA solution was incorrect."
verify-params-incorrect: "The parameters to /verify were incorrect, make sure you are passing all the required parameters."
invalid-referrer: "reCAPTCHA API keys are tied to a specific domain name for security reasons."
recaptcha-not-reachable": "reCAPTCHA never returns this error code. A plugin should manually return this code in the unlikely event that it is unable to contact the reCAPTCHA verify server."
If the error key cannot be found on app.yml, $resp->error is sent to the template.