public function login() {
if ($this->request->is('post')) {
if ($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
}
這是我的登錄腳本和登錄CakePHP中沒有重定向
public $components = array('Acl', 'Session',
'Auth' => array('authorize' => array('Controller'),
'loginRedirect' => array('controller' => 'users', 'action' => 'dashboard'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login'),
'authenticate' => array('Form' => array('fields' => array('username' => 'email')))
)
);
這是權威性compnents appcontroller.php
它登錄使用電子郵件和密碼,但它不是重定向到用戶/儀表板
但是,而不是如果我把任何外部URL它完全重定向
eg: 'loginRedirect' => 'http://google.com',
它重定向至Google,
我完全lost.kindly幫助
如果您最有可能檢查您重定向到loginRedirect,然後立即重定向回登錄屏幕(爲什麼,是爲了找出 - 這是某種應用程序錯誤)。 – AD7six
@ AD7six:下面的答案固定它。感謝您的寶貴時間 – zamil