管理者/ユーザーのログインにCakePHP1.3の最新バージョンを使用しています。
Authを使用してログインしようとすると、最初の試行では情報が表示されませんSESSION
が、ページを再度更新すると、すべての情報がSessionに送信されるという非常に奇妙な問題に直面しています。
何かアイデア、なぜこれが起こったのですか?
コードはapp_controller.php
ファイルからここにあります
function beforeFilter()
{
$this->Auth->autoRedirect = false;
$this->Auth->fields = array('username' => 'email_address', 'password' => 'password');
$this->Auth->loginAction = array('admin' => false, 'controller' => 'users', 'action' => 'login');
$this->Auth->userScope = array('User.status' => '1','User.paymentstatus' => '0');
if($this->Auth->User())
{
if($this->Session->read('Auth.User.user_type') == 3) {
$this->layout = 'admin';
$this->Auth->loginRedirect = array('controller' => 'admins', 'action' => 'welcome');
}
else
{
$this->Auth->loginRedirect = array('controller' => 'pages', 'action' => 'display', 'home');
}
}
}
function beforeRender(){
$this->set('auth', $this->Auth->user());
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); // // HTTP/1.1
header("Pragma: no-cache");
header("Expires: Mon, 17 Dec 2007 00:00:00 GMT"); // Date in the past
}
早めの対応をお願いします。
ありがとう !