[pLog-svn] r2830 - plog/trunk/class/dao/userdata

mark at devel.lifetype.net mark at devel.lifetype.net
Fri Jan 20 04:59:24 GMT 2006


Author: mark
Date: 2006-01-20 04:59:22 +0000 (Fri, 20 Jan 2006)
New Revision: 2830

Modified:
   plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
Log:
Finally, "user can not login" bug fixed.

The password in UserInfo object did not encrpyted by MD5 after user finish the registration process. Therefore the authenticateUser() always return flase, until we clear the cache.

There are two ways to solve this:
1. Encrypt the password in UserInfo object, then cache the modified one instead of original UserInfo object.
2. Do not cache UserInfo object in first time. Let it cache when userlogin or other process.

I choose the first way. 

BTW, This is also why I can not login after I completed the installation wizard.php

Mark

Modified: plog/trunk/class/dao/userdata/ploguserdataprovider.class.php
===================================================================
--- plog/trunk/class/dao/userdata/ploguserdataprovider.class.php	2006-01-20 01:51:31 UTC (rev 2829)
+++ plog/trunk/class/dao/userdata/ploguserdataprovider.class.php	2006-01-20 04:59:22 UTC (rev 2830)
@@ -176,7 +176,14 @@
         {
         	$userId = $this->add( $user );
 
-			if( $userId ) {        	
+			if( $userId ) {
+				// 1. We need to set the password again in this initial UserInfo object, because 
+				//    current password is plain password. Through setPassword() we can encrpyt the password
+				//    and make the UserInfo object right, then we can cache it. Or user can not login even
+				//    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() );
 	        	$this->_cache->setData( $user->getId(), CACHE_USERINFO, $user );
     	    	$this->_cache->setData( $user->getUsername(), CACHE_USERIDBYNAME, $user );
     	    }



More information about the pLog-svn mailing list