• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Myth Auth LoginFilter Problem

#1
Does anyone here encountered this issue as mine?

PHP Code:
[b]Fatal error[/b]: Declaration of Myth\Auth\Filters\LoginFilter::before(CodeIgniter\HTTP\RequestInterface $requestmust be compatible with CodeIgniter\Filters\FilterInterface::before(CodeIgniter\HTTP\RequestInterface $request$arguments NULLin [b]/var/www/charlzsys/vendor/myth/auth/src/Filters/LoginFilter.php[/bon line [b]24[/b

app/config/Routes.php
PHP Code:
$routes->group('', ['filter' => 'login'], function($routes) {
    
$routes->get('/''Home::index');
    
$routes->get('home''Home::index');
    
    
$routes->get('/test''Home::test');
}); 

app/config/Filters.php
PHP Code:
<?php namespace Config;

use 
CodeIgniter\Config\BaseConfig;

class 
Filters extends BaseConfig
{
    
// Makes reading things below nicer,
    // and simpler to change out script that's used.
    
public $aliases = [
        
'csrf'     => \CodeIgniter\Filters\CSRF::class,
        
'toolbar'  => \CodeIgniter\Filters\DebugToolbar::class,
        
'honeypot' => \CodeIgniter\Filters\Honeypot::class,
        
'login'      => \Myth\Auth\Filters\LoginFilter::class,
        'role'       => \Myth\Auth\Filters\RoleFilter::class,
        'permission' => \Myth\Auth\Filters\PermissionFilter::class,
    ];

    
// Always applied before every request
    
public $globals = [
        
'before' => [
            
//'honeypot',
            // 'csrf',
            //'auth',
        
],
        
'after'  => [
            
'toolbar',
            
//'honeypot'
        
],
    ];

    
// Works on all of a particular HTTP method
    // (GET, POST, etc) as BEFORE filters only
    //     like: 'post' => ['CSRF', 'throttle'],
    
public $methods = [];

    
// List filter aliases and any before/after uri patterns
    // that they should run on, like:
    //    'isLoggedIn' => ['before' => ['account/*', 'profiles/*']],
    
public $filters = [];



Attached Files Thumbnail(s)
   
Reply

#2
Did you download the newest Myth/Auth and CodeIgniter both have been updated.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#3
(09-13-2020, 08:19 AM)InsiteFX Wrote: Did you download the newest Myth/Auth and CodeIgniter both have been updated.

Yes both are updated with latest builds.
Reply

#4
Did you add all the settings to the files?

Restrict routes based on their URI pattern by editing app/Config/Filters.php and adding them to the $filters array, e.g.:

PHP Code:
public filters = [
    'login' => ['before' => ['account/*']],
]; 

Or restrict your entire site by adding the LoginFilter to the $globals array:

PHP Code:
    public $globals = [
        'before' => [
            'honeypot',
            'login'

Restricting a single route

Any single route can be restricted by adding the filter option to the last parameter in any of the route definition methods:


PHP Code:
$routes->get('admin/users''UserController::index', ['filter' => 'permission:manage-user'])
$routes->get('admin/users''UserController::index', ['filter' => 'role:admin,superadmin']) 

The filter can be either role or permission, which restricts the route by either group or permission.
You must add a comma-separated list of groups or permissions to check the logged in user against.

Restricting Route Groups

In the same way, entire groups of routes can be restricted within the group() method:


PHP Code:
$routes->group('admin', ['filter' => 'role:admin,superadmin'], function($routes) {
    ...
}); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
Yes i did it already, and it is now working. Though i have a new issue on it. Whenever i logged with my username and password, the auth is not working, i have checked the database auth_login table and it was successfully logged in but upon checking on the CI dev toolbar the Auth says ¨Not logged in¨ and i cannot push through to the index page.
Reply

#6
Check you session data to see what it says you could be over write or clearing it some place.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#7
Here is what i see on my session data:

Session User Data
__ci_last_regenerate 1600175570
redirect_url http://192.168.254.202:83/login
_ci_previous_url http://192.168.254.202:83/login
Reply

#8
That's strange because I'' am using it on my blog login and it redirects me to login then to my front page.

But I have mine on the route not the group route.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#9
Yeah it is really strange for me also, i tried to reinstall from scratch both CI 4.0.4 and myth-auth and still it is not working. here's the screen record of mine: https://drive.google.com/file/d/1foGzlnm...b9705/view
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.