I was following the blog tutorial on the yii tutorial site.
In "Authenticating User" section, I cannot login using UserIdentity code
posted in the tutorial. I get a blank screen.
I’m probably getting a fatal error somewhere but I don’t see the error in the apache log file.
When I step the code using the xdebug debugger, the $user object does not seemed to be constructed correctly. I can not step past the line:
if($user===null)
When I inspect $user object, I only see the classname with no other attributes.
Below is the UserIdentity class I use (from the blog tutorial).
Does anyone know the cause?
class UserIdentity extends CUserIdentity
{
private $_id;
public function authenticate()
{
$username=strtolower($this->username);
$user=User::model()->find('LOWER(username)=?',array($username));
if($user===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else
if(!$user->validatePassword($this->password))
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$this->_id=$user->id;
$this->username=$user->username;
$this->errorCode=self::ERROR_NONE;
}
return $this->errorCode==self::ERROR_NONE;
}
public function getId()
{
return $this->_id;
}
}