maseraticc 2013-01-22 18:30:53 2980次浏览 2条回复 0 0 0

求帮助,在yii的验证中 $this->_identity=new UserIdentity($this->username,$this->password); 用到了UserIdentity这个类,但是在这个类中是如何获取用户输入的数据的呢

public function authenticate()
{
    $user = User::model()->findByAttributes(array('username' => $this->username));(这里的username不是这个类的一个属性吗 ,是怎么把输入的数据赋给这个属性的呢????????)
    if ($user === null){
        $this->errorCode = self::ERROR_USERNAME_INVALID;
    }else{	
        if ($user->password !== md5($this->password)){
            $this->errorCode = self::ERROR_PASSWORD_INVALID;
        }else{
            $this->_id = $user->id;
            $this->errorCode = self::ERROR_NONE;
        }
    }
    return!$this->errorCode;
}
您需要登录后才可以回复。登录 | 立即注册