Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Feb 4th, 2013  |  syntax: None  |  size: 0.70 KB  |  views: 50  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // AppController.php
  2. public $components = array(
  3.     'Session',
  4.     'Auth' => array(
  5.         'authenticate' => array(
  6.             'Blowfish' => array(
  7.                 'scope' => array('User.is_active' => true)
  8.             )
  9.         ),
  10.         'loginRedirect' => array('controller' => 'pages', 'action' => 'home'),
  11.         'logoutRedirect' => array('controller' => 'pages', 'action' => 'home')
  12.      )
  13. );
  14.  
  15. // UsersController.php
  16. public function login() {
  17.     if($this->request->is('post')) {
  18.         if($this->Auth->login()) {
  19.             $this->redirect($this->Auth->redirect());
  20.         } else {
  21.             $this->Session->setFlash('Invalid username or password, try again.');
  22.         }
  23.     }
  24. }
clone this paste RAW Paste Data