diff --git a/application/default/controllers/AccountController.php b/application/default/controllers/AccountController.php index 10864530..45040eed 100755 --- a/application/default/controllers/AccountController.php +++ b/application/default/controllers/AccountController.php @@ -1,6 +1,7 @@ $this->_request->getModuleName(), 'controller' => $this->_request->getControllerName(), @@ -305,6 +306,15 @@ class AccountController extends Zend_Controller_Action { $this->view->href = $tohref; } + + $oauth2 = new OAuth2(); + if($oauth2->loginTest()) + { + $client = new Client(); + $url = $client->makeRequestCodeUrl("escience"); + + view::Post($this,"为您转入科技网登录入口",$url); + } $captcha = new Captcha(); diff --git a/application/module/Open/OAuth2.php b/application/module/Open/OAuth2.php index f31d6f37..2272ab23 100644 --- a/application/module/Open/OAuth2.php +++ b/application/module/Open/OAuth2.php @@ -1,6 +1,10 @@ table = new Table(); } - - //用户使用谷歌账号登陆 - public function googleClient() - { - - } + + //登录测试 + public function loginTest() + { + try { + $client = new Client(); + $url = $client->makeRequestCodeUrl("escience"); + + $curl = new Curl(); + $curl->port = 443; + $curl->initOptions(array('verifyssl' => false)); + $data = $curl->request($url, array(), "POST"); + + $cache_data = $data; + + if (isset($data['headers']['http_code']) && $data['headers']['http_code'] == 302) { + return true; + } else { + return false; + } + }catch (\Exception $e) + { + return false; + } + } } \ No newline at end of file