示例#1
0
文件: Auth.php 项目: utcuong3010/vng
 public function hasIdentity()
 {
     if (!empty($this->_identity)) {
         return true;
     }
     $zadmin_auth = Zing_Cookies::getCookie(self::COOKIE_ADMIN_AUTH_KEY);
     if (empty($zadmin_auth) || !Zing_Auth_Util::checkSessionKey($zadmin_auth)) {
         Zing_Cookies::clearCookies($zadmin_auth);
         return false;
     }
     $storage = $this->getStorage();
     $storage->setZAdminAuthKey($zadmin_auth);
     $identity = $storage->read();
     if (!empty($identity)) {
         //Identity in cache is array
         $this->_identity = new stdClass();
         $this->_identity->userid = $identity["userid"];
         $this->_identity->username = $identity["username"];
         $this->_identity->appid = $identity["appid"];
         $this->_identity->name = $identity["name"];
         $this->_identity->appname = $identity["appname"];
         $this->_identity->adminflg = $identity['adminflg'];
         return true;
     }
     return false;
 }
示例#2
0
文件: Auth.php 项目: utcuong3010/vng
 public function isLogged()
 {
     $zauth = isset($_COOKIE['ZAUTH']) ? $_COOKIE['ZAUTH'] : '';
     $hasMeCookies = $zauth != '' && Zing_Auth_Util::checkSessionKey($zauth);
     if ($hasMeCookies && $this->_storage != null) {
         $this->_storage->setSessionId($zauth);
         $objSession = $this->_storage->read();
         if (!empty($objSession)) {
             $objSession->accountName = trim($objSession->accountName);
             if (!empty($objSession->accountName)) {
                 $this->setIdentityBySSO($objSession);
                 return true;
             }
         }
     }
     return false;
 }