
Untitled
By: a guest on
Aug 9th, 2012 | syntax:
None | size: 0.95 KB | hits: 8 | expires: Never
function beforeFilter(){
$this->Cookie->name = 'Snowbird';
$this->Cookie->time = 3600*24*3; // 3 jours
$this->Cookie->path = '/';
$this->Cookie->domain = $_SERVER['SERVER_NAME'];
$this->Cookie->secure = false;
$this->Auth->loginAction = array('controller'=>'users','action'=>'login');
$this->Auth->fields = array('username' => 'login','password' => 'pass');
$this->Auth->autoRedirect = false;
$this->Auth->allow();
if (!$this->Auth->user('id_membre') && $this->Cookie->read("User")) {
if ($this->Auth->login(array("User" => $this->Cookie->read("User")))) {
$this->Cookie->write(array("User" => $this->Cookie->read("User")), null, true, "3 days");
} else {
$this->Cookie->delete('User');
}
}
if ($this->RequestHandler->isAjax()){
$this->layout = null;
}
}