BanzaiTokyo MODx forums  
  (#11 (permalink)) Old
resurepus Offline
Administrator
 
resurepus's Avatar
 
Posts: 27
Join Date: May 2008
Location: Toulouse, France
Default 09-18-2008, 01:26 PM

we are working on it. Will post soon.
  Send a message via MSN to resurepus Send a message via Skype™ to resurepus 
Reply With Quote
  (#12 (permalink)) Old
immortal Offline
Junior Member
 
Posts: 9
Join Date: Aug 2008
Smile 09-18-2008, 02:52 PM

Thanks, I appreciate it.
   
Reply With Quote
  (#13 (permalink)) Old
immortal Offline
Junior Member
 
Posts: 9
Join Date: Aug 2008
Default Got it? - 09-23-2008, 03:57 PM

I made the following change and it seems to work:

$sql = "UPDATE $dbase.`".$table_prefix."web_users` SET password='".md5($row)."' WHERE username = '".$vbulletin->userinfo['username']."' AND password = 'defaultpassword'";

I tested it out and it did reset the password properly.. I just want to make sure that I didn't do it the wrong way and there won't be any side effects you know of.

Thanks for your help,
-Priyesh
   
Reply With Quote
  (#14 (permalink)) Old
resurepus Offline
Administrator
 
resurepus's Avatar
 
Posts: 27
Join Date: May 2008
Location: Toulouse, France
Default 09-26-2008, 09:20 AM

From what I can see, it looks like you did some other modifications (besides the bit you've posted here). So without having the full picture it's kind of hard to tell if there are any potential problems. However if I am mistaken and no other changes have been made, this looks harmless.

I will also mention that we'll continue working on our own solution for this problem and we'll release it in the next update.
  Send a message via MSN to resurepus Send a message via Skype™ to resurepus 
Reply With Quote
  (#15 (permalink)) Old
immortal Offline
Junior Member
 
Posts: 9
Join Date: Aug 2008
Default 09-26-2008, 02:16 PM

I didn't make any other modifications to the plugin xml file besides adding the lines you gave me and then changing that one line I specified above.

I'll let you know how it turns out once it goes live
Thanks
   
Reply With Quote
  (#16 (permalink)) Old
immortal Offline
Junior Member
 
Posts: 9
Join Date: Aug 2008
Exclamation 10-24-2008, 04:29 PM

Sorry to bug you yet again, but the code doesn't seem to be working for some reason. Both $vbulletin->gpc['password'] and ['vb_login_password'] are coming up blank in the user_login vb event. I tried hardcoding a password into the update statement and it worked, it set the modx password to my hardcoded value. So the problem seems to be getting the password from vbulletin.

Just to be clear I'm posting the entire login part of the xml:
Code:
<plugin active="1" executionorder="5">
                        <title>Login into ModX</title>
                        <hookname>login_process</hookname>
                        <phpcode><![CDATA[
global $vbulletin, $vbphrase;
$modxconfig = $vbphrase['modxpath'] . "manager/includes/config.inc.php";
include($modxconfig);

$c = mysql_connect($database_server, $database_user, $database_password);
mysql_select_db($dbase);
$sql = "SELECT wu.*, ua.* ".
       "FROM $dbase.`".$table_prefix."web_users` wu, $dbase.`".$table_prefix."web_user_attributes` ua ".
       "WHERE wu.username = '".$vbulletin->userinfo['username']."' and ua.internalKey = wu.id;";
$ds = mysql_query($sql);
$row = mysql_fetch_assoc($ds);
if ($row) {
    session_name($site_sessionname);
    session_start();
    $_SESSION['webShortname']=$vbulletin->userinfo['username'];
    $_SESSION['webFullname']=$row['fullname'];
    $_SESSION['webEmail']=$row['email'];
    $_SESSION['webValidated']=1;
    $_SESSION['webInternalKey']=$row['internalKey'];
    $_SESSION['webValid']=base64_encode($vbulletin->userinfo['password']);
    $_SESSION['webUser']=base64_encode($vbulletin->userinfo['username']);
    $_SESSION['webFailedlogins']=$row['failedlogincount'];
    $_SESSION['webLastlogin']=$row['lastlogin'];
    $_SESSION['webnrlogins']=$row['logincount'];
    $_SESSION['webUserGroupNames'] = ''; // reset user group names
    // get user's document groups
    $dg='';$i=0;
    $sql = "SELECT uga.documentgroup FROM $dbase.`".$table_prefix."web_groups` ug ".
           "INNER JOIN $dbase.`".$table_prefix."webgroup_access` uga ON uga.webgroup=ug.webgroup ".
           "WHERE ug.webuser =".$row['internalKey'];
    $ds = mysql_query($sql);
    while ($row = mysql_fetch_row($ds)) $dg[$i++]=$row[0];
    $_SESSION['webDocgroups'] = $dg;
    if($vbulletin->GPC[COOKIE_PREFIX . 'userid']) {
        $_SESSION['modx.web.session.cookie.lifetime']= intval($modx->config['session.cookie.lifetime']);
    } else {
        $_SESSION['modx.web.session.cookie.lifetime']= 0;
    }
    $cookieExpiration = $cookieLifetime = 0;
    if (isset ($_SESSION['modx.web.session.cookie.lifetime']) && is_numeric($_SESSION['modx.web.session.cookie.lifetime'])) {
       $cookieLifetime = intval($_SESSION['modx.web.session.cookie.lifetime']);
    }
    if ($cookieLifetime) {$cookieExpiration= time() + $cookieLifetime;}
    if (!isset($_SESSION['modx.session.created.time'])) {$_SESSION['modx.session.created.time'] = time();}
    setcookie(session_name(), session_id(), $cookieExpiration, MODX_BASE_URL);
	
    $vbPass = ($vbulletin->GPC['password'] != '') ? $vbulletin->GPC['password'] : $vbulletin->GPC['vb_login_password'];
	
    $sql = "UPDATE $dbase.`".$table_prefix."web_users` SET password='".md5($vbPass)."' WHERE username = '".$vbulletin->userinfo['username']."'";

    if ($vbPass != '') mysql_query($sql);
}
mysql_close($c);
]]></phpcode>
                </plugin>
   
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump



Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vBulletin Skin developed by: vBStyles.com