I am trying to follow the example of using a database to authenticate. I am receiving errors because my model (table) has different column names. ie - the columns are not labelled username or password, that are for example "user_name" and "user_password". Can someone tell me where I may be going wrong because i keep receiving an exception telling me my column is undefined
class UserIdentity extends CUserIdentity
{
private $_id;
public function authenticate()
{
$record=User::model()->findByAttributes(array('username'=>$this->username));
if($record===null)
$this->errorCode=self::ERROR_USERNAME_INVALID;
else if($record->password!==md5($this->password))
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
{
$this->_id=$record->id;
$this->setState('title', $record->title);
$this->errorCode=self::ERROR_NONE;
}
return !$this->errorCode;
}
public function getId()
{
return $this->_id;
}
}