[pLog-svn] r3000 - in plog/trunk/class/dao: . userdata

mark at devel.lifetype.net mark at devel.lifetype.net
Thu Mar 2 02:56:29 GMT 2006


Author: mark
Date: 2006-03-02 02:56:28 +0000 (Thu, 02 Mar 2006)
New Revision: 3000

Modified:
   plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
   plog/trunk/class/dao/userinfo.class.php
Log:
Fix "can not login" problem after change the password. It is because the original password encrypted by MD5() twice.

Modified: plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/ploguserdataprovider.class.php	2006-03-02 02:49:02 UTC (rev 2999)
+++ plog/trunk/class/dao/userdata/ploguserdataprovider.class.php	2006-03-02 02:56:28 UTC (rev 3000)
@@ -97,6 +97,8 @@
 							  $page = DEFAULT_PAGING_ENABLED, 
 							  $itemsPerPage = DEFAULT_ITEMS_PER_PAGE )
         {   		
+	    	$where = "";
+	    	
 	    	if( $status != USER_STATUS_ALL )
 	    		$where = "status = '".Db::qstr($status)."'";
 
@@ -156,6 +158,7 @@
 	            $this->_cache->removeData( $user->getId(), CACHE_USERINFO );
     	        $this->_cache->removeData( $user->getUsername(), CACHE_USERIDBYNAME );
     	        // and add the new one
+    	        $user->setMD5Password( $user->getPassword() );
 	        	$this->_cache->setData( $user->getId(), CACHE_USERINFO, $user );
     	    	$this->_cache->setData( $user->getUsername(), CACHE_USERIDBYNAME, $user->getId());    	        
     	    }
@@ -183,7 +186,7 @@
 				//    we addUser() successfully.
 				// 2. Another easy way to solve this is remove the cache code below, don't cache the UserInfo
 				//    Object in the first time. Let it cache later.
-				$user->setPassword( $user->getPassword() );
+				$user->setMD5Password( $user->getPassword() );
 	        	$this->_cache->setData( $user->getId(), CACHE_USERINFO, $user );
     	    	$this->_cache->setData( $user->getUsername(), CACHE_USERIDBYNAME, $user );
     	    }

Modified: plog/trunk/class/dao/userinfo.class.php
===================================================================
--- plog/trunk/class/dao/userinfo.class.php	2006-03-02 02:49:02 UTC (rev 2999)
+++ plog/trunk/class/dao/userinfo.class.php	2006-03-02 02:56:28 UTC (rev 3000)
@@ -113,8 +113,13 @@
 
 		function setPassword( $newPassword )
 		{
+			$this->_password = $newPassword;
+		}
+
+		function setMD5Password( $newPassword )
+		{
 			$this->_password = md5($newPassword);
-		}
+		}		
 	
 		function setId( $newId )
 		{



More information about the pLog-svn mailing list