authentication - Kohana Auth Custom Driver, model user? -
i have made custom driver 'auth_mydriver' extends auth
i looked here how to: http://kohanaframework.org/3.2/guide/auth/driver/develop
and did when using driver, grab/logins user "test_users
" instead of "users
"
now, when use custom driver "mydriver
" auth::instance()->get_user()
returns string username
.
when use default "orm
" auth driver , call auth::instance()->get_user()
returns whole object user data grabbed users table, able call e.g auth::instance()->get_user()->email
how can make custom driver work default orm auth driver, except should test_* tables instead (test_users, test_roles, test_roles_users)
i spent hours on trying find out, , think model user, need custom driver in order ?
hope thanks!
update:
my mydriver, has same method auth file driver
public function get_user($default = null) { return $this->_session->get($this->_config['session_key'], $default); }
finally:
i grabbed user database, turned object , send complete_login:
$user = db::select()->from($table_name) ->where('username', '=', $username) ->as_object()->execute()->current(); if(!empty($user)) { if($password == $user->password) { return $this->complete_login($user); } }
this :-)
Comments
Post a Comment