vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB5 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=263)
-   -   VB 5.0 login via API - process_new_login not working after upgrade to VB 5.0 (https://vborg.vbsupport.ru/showthread.php?t=302367)

veena 09-17-2013 12:12 AM

VB 5.0 login via API - process_new_login not working after upgrade to VB 5.0
 
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 09-17-2013 11:22 AM

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:

PHP Code:

$auth vB_User::verifyAuthentication($username$password$md5password$md5passwordutf);

if ( !
$auth ) {
    
error_log('no valid creds');
}
else {
    
$res vB_User::processNewLogin($auth$logintype);


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

veena 09-17-2013 05:54 PM

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 09-17-2013 08:31 PM

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 10-29-2014 08:40 PM

Hi,

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

Thanks!

WeBBy 02-15-2015 11:21 PM

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 01:48 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01207 seconds
  • Memory Usage 1,730KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete