protected/components/UserIdentity.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

/**
 * UserIdentity represents the data needed to identity a user.
 * It contains the authentication method that checks if the provided
 * data can identity the user.
 */
class UserIdentity extends CUserIdentity
{	public $user;
	public function getId()
	{
		return $this->id;
	}

	public function setId($id)
	{
		return $this->id = $id;
	}
	public function getName()
	{
		return $this->name;
	}

	public function setName($name)
	{
		return $this->name = $name;
	}
	public function getUsername()
	{
		return $this->username;
	}

	public function setUsername($username)
	{
		return $this->username = $username;
	}
	public function getUser()
    {
        return $this->user;
    }
    
    public function setUser(CActiveRecord $user)
    {
        $this->user=$user->attributes;
    }
	/**
	 * Authenticates a user.
	 * The example implementation makes sure if the username and password
	 * are both 'demo'.
	 * In practical applications, this should be changed to authenticate
	 * against some persistent user identity storage (e.g. database).
	 * @return boolean whether authentication succeeds.
	 */
	public function authenticate()
	{
		$criteria = new CDbCriteria;
		$criteria->condition='username = :username and password = :password';
		$criteria->params=array(':username' =>$this->username,':password' =>$this->password);
		$user = User::model()->find($criteria);
		
后面还有 12 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。