Hi
I tried make an authentification just with the User ID:
<?php
class UserIdentity extends CUserIdentity
{
public $id;
public $name;
public $user;
public function __construct ( $user_id )
{
$this->id = $user_id;
}
public function authenticate ( )
{
$user=User::model()->find('user_id=?',array( $this->id ));
if($user===null)
{
$this->errorCode=self::ERROR_USERNAME_INVALID;
$this->id = null;
}
else
{
$this->user = $user->user_nickname;
$this->name = $user->user_real_name;
$this->errorCode=self::ERROR_NONE;
}
return $this->errorCode==self::ERROR_NONE;
}
}
This is my authentification:
$identity = new UserIdentity ( $user_id ) ;
if($identity->authenticate())
{
Yii::app()->user->login($identity);
return true;
}
else
return false;
It seems to work - there is no exception thrown and the result was true.
Now, when i check if the user is logged in ([font="Courier New"]Yii::app()->user->isGuest[/font]) - the result is true. And my variables (like [font="Courier New"]Yii::app()->user->user[/font]) are not set.
Can someone please help me?
Thank you very much.