doulu6929 2018-10-15 08:49
浏览 63

Captcha与Yii1.1中Controller中的accessControl冲突

Firstly when I use the accessControl filter in my controller ,captcha in login page is not displaying and here goes my code in controller

public function actions()
    {
        return array(
                // captcha action renders the CAPTCHA image displayed on the contact page
                'captcha'=>array(
                        'class'=>'CCaptchaAction',
                        'backColor'=>0xF8F8F8,
                        'foreColor'=>0x000000,
                ),
                // page action renders "static" pages stored under 'protected/views/site/pages'
                // They can be accessed via: index.php?r=site/page&view=FileName
                'page'=>array(
                        'class'=>'CViewAction',
                ),
        );
    }
    public function filters()
    {
        return array(
            'accessControl', // perform access control for CRUD operations
            //  'postOnly + delete', // we only allow deletion via POST request

        );

    }
    public function accessRules()
        {
            return array(
                    array('allow',  // allow all users to perform 'index' and 'view' actions
                            'actions'=>array('actions'),
                            'users'=>array('*'),
                    ),
array('allow',  // allow all users to perform 'index' and 'view' actions
                        'actions'=>array('index','captcha',),
    'users'=>array('*'),
)
)

              }

here is my code in view

$this->widget('CCaptcha', array( 'showRefreshButton'=>true,'buttonOptions'=>array('id'=>'refreshCaptcha','title'=>'Get a new code') ));

For me login screen is in view index.php and the captcha I have pasted is from the index.php and still nothing works out well Where did I make mistake.Please suggest me the right way to sort out this issue of conflicting captcha with accessControl . Thanks in advance

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 vue3中融入gRPC-web
    • ¥15 kali环境运行volatility分析android内存文件,缺profile
    • ¥15 写uniapp时遇到的问题
    • ¥15 vs 2008 安装遇到问题
    • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
    • ¥15 找一个网络防御专家,外包的
    • ¥100 能不能让两张不同的图片md5值一样,(有尝)
    • ¥15 informer代码训练自己的数据集,改参数怎么改
    • ¥15 请看一下,学校实验要求,我需要具体代码
    • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题