Ponemos las siguientes funciones en el UsuariosController:
public function login() {
if ($this->request->is('post')) {
$passwordHasher = new BlowfishPasswordHasher();
if ($this->Auth->login()) {
return $this->redirect($this->Auth->redirectUrl());
}
$this->Session->setFlash(__('Invalid username or password, try again'));
}
}
public function logout() {
return $this->redirect($this->Auth->logout());
}