03.24 php saved
nerdMX
Tags add more
auth  
Note
logout does not work
  1. public function login()
  2.  {
  3.     if ($this->Auth->user())
  4.     {
  5.             if (!empty($this->data))
  6.             {
  7.                 if (empty($this->data['User']['remember_me']))
  8.                 {
  9.                     $this->Cookie->del('User');
  10.                 }
  11.                 else
  12.                 {
  13.                     $cookie = array();
  14.                     $cookie['email'] = $this->data['User']['email'];
  15.                     $cookie['token'] = $this->data['User']['pasword'];
  16.                     $this->Cookie->write('User', $cookie, true, '+2 weeks');
  17.                 }
  18.                 unset($this->data['User']['remember_me']);
  19.             }
  20.  
  21.             $this->redirect($this->Auth->redirect());
  22.     }
  23.     else
  24.     {
  25.           $this->Portal->statics(); // Using Portal component
  26.  
  27.           $this->layout    = 'portal';
  28.        
  29.           $this->pageTitle = 'Login :: Karamelo E-learning';
  30.     }
  31.  }
  32.  
  33.  public function logout()
  34.  {
  35.    $this->Cookie->del('User');
  36.    
  37.    $this->Session->setFlash('Logout');
  38.    
  39.    $this->redirect($this->Auth->logout());
  40.  }
  41.  
Parsed in 0.065 seconds, using GeSHi 1.0.7.14

Modify this Paste