15
Oct
2009
CakePHP Auth Component Problem

I’ve been using CakePHP for my last few projects and recently ran into a problem that was driving me nuts. I have a few pages that don’t require any authentication. You can allow pages to be viewed by calling $this->Auth->allow(‘function_name’) in your beforeFilter() method. So, I set up my app_controller class with a before filter that looks something like this.
< ?php
class AppController extends Controller {
var $helpers = array('Html', 'Form', 'Javascript');
var $components = array('Auth');
function beforeFilter() {
$this->Auth->autoRedirect = false;
$this->Auth->loginAction = array('controller' => 'users', 'action' => 'login');
$this->Auth->allow('display');
}
}
?>
