vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Redirect after login / logout to previous page (https://vborg.vbsupport.ru/showthread.php?t=182510)

vicmarconi 06-14-2008 11:26 PM

Redirect after login / logout to previous page
 
Hi!

I'm trying to integrate vBulletin with my site, which was done with Rails.
I want to use vBulletin's login system to the whole site, so users won't need to login twice (forum and site).

So I'm planning putting a login box that would send user's name and password to vbulletin's login system and redirect the user back to where they submitted the form (the previous page, in my site).

For the logout procedure, I have another question besides redirection. How "logouthash" is generated? I'd like to reproduce this hash using Rails.

Thanks for your atention and sorry for my poor english.

MoT3rror 06-15-2008 01:04 AM

PHP Code:

$user['securitytoken'] = sha1($user['userid'] . sha1($user['salt']) . sha1(COOKIE_SALT));
$user['logouthash'] =& $user['securitytoken']; 

Found in function fetch_userinfo in functions.php. COOKIE_SALT is your license number.

vicmarconi 06-15-2008 02:23 AM

Thanks for your reply.

But unfortunately I found something different at functions.php:

PHP Code:

$user['securitytoken_raw'] = sha1($user['userid'] . sha1($user['salt']) . sha1(COOKIE_SALT));
$user['securitytoken'] = TIMENOW '-' sha1(TIMENOW $user['securitytoken_raw']);

$user['logouthash'] =& $user['securitytoken']; 

It seems strange, because $user['securitytoken'] (and therefore, $user['logouthash']) should have a -.
Perhaps I'm not understanding what is going on around the last line.

=& means that $user['logouthash'] is the same as $user['securitytoken'], and not a copy (so, no big deal). Am I right?

MoT3rror 06-15-2008 02:39 AM

Sorry looking at 3.7.0 and not 3.7.1.
Yes =& means it is the same and if a change is made it either it is made to the other I believe.

Dismounted 06-15-2008 04:15 AM

"=&" means to pass-by-reference and not pass-by-value.

vicmarconi 06-16-2008 01:25 AM

Well, I managed to get some idea of how the logouthash is made by following the code you posted:

PHP Code:

$user['securitytoken_raw'] = sha1($user['userid'] . sha1($user['salt']) . sha1(COOKIE_SALT));
$user['securitytoken'] = TIMENOW '-' sha1(TIMENOW $user['securitytoken_raw']);

$user['logouthash'] =& $user['securitytoken']; 

But now I'm having difficulties reproducing TIMENOW on Ruby. Could you show me from where this value is retrieved?

And, I still have no clues how to redirect after login / logout, so users could login/logout from outside the forum and return to the same page.

I promess that I'll retribute this favor by posting a How-to integrate vBulletin with Ruby on Rails. As there is no forum coded with Rails (Ruby), everybody still relies on php solutions like vBulletin, and integrating both would be worthy.

MoT3rror 06-16-2008 01:43 AM

TIMENOW is the current time in UNIX time. The login and logout already redirect the user to the page they were at.

IUD 06-18-2008 05:45 AM

Same prob here

Dismounted 06-18-2008 06:54 AM

What problem? Did you read all the replies?

vicmarconi 06-18-2008 08:09 PM

Many thanks for your help !! I'm planning releasing a tutorial about the procedure of integrating Rails is vBulletin soon.

tazzarkin 06-28-2008 11:37 AM

Great! we look forward to it.
---------------------
Quote:

Originally Posted by vicmarconi (Post 1552903)
Many thanks for your help !! I'm planning releasing a tutorial about the procedure of integrating Rails is vBulletin soon.



All times are GMT. The time now is 04:53 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.01051 seconds
  • Memory Usage 1,742KB
  • 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
  • (3)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (11)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