Hi I’m trying to login a user using the code below:
$member = new MemberIdentity('user03','user03');
if($member->authenticate()){
Yii::app()->user->login($member);
}
echo 'userId = ' . Yii::app()->user->id;
I hardcoded the username and pw for testing. The user was able to login and userId = memberId. But when I refresh the page, with Yii::app()->user->login($member); uncommented, the userId becomes null and Yii::app()->user->isGuest = 1.
Am I missing something to make the log in persistent?
Here’s my config,
'session'=>array(
'autoStart'=>true,
'timeout'=>1000000
),
'user'=>array(
// enable cookie-based authentication
'allowAutoLogin'=>false,
),