示例#1
0
 public function miniHeaderAction()
 {
     $cas = new CAServer();
     $casConfig = $cas->getConfig();
     $loginParam = '';
     if (isset($_SERVER['HTTP_REFERER']) && ($backurl = $_SERVER['HTTP_REFERER'])) {
         $refer = parse_url($backurl);
         $auth = 0;
         $siteId = '';
         foreach ($casConfig['site'] as $site => $siteInfo) {
             $casDomain = parse_url($siteInfo['domain']);
             if ($refer['host'] == $casDomain['host']) {
                 $auth = 1;
                 $siteId = '&siteid=' . $site;
                 break;
             }
         }
         $loginParam = '?backurl=' . urlencode($backurl) . $siteId . '&auth=' . $auth;
     }
     $this->view->pick('common/miniHeader');
     $this->view->setVars(array('loginParam' => $loginParam));
     $this->view->disableLevel(\Phalcon\Mvc\View::LEVEL_MAIN_LAYOUT);
 }
示例#2
0
 public function alipayRegister($passwd, $mobile, $email = '', $pic = '', $openId = '')
 {
     $user = $this->user->getUidByMobi($mobile);
     if ($user['u_id']) {
         return self::MOBI_EXITE;
     } else {
         $regTime = $_SERVER['REQUEST_TIME'];
         $passwd = \Ucenter\Utils\Inputs::makeSecert($passwd, $regTime);
         if ($uid = $this->user->addUser($email, $passwd, $mobile, $regTime, $pic, '', '', '', $openId)) {
             $cas = new CAServer();
             $this->di['session']->set('uid', $uid);
             $this->di['session']->set('uinfo', array('name' => '', 'mobile' => $mobile));
             $cas->casSave(0, 0);
             return self::SUCCESS;
         } else {
             return self::ERROR;
         }
     }
 }
示例#3
0
 public function validateAction()
 {
     $param = $this->request->getQuery();
     $status = "no\n";
     $info = '';
     if ($st = $param['ticket']) {
         // 获取redis中tgt
         $RedisLib = new \Ucenter\Utils\RedisLib($this->di);
         $redis = $RedisLib::getRedis();
         if ($tgt = $redis->get($st)) {
             $cas = new CAServer();
             $status = "yes\n";
             $info = $cas->encrypt($cas->getSiteIdByST($st), json_encode($tgt));
         }
     }
     echo $status;
     echo $info;
     $this->view->disable();
 }