CakePhp Can´t Redirect beforeFilter

41 Views Asked by At

I am making a website with a backoffice login and register page. I am using UsersController and PostsController and I can´t access my main page website because it redirects me to my login page. I made a before filter and placed in UsersController:

use Cake\Event\Event;

public function beforeFilter(Event $event){
            $this->Auth->allow(['register', 'home']);
        }
1

There are 1 best solutions below

0
Pradeep Singh On BEST ANSWER

Add this in PostsController.php

public function beforeFilter(Event $event){
    $this->Auth->allow(['home']);
}