1
我希望用戶在登錄後重定向到帖子索引操作。但他們改爲重定向到帖子的添加操作。下面 是我的routes.php文件登錄後重定向
Router::connect('/', array('controller' => 'posts', 'action' => 'index'));
/**
* ...and connect the rest of 'Pages' controller's urls.
*/
Router::connect('/pages/*', array('controller' => 'posts', 'action' => 'index'));
和用戶控制我的登錄操作是
public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash('Your username or password was incorrect.');
}
}
}
** ** DEBUG
當我做了登錄時的調試,我得到這個
/app/Controller/UsersController.php (line 20)
object(AuthComponent) {
components => array(
(int) 0 => 'Session',
(int) 1 => 'RequestHandler'
)
authenticate => array(
(int) 0 => 'Form'
)
authorize => array(
'Actions' => array(
'actionPath' => 'controllers'
)
)
ajaxLogin => null
flash => array(
'element' => 'default',
'key' => 'auth',
'params' => array()
)
loginAction => array(
'controller' => 'users',
'action' => 'login'
)
loginRedirect => array(
'controller' => 'posts',
'action' => 'add'
)
logoutRedirect => array(
'controller' => 'users',
'action' => 'login'
)
由於某種原因,它說
loginRedirect =>數組( '控制器'=> '信息', '動作'=> '添加' )
代替行動=>指數是unsing行動=>添加。這是什麼
您是否設置/覆蓋Auth組件的變量? – Ehtesham 2012-03-22 20:02:19