User authorization

Hi all. I've some problems with user authorization.

here is the code of UserIdentity



class UserIdentity extends CUserIdentity 


{





	public function authenticate()


	{


		$user=Users::model()->find('LOWER(username)=?',array(strtolower($this->username)));


		if($user===null)


			$this->errorCode=self::ERROR_USERNAME_INVALID;


		else if(md5(md5($this->password).$user->salt)!==$user->password)


			$this->errorCode=self::ERROR_PASSWORD_INVALID;


		else


		{


			$this->_id=$user->userId;


			$this->username=$user->username;


			$this->lastdate=$user->lastdate;


			$this->errorCode=self::ERROR_NONE;


			$user->save();


		}


		return !$this->errorCode;


	}





    public function getLastDate()


    {


        return $this->getState('_lastdate');


    }





    public function setLastDate($value)


    {


        $this->setState('_lastdate',$value);


    }








}

how cat i access "lastdate" param? Yii::app()->user->lastdate doesn't work.

and no example of getPersistentStates function

You can use Yii::app()->user->getState('_lastdate').

If you are using SVN, you should be able to use: Yii::app()->user->_lastdate.

i'm using svn, but Yii::app()->user->_lastdate doesn't work

Property "CWebUser._lastdate" is not defined.

this works

Yii::app()->user->getState('_lastdate')

Are you using 1.0 branch?

No, i use trunk version.

should i use branches/1.0/ ?

Yes, the new feature is currently available only in 1.0 branch. I am merging 1.0 to trunk every a few days.

Oh, didn’t know… thanks  :) now it works!