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