我在我的应用程序中使用ACL。我已经在我的AppController中的beforeFilter中定义了我的loginAction,但它仍然没有重定向到正确的位置。当用户访问应用程序就像这是我想要做的是 - 本地主机/ IntraWeb的,必须重定向然后到localhost/IntraWeb的/用户/登录在Cakephp中使用Acl时,LoginAction不起作用
这里是我的AppController代码
class AppController extends Controller {
public $helpers = array('Html', 'Form', 'CustomFields.Field');
public $components = array(
'CustomFields.Field',
'Acl',
'Auth' => array(
'authorize' => array(
'Actions' => array('actionPath' => 'controllers')
)
),
'Session',
'Cookie',
);
public $uses = array('User');
public function beforeFilter() {
//Configure AuthComponent
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'login');
$this->Auth->allow('display');
//OTHER CODE
}
和这里我的PagesController代码
class PagesController extends AppController {
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow();
}
//Other code
有没有人有一个想法,为什么它不重定向到用户/登录页面?
预先感谢您
我想我错过了这里的一些小东西。我编辑了我的代码,甚至删除了$ this-> Auth-> allow('display'); 。但仍然不想将我重定向到登录页面。任何想法可能会导致这一点? – 2013-03-12 17:26:52
你有BeforeFilter()在PagesController中定义? – 2013-03-12 17:28:13
是的,我在我的PagesController中有一个beforeFilter()。我现在删除了作品。谢谢 – 2013-03-12 20:04:49