vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=302367

VB 5.0 login via API - process_new_login not working after upgrade to VB 5.0
by veena
17 Sep 2013 02:12

We have integrated our plugin with VB 5.0. When a user registers to our site, we are able to automatically create a VB account for the user and add user to the right forum group etc.

But when a user logs in to our site, the auto-login (single-sign-on) to VB 5.0 is NOT working.
It used to work really well in VB 4.x.

We make a call to setcookie to set the 'userid' and 'password' and then call the VB API to autologin:

process_new_login('', false, '');

Looks like VB 5.0 has removed support for this API.

Need help with the single-login integration between our plugin (written in php) and VBulletin 5.0.
Has anyone here experienced a similar problem? Any solution for this?

Thanks,
Veena Prashanth

marco_kellershoff 17 Sep 2013 13:22

Things changed a bit I guess - but I'm pretty new to all this stuff:

Here is that the user class of the VB API does:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

I guess you could write an extension that extends the user class.

veena 17 Sep 2013 19:54

Thanks Marco.

Can't believe this has been made so overly complicated with no documentation on the changes between the VB versions for login.

Isn't login a basic function that 3rd party plugins that want to integrate with VB will need?
I am surprised that it is so hard to get login integration done.

Anyway, i figured out how to do it. It is working now.

Wrote my own class that sets these cookies:

vbsetcookie(COOKIE_PREFIX . 'userid', $res['userid'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'password', $res['password'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'sessionhash', $res['sessionhash'], false, false, true);

Before call vbsetcookie, need to call :

$auth = vB_User::verifyAuthentication($username, $password, null, null);
if($auth) {
$res = vB_User::processNewLogin($auth, $vbulletin->GPC['logintype'], $vbulletin->GPC['cssprefs']);
if($res) {
vbsetcookie(COOKIE_PREFIX . 'userid', $res['userid'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'password', $res['password'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'sessionhash', $res['sessionhash'], false, false, true);
}
}

marco_kellershoff 17 Sep 2013 22:31

Quote:

Originally Posted by veena (Post 2446269)
Thanks Marco.

Can't believe this has been made so overly complicated with no documentation on the changes between the VB versions for login.

Isn't login a basic function that 3rd party plugins that want to integrate with VB will need?
I am surprised that it is so hard to get login integration done.

Anyway, i figured out how to do it. It is working now.

Wrote my own class that sets these cookies:

vbsetcookie(COOKIE_PREFIX . 'userid', $res['userid'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'password', $res['password'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'sessionhash', $res['sessionhash'], false, false, true);

Before call vbsetcookie, need to call :

$auth = vB_User::verifyAuthentication($username, $password, null, null);
if($auth) {
$res = vB_User::processNewLogin($auth, $vbulletin->GPC['logintype'], $vbulletin->GPC['cssprefs']);
if($res) {
vbsetcookie(COOKIE_PREFIX . 'userid', $res['userid'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'password', $res['password'], false, true, true);
vbsetcookie(COOKIE_PREFIX . 'sessionhash', $res['sessionhash'], false, false, true);
}
}

Some things are documented, but not very well. And most of the docs are not easily to be found.. I googled my a** off to find out some basic stuff :/

Anyway glad you made it :)

psanchez 29 Oct 2014 22:40

Hi,

I'm trying to implement something similar. Can you share how you were able to do this further?

Thanks!

WeBBy 16 Feb 2015 01:21

If you have this working (auto-login) in vb 5.x would really appreciate some additional info as I am pulling my hair out to gety an auto-login working
Thanx


All times are GMT. The time now is 15:47.

Powered by vBulletin® Version 3.8.14
Copyright © 2020, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.