我检查了这个Cakephp cookie always get deleted automatically但是,没有去。这并不是我一直在寻找的。AutoLogin Cookie在浏览器退出时在CakePHP 2x中被删除
自动登录使用的cookie正在被删除。
这里是什么做的:
public function login() {
if ($this->Auth->user('id')) {
$this->redirect(array('action' => 'dashboard'));
}
if ($this->request->is('post')) {
if($this->request->data['User']['auto_login']):
$this->AutoLogin->write($this->request->data['User']['email'],
$this->request->data['User']['password']);
endif;
if ($this->Auth->login()) {
//$this->redirect(array('controller' => 'users', 'action' => 'edit'));
return $this->redirect($this->Auth->redirect());
}
else
{
$this->Session->setFlash(__('Username and Password is incorrect'), 'default', array(), 'auth');
}
}
else {
if($this->AutoLogin->read()):
$AllData = $this->AutoLogin->read();
$AllData['username'] = 'email';
$AllData['password'] = 'password';
$check = $this->User->find('first', array('username' => 'email', 'password' => 'password'));
if($check):
$this->Auth->user($check);
$this->Auth->redirect();
endif;
$this->redirect(array('action' => 'login'));
endif;
}
它设置的cookie,它每一个该死的东西!
但是,在浏览器退出时,它就消失了!是的,尝试了各种浏览器,并检查浏览器设置是否在做。
我AppController的是加载:
public $components = array('AutoLogin','Auth' => array('autoRedirect' => false), 'Cookie', 'RequestHandler', 'Session', 'Facebook.Connect' => array('model' => 'User'));//, //'DebugKit.Toolbar');
现在,这里是收集,当我检查了下,检查元素的资源,它让我看到两两件事:PHPSESSID和CakeCookie [自动登录],PHPSESSID - 类型会议并过期 - 空白。 CakeCookie类型是cookie,并在一个月后过期!因为它看起来像原生的PHP,我想过检查session_start()函数,我发现它!这是Facebook组件,但禁用它,确实阻止了PHPSESSID的到来,但仍然cookie会在浏览器退出时被删除。
请指教。
在此先感谢。
你在使用suhosin补丁吗? – Hoff
我查过了,不,我没有suhosin。 – Karma