CakePHP auth插件重定向问题
发布时间:2020-12-13 17:17:57 所属栏目:PHP教程 来源:网络整理
导读:我正在使用cakephp auth插件. 登录后发生的事情是什么. 通过在UsersController或AppController中的beforeFilter函数中定义loginAction变量来设置默认登录页面. 但是,如果您在应用程序中使用了插件,并且用户尝试访问插件的控制器操作,则会将用户重定向到这样
我正在使用cakephp auth插件.
登录后发生的事情是什么. 通过在UsersController或AppController中的beforeFilter函数中定义loginAction变量来设置默认登录页面. 但是,如果您在应用程序中使用了插件,并且用户尝试访问插件的控制器操作,则会将用户重定向到这样的无效页面. http://satyam.vakharia.com/plugin_name/users/login BeforeFilter功能就像这样.. function beforeFilter() { Security::setHash('md5'); $this->Auth->loginAction = array('controller' => 'users','action' => 'login'); $this->Auth->loginRedirect = array('controller' => 'home','action' => 'index'); $this->Auth->loginError = 'Invalid Username or Password.'; $this->Auth->authError = "You are not authorized to access."; $this->Auth->logoutRedirect = array('controller' => 'users','action' => 'login'); } 解决方法$this->Auth->loginAction = array('plugin' => false,'controller' => 'users','action' => 'login'); $this->Auth->loginRedirect = array('plugin' => false,'controller' => 'home','action' => 'index'); $this->Auth->loginError = 'Invalid Username or Password.'; $this->Auth->authError = "You are not authorized to access."; $this->Auth->logoutRedirect = array('plugin' => false,'action' => 'login'); 那里. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |