Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
  #1  
Old 06-04-2006, 03:42 PM
LunchBreak LunchBreak is offline
 
Join Date: Mar 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Echo ing $vbulletin->GPC['vb_login_username']

Hi,

Just wanted to ask a silly question, but not a stupid one of course. "The question that is not asked is the most stupid one".

I am writing a plugins for login integration with vBulletin. For this purpose, I need to do the following.
1) vBulletin tries to login and fails
2) vBulletin fails and tries to check the username and password in my webservice.
3) if vBulletin finds the username and password in my webservice, it creates a new user in vBulletin and logs him.
Upto this stage everything is working fine!

However, when the user tries to login manually later on, he is not authorised. I believe I have traced where the problem is. When I add the user, I do a datamanager setup.

1. $newuser =& datamanager_init('User', $vbulletin, ERRTYPE_ARRAY);
2. $newuser->set('username', $vbulletin->GPC['vb_login_username']);
3. $newuser->set('password', $vbulletin->GPC['vb_login_password']);

Line 3 is not working. I believe $vbulletin->GPC['vb_login_password']) does not carry the actual password value. However, $vbulletin->GPC['vb_login_username']) does carry the username value.

Question:
How can I get the exact password value that was entered in navbar login form? I would like to apply that value in login_failure hook.

Cheers.
Reply With Quote
  #2  
Old 06-04-2006, 04:03 PM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

The raw password isn't actually sent to the form. Upon submitting, it takes the password field, and puts the md5 hash of it into a hidden field ('vb_login_md5_password') and clears the password field.

Take the hashed password (from the form), and set that as the password. vBulletin will then md5($hashedpassword . $usersalt) and set the result as the password in the database.

Edit: If I am reading correctly, you can change the navbar template from
HTML Code:
<form action="login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
to
HTML Code:
<form action="login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 1)">
to preserve the actual password. This may open up some security concerns though.
Reply With Quote
  #3  
Old 06-07-2006, 12:53 AM
LunchBreak LunchBreak is offline
 
Join Date: Mar 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi,

I have changed the values as desired. It seems that the integration is working for only the navbar login, since I have changed $show[nopasswordempty] to 1.

However, I want it to work for the permission error that appears during new thread or new post. Where do I need to make the change?

What if I want to change the $show[nopasswordempty] value to 1 globally? What do I need to do?

Cheers,
Kaiser.
Reply With Quote
  #4  
Old 06-07-2006, 01:06 AM
Adrian Schneider's Avatar
Adrian Schneider Adrian Schneider is offline
 
Join Date: Jul 2004
Posts: 2,528
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Create a new plugin using the global_start hook.

PHP Code:
define('DISABLE_PASSWORD_CLEARING'1); 
Reply With Quote
  #5  
Old 06-15-2006, 04:42 AM
LunchBreak LunchBreak is offline
 
Join Date: Mar 2006
Posts: 7
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

wHi I am doing a autologin for users who come from our site. When they come to vBulletin they are not asked for any credentials. I have the userid in my hand. So, this is how I am trying to log the user in.
$newuserid is the userid I already know.

$newsession->set('userid', $newuserid);
$newsession->set('loggedin', 1);
$newsession->set('bypass', 0);
$newsession->set_session_visibility(($vbulletin->superglobal_size['_COOKIE'] > 0));
$vbulletin->session =& $newsession;

I have set it in global_start. It logs the user fine! but the problem is the first time it logs the user in, it does not show the user as logged in on navbar. However, when I refresh the page, shows the user as logged in.

I believe, I am defining the session after the page is loaded.

Question 1:
How can I escape the login redirect and log the user directly in without refreshing?
Question 2:
What does $newsession->set('bypass', 0); do?

It would be of big help if someone could answer my questions ASAP.

Cheers,
Kaiser.
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 02:20 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.03943 seconds
  • Memory Usage 2,191KB
  • 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
  • (2)bbcode_html
  • (1)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)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_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