<?php
class AdminUserIdentity extends CUserIdentity
{
private $_id = NULL;
public function authenticate()
{
$users = Admins::model()->findByAttributes(array( "email" => $this->username ));
if( $users === NULL )
{
$this->errorCode = self::ERROR_USERNAME_INVALID;
}
else
{
if( $users->password !== base64_encode($this->password) )
{
$this->errorCode = self::ERROR_PASSWORD_INVALID;
}
else
{
$this->errorCode = self::ERROR_NONE;
$this->_id = $users->id;
}
}
return !$this->errorCode;
}
public function getId()
{
return $this->_id;
}
}