banks/sprig-auth

if i login with username, rather then user object it doesn't work as expected

Closed this issue · 4 comments

in classes/auth/sprig.php

protected function _get_object($user)
{
    if ( ! is_object($user))
    {
        // Load the user using special factory method
        $user = Model_User::factory($user)->load();         
    }

    return $user;
}

I am thinking this line should be
$user = Model_User::factory('user')->load();

so that it references the user table, rather then the $user variable

Alex

had a more indepth look, didn't realise you are overriding the sprig factory method
sorry for the confusion

No worries, please re-open this if it really is causing a problem - I can't see how it would though.

the issue in the end was that the latest version of sprig has user model included, and that was overriding the sprig-auth user model, and methods like has_role were not working

Ah, perhaps it should be clearer in the docs that Sprig-Auth needs to be added to modules BEFORE Sprig and Auth so it can override classes.