From bc49f03f75f1f65fcfba6b50c65d87842d78d512 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Thu, 23 Oct 2014 09:42:49 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95=E7=A7=91?= =?UTF-8?q?=E6=8A=80=E7=BD=91=E9=80=9A=E8=A1=8C=E8=AF=81=E7=9A=84=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/AccountController.php | 12 ++++++- application/module/Open/OAuth2.php | 35 +++++++++++++++---- 2 files changed, 40 insertions(+), 7 deletions(-) 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