From 0288b30ab6c740e09aa363b4af7700658b74d0d4 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Fri, 27 Dec 2013 02:39:18 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9AccountController=E4=B8=AD?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E6=B6=88=E6=81=AF=E7=9A=84bug=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E4=BA=A4AclManager=E4=B8=AD=E6=9C=89=E5=85=B3?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E7=99=BB=E5=BD=95=E7=9A=84=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9member=E7=B1=BB=E4=B8=AD=E5=85=B3?= =?UTF-8?q?=E9=94=AE=E5=AD=97=E6=94=AF=E6=8C=81php5.5+?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/AccountController.php | 4 +- .../default/views/scripts/account/login.phtml | 17 +------ .../models/CustomControllerAclManager.php | 44 +++++++++---------- application/module/Users/Member.php | 6 +-- 4 files changed, 27 insertions(+), 44 deletions(-) diff --git a/application/default/controllers/AccountController.php b/application/default/controllers/AccountController.php index 762f3597..d5cf52af 100755 --- a/application/default/controllers/AccountController.php +++ b/application/default/controllers/AccountController.php @@ -350,9 +350,11 @@ class AccountController extends Zend_Controller_Action view::Post($this,"登录成功,正在跳转",$tohref); return true; + }else{ + $this->view->captcha = $captcha->setCaptcha(); } - $this->view->captcha = $captcha->setCaptcha(); + } public function captchaAction() diff --git a/application/default/views/scripts/account/login.phtml b/application/default/views/scripts/account/login.phtml index 42874937..ac421001 100755 --- a/application/default/views/scripts/account/login.phtml +++ b/application/default/views/scripts/account/login.phtml @@ -6,21 +6,6 @@ $this->breadcrumb('用户登录'); $this->breadcrumb()->setSeparator(' > '); ?> -
error)) { ?> @@ -29,7 +14,7 @@
- error['error'] ?> + error['error'])? $this->error['error'] : $this->error ?>
diff --git a/application/models/CustomControllerAclManager.php b/application/models/CustomControllerAclManager.php index 60330350..0bee8403 100755 --- a/application/models/CustomControllerAclManager.php +++ b/application/models/CustomControllerAclManager.php @@ -1,4 +1,8 @@ auth->hasIdentity()) { - $mb = new member(); - $mb->db=$this->db; - if($mb->checkcookie()) + $member = new Member(); + + if($member->checkcookie()) { - $auth = Zend_Auth::getInstance(); - $authAdapter = new Zend_Auth_Adapter_DbTable($this->db); - $authAdapter->setTableName('users') - ->setIdentityColumn('username') - ->setCredentialColumn('password'); - $authAdapter->setIdentity($mb->user)->setCredential($mb->srpwd); - $result = $auth->authenticate($authAdapter); - if ($result->isValid()) { - $data = $authAdapter->getResultRowObject(null,'password'); - //头像 - include_once("Avatar.php"); - $avatar = new Avatar(); - $data->avatar = $avatar->Get($data->email,40); - - //组ID - include_once("Users.php"); - $usr = new Users($this->db); - $data->gid = $usr->getGroup($data->id); - - $auth->getStorage()->write($data); - $this->db->query("update users set ts_last_login=now() where username=?",array($mb->user)); + $data = array( + 'username' => $member->user, + 'password' => $member->srpwd + ); + + $account = new Account(); + $status = $account->storeLogin($data,false); + + if(isset($status['error'])) + { + $auth = Zend_Auth::getInstance(); + $auth->clearIdentity(); + Member::flushcookie(); } } } diff --git a/application/module/Users/Member.php b/application/module/Users/Member.php index fcb2bce2..c7ad012c 100644 --- a/application/module/Users/Member.php +++ b/application/module/Users/Member.php @@ -3,9 +3,9 @@ namespace Users; class Member { - var $ck='DCC3ER4T8L2EFX94OPDF'; - var $db; //传入PDO对象 - var $mid; //会员ID + public $ck='DCC3ER4T8L2EFX94OPDF'; + public $db; //传入PDO对象 + public $mid; //会员ID public $scr; //cookie 安全码 $_COOKIE['scr'] public $user;//cookie User $_COOKIE['user']