Я пытаюсь написать cookie после входа в систему, но, похоже, ничего не сохраняется.
Я что-то не так делаю?
function login() {
if ($this->Session->read('Auth.User')) {
if($this->data['User']['remember']){
$cookie = array();
$cookie['username'] = $this->data['User']['email'];
$cookie['password'] = $this->data['User']['password'];
$this->Cookie->write('Auth.User', $cookie, true, '+2 weeks');
unset($this->data['User']['remember']);
}
$this->Session->setFlash('You are logged in!');
$this->redirect(array('action' => 'logs'));
} else {
$this->Session->setFlash('Invalid username and password combination');
$this->redirect('/', null, false);
}
}