Hello everybody.
I have a third party application which does the authentication and wants to log the user into a locally installed vBulletin instance at the same time. The only way to log in is via this third party app. This is what I have where $vbpath is the path to the vBulletin installation and $username is the name of the user to log in:
at first sight it seems to work but I am wondering: is there anything else that needs to be done to properly log into vBulletin 5? I bypassed the API because it seemed the API requires the password and quickly becomes a mess if I store it in the third party app -- it needs to be encrypted using the third party password obviously and it's just a huge syncing mess which I didn't really need.
Thank you very much!
Author: du lich viet
I have a third party application which does the authentication and wants to log the user into a locally installed vBulletin instance at the same time. The only way to log in is via this third party app. This is what I have where $vbpath is the path to the vBulletin installation and $username is the name of the user to log in:
Code:
require_once($vbpath . '/includes/vb5/autoloader.php'); \vB5_Autoloader::register($vbpath); \vB5_Frontend_Application::init('config.php'); \vB::getDbAssertor()->delete('session', array('sessionhash' => \vB::getCurrentSession()->get('dbsessionhash'))); $username = \vB_String::htmlSpecialCharsUni($username); $userinfo = \vB::getDbAssertor()->getRow('user', array('username' => $username)); $auth = array_intersect_key($userinfo, array_flip(['userid', 'lastvisit', 'lastactivity'])); $loginInfo = \vB_User::processNewLogin($auth); \vB5_Auth::setLoginCookies($loginInfo);
Thank you very much!
Author: du lich viet
Comment