I have a problem showing static pages to non-authenticated users in my app.
I'm using cake 2.1 and my AppController.php is like this:
App::uses('Controller','Controller');
class AppController extends Controller {
public $components = array(
'Session',
'Auth' => array(
'loginRedirect' => array('controller' => 'users', 'action' => 'index'),
'logoutRedirect' => array('controller' => 'users', 'action' => 'login')
)
);
public function beforeFilter() {
$this->Auth->allow('display');
}
}
Please help me. Thanks!
You are close, but the display action is not part of the AppController. It belongs to the PagesControllerinstead.
Try adding this logic to the PagesController located under app/Controllers/PagesController.php. That should do the trick.
You need to do this in PagesController
public function beforeFilter() {
parent::beforeFilter();
$this->Auth->allow('display');
}
At least it worked for me. Hope it helps someone else.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With