dongzhuo6137 2012-12-22 09:23
浏览 59
已采纳

Joomla管理登录自定义错误

I'm using Google reCAPTCHA on joomla admini login section, Validation works fine.

Captcha validation added to 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);
 }

What should I use instead of //die('Incorrect Captcha...'); to output Invalid Captcha! Error in login page?

Error Sample Image

  • 写回答

2条回答 默认 最新

  • duanlei1957 2012-12-22 09:29
    关注

    Try this-

    $app = JFactory::getApplication();
    $app->enqueueMessage('Incorrect Captcha...', 'error');
    $app->redirect(JURI::base());
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 三菱FX系列PLC上位机串口下指令置位M64和M65,这两条指令分别是什么呢?
  • ¥15 有关结冰模拟程序咨询
  • ¥15 ubuntu服务器配置dns域名后无法访问其他域名
  • ¥50 本人复制了一个关于股票指标的代码,但是运行失败,有没有人帮我解决一下
  • ¥50 用matlab和numeca做透平机械流体力学和热力学模拟 价格可议
  • ¥15 Unity3D WebView
  • ¥20 论文AlphaTensor复现(有偿)
  • ¥15 (有偿)在ANSYS中 .anf文件
  • ¥45 关于#芯片#的问题:组合逻辑电路设计
  • ¥15 基与机器学习和时间序列分析预测养老服务需求趋势