public $filters except login page |
I work with filter method for check admin users authentication like this:
PHP Code: class Filters extends BaseConfig public filter work for all admin uri (admin/roles - admin/users - admin/login) but i need to except admin/login because with this method i can not see login page and see browser error: Code: This page isn’t working right now how do fix this problem?! thanks
Yep, it's called "except": https://codeigniter4.github.io/userguide...ml#globals
You need to add condition inside AuthFilter, I do it like this
PHP Code: // get the current URL path, like "auth/login"
It's work fine with v4.0.4
My Default Controller is Login on global I add my authenticationfilter and add except for all Login controller 'login/*' and '/' public $aliases = [ 'csrf' => \CodeIgniter\Filters\CSRF::class, 'toolbar' => \CodeIgniter\Filters\DebugToolbar::class, 'honeypot' => \CodeIgniter\Filters\Honeypot::class, 'authenticationfilter' => \App\Filters\AuthenticationFilter::class, ]; // Always applied before every request public $globals = [ 'before' => [ 'authenticationfilter'=> ['except' => ['login/*', '/']], //'honeypot' // 'csrf', ], 'after' => [ 'toolbar', //'honeypot' ], ];
There are those who tell lies with meaning behind them and those meaning less lies!
|
Welcome Guest, Not a member yet? Register Sign In |