Go Back   vb.org Archive > vBulletin 4 Discussion > vB4 Programming Discussions
  #1  
Old 07-02-2011, 11:33 PM
transparentb transparentb is offline
 
Join Date: Jun 2011
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default vB login/bridge question

I am trying to integrate vBulletin's login with our CMS login. In the login extension I am trying to get it to mimic the functionality as if you clicked the 'Remember Me' checkbox when logging onto vb's login page.

I am setting the cookies that vb uses and have verified that my cookies look exactly like the cookies that vb generated. But for some reason, vbulletin logs out all of our users based on the session expiration timing. I have looked at the data being inserted into the session table and mine matches what is insert by vb.

I am at a complete loss as to why this isn't working and vb won't leave our users logged in. Any insight would be fantastic. Thanks in advance for your help.

In case it helps, cookie calls:

Code:
setcookie($cookie_prefix.'sessionhash', $now, 0, "/", $base_forum_url, 0, true);
   setcookie($cookie_prefix.'userid', $userid, time()+60*60*24*365, "/", $base_forum_url, 0, true);
   setcookie($cookie_prefix.'lastvisit', $timenow, time()+60*60*24*365, "/", $base_forum_url, 0, false);
   setcookie($cookie_prefix.'lastactivity', 0, time()+60*60*24*365, "/", $base_forum_url,0, false);
   setcookie($cookie_prefix.'password', $password, time()+60*60*24*365, "/", $base_forum_url, 0, true);
$base_forum_url = .ourwebsite.com
Reply With Quote
  #2  
Old 07-02-2011, 11:48 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Someone asked a similar question recently and it turned out to be the cookie path setting in the vb admin CP. It needs to be set to '/' or else it won't get the cookies. (Not sure if you're having the same problem because IIRC that problem was with people being logged out immediately).
Reply With Quote
  #3  
Old 07-03-2011, 12:10 AM
transparentb transparentb is offline
 
Join Date: Jun 2011
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
Someone asked a similar question recently and it turned out to be the cookie path setting in the vb admin CP. It needs to be set to '/' or else it won't get the cookies. (Not sure if you're having the same problem because IIRC that problem was with people being logged out immediately).
We're setting / as the path when creating the cookies and the vB admin matches it. I think that's all fine. Thank you for replying.
Reply With Quote
  #4  
Old 07-03-2011, 12:31 AM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The only other thing I can think of when looking at the session code is that because of this line:

Code:
if (md5($userinfo['password'] . COOKIE_SALT) == $password)
{

it looks like the password you set in the cookie needs to be md5($password . COOKIE_SALT)

(sorry if you've already done that - after this I'm done )
Reply With Quote
  #5  
Old 07-03-2011, 07:10 AM
transparentb transparentb is offline
 
Join Date: Jun 2011
Posts: 17
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by kh99 View Post
The only other thing I can think of when looking at the session code is that because of this line:

Code:
if (md5($userinfo['password'] . COOKIE_SALT) == $password)
{

it looks like the password you set in the cookie needs to be md5($password . COOKIE_SALT)

(sorry if you've already done that - after this I'm done )
That got us in the right direction actually. It was already setup like that but from 4.0 > 4.1.4 they md5 3 deep instead of 2 I believe so had to make the changes.

Final issue is that logging into the admincp goes into an infinite loop. Once again seems to be some kind of cookie problem. Blah.

Thanks for your input so far kh, you rock.
Reply With Quote
  #6  
Old 08-04-2011, 03:23 PM
35mm 35mm is offline
 
Join Date: Jul 2010
Posts: 18
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by transparentb View Post
...from 4.0 > 4.1.4 they md5 3 deep instead of 2 I believe so had to make the changes.
What changes? Can you show us an example? I'm trying to auto login to vb from my site's login system too. Having trouble generating the bb_password - how does the hashing & salting go?

--------------- Added [DATE]1312475427[/DATE] at [TIME]1312475427[/TIME] ---------------

No worries. Just got it working - I had got my variables confused lol. I'm not having any problems logging into admin panel though.
Reply With Quote
  #7  
Old 08-06-2011, 03:21 AM
dog199200's Avatar
dog199200 dog199200 is offline
 
Join Date: Sep 2010
Location: Missouri
Posts: 40
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What CMS are you using? Is it custom made, or by a company? The reason I ask, is if it's custom made, then it would almost just be easier to use integrate the vb systems into it directly. This will allow you to use the same cookie for everything, which would just be the cookie vb set itself.

I don't mess around with the Remember Me settings, but i just used something like:

Code:
<form action="*forum_url*/login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<script type="text/javascript" src="*forum_url*/clientscript/vbulletin_md5.js"></script>

<label for="user">Username:</label><br />
<input name="vb_login_username" size="15" accesskey="u" type="text" /><br />
<label for="pass">Password:</label><br /> 
<input name="vb_login_password" type="password" size="15" /><br />

<input name="s" value="" type="hidden">
<input name="do" value="login" type="hidden"> 
<input name="vb_login_md5password" type="hidden">
<input name="vb_login_md5password_utf" type="hidden">

<input type="image" src="http://www.divineshadowsonline.com/images/login.png" accesskey="s" alt="Login">
</form>
All you have to do is find the field value for the Remember Me, and vB's internal settings should do the rest
Reply With Quote
Reply

Thread Tools
Display Modes

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 08:49 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.04050 seconds
  • Memory Usage 2,216KB
  • 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
  • (4)bbcode_code
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (7)post_thanks_box
  • (7)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (7)post_thanks_postbit_info
  • (7)postbit
  • (7)postbit_onlinestatus
  • (7)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