// AppController.php
public $components = array(
'Session',
'Auth' => array(
'authenticate' => array(
'Blowfish' => array(
'scope' => array('User.is_active' => true)
)
),
'loginRedirect' => array('controller' => 'pages', 'action' => 'home'),
'logoutRedirect' => array('controller' => 'pages', 'action' => 'home')
)
);
// UsersController.php
public function login() {
if($this->request->is('post')) {
if($this->Auth->login()) {
$this->redirect($this->Auth->redirect());
} else {
$this->Session->setFlash('Invalid username or password, try again.');
}
}
}