Go Back   vb.org Archive > vBulletin 5 Connect Discussion > vB5 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 09-17-2013, 12:12 AM
veena veena is offline
 
Join Date: Jun 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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
Reply With Quote
  #2  
Old 09-17-2013, 11:22 AM
marco_kellershoff's Avatar
marco_kellershoff marco_kellershoff is offline
 
Join Date: Sep 2013
Location: Cologne
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #3  
Old 09-17-2013, 05:54 PM
veena veena is offline
 
Join Date: Jun 2010
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:rocessNewLogin($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);
}
}
Reply With Quote
  #4  
Old 09-17-2013, 08:31 PM
marco_kellershoff's Avatar
marco_kellershoff marco_kellershoff is offline
 
Join Date: Sep 2013
Location: Cologne
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by veena View Post
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:rocessNewLogin($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
Reply With Quote
  #5  
Old 10-29-2014, 08:40 PM
psanchez psanchez is offline
 
Join Date: Sep 2012
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

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

Thanks!
Reply With Quote
  #6  
Old 02-15-2015, 11:21 PM
WeBBy WeBBy is offline
 
Join Date: Jun 2003
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:21 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.07393 seconds
  • Memory Usage 2,219KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete