我在 joomla admini 登录部分使用 Google reCAPTCHA,验证工作正常。
验证码添加到administrator/components/com_login/models/login.php
$privatekey = "myprivatekey";
$resp = recaptcha_check_answer (
$privatekey,
$_SERVER["REMOTE_ADDR"],
JRequest::getVar('recaptcha_challenge_field', '', 'method', 'recaptcha_challenge_field'),
JRequest::getVar('recaptcha_response_field', '', 'method', 'recaptcha_response_field')
);
if (!$resp->is_valid) {
//die('Incorrect Captcha...');
}else{
$credentials = array(
'username' => JRequest::getVar('username', '', 'method', 'username'),
'password' => JRequest::getVar('passwd', '', 'post', 'string', JREQUEST_ALLOWRAW)
);
$this->setState('credentials', $credentials);
}
我应该使用什么来代替//die('Incorrect Captcha...');
输出Invalid Captcha!登录页面出错?