fiaw 2011-07-27 10:21:17 3529次浏览 5条回复 0 0 0
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;
}

里面的

self::ERROR_PASSWORD_INVALID;
self::ERROR_USERNAME_INVALID;

是什么 这样写

errorCode=validatePassword($this->password))

是不是应该返回正确的密码

您需要登录后才可以回复。登录 | 立即注册