Restore user states on autoLogin

I am using a login form which allows the user to use yii’s ‘remember me’ option.

During the first login I am setting some user->state values which of course will be lost after the session ended.

Now what is the best way to set these states again if the user gets automatically logged in again through the ‘remember me’ cookie.

So far I have been setting some user states within the UserIdentity class in the components folder:

Yii::app()->user->setState('someKey', $someValue);

What would be best to restore these states once auto login gets used?

I do not want to store the set user states in a cookie since they might contain too security sensitive data.

Dear JRN,

I faced similar issue.But I never tried to solve this.

Finally I think I solved this.

I created the component CustomUser.php extending CWebUser.

I overrided the init method.

I am bringing user designation from database and setting it as title for user.


    class CustomUser extends CWebUser 




	  public function init()




		if(!$this->getIsGuest()) {







You have to change the main configuration file.




			// enable cookie-based authentication