Welcome Guest, Not a member yet? Register   Sign In
Filter config not working with routes (?)
#1

Basically, I have a filter called "sessionCheckGloba", which deals with making sure that a user is logged in prior to accessing a webpage. The config for this filter is the following:

PHP Code:
public $globals = [
    
'before' => [
        
'sessioncheckGlobal' => ['except' => ['maintenance''browseroutofdate''login''logout''website']],
    ]
]; 


Where 'website' is in the exception list, it doesn't work.
Neither does '' (a blank element) or '/' (which stops the filter running at all).


So I guess the first question is, how do you make a filter not run on the main page where the main page is configured as the default controller?

In our case, the default controller is app/Controllers/Website/Website.php and the App is configured to route in this way:

Code:
$routes->get('/', 'Website/Website::index');

Second question, why does the following config make logincheck run on /admin/login ?

Code:
public $filters = [
    'loginfilter' => ['before' => ['login']],
];

In case, some more routes:

Code:
$routes->get('/login', 'Dashboard/Login::index');
$routes->get('/admin/login', 'Admin/Login::index');

My friend has created a similar question on GitHub but I feel like a lot of people use the forums and not GitHub.

Thanks.
Reply


Messages In This Thread
Filter config not working with routes (?) - by Smil3y - 06-03-2019, 06:48 PM



Theme © iAndrew 2016 - Forum software by © MyBB