修改AccountController中返回消息的bug,提交AclManager中有关自动登录的代码,修改member类中关键字支持php5.5+

This commit is contained in:
Li Jianxuan 2013-12-27 02:39:18 +00:00
parent a1f43ad574
commit 0288b30ab6
4 changed files with 27 additions and 44 deletions

View File

@ -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()

View File

@ -6,21 +6,6 @@
$this->breadcrumb('<a href="/account/login">用户登录</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<style>
.login_box {
max-width: 300px;
padding: 19px 29px 29px;
margin: 0 auto 20px;
background-color: #fff;
border: 1px solid #e5e5e5;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.05);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.05);
box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
</style>
<div class="row-fluid">
<form class="form-horizontal" method="post">
<?php if(empty($this->error)) { ?>
@ -29,7 +14,7 @@
</div>
<? }else{ ?>
<div class="alert alert-error alert-login">
<?= $this->error['error'] ?>
<?= isset($this->error['error'])? $this->error['error'] : $this->error ?>
</div>
<?php } ?>
<div class="control-group">

View File

@ -1,4 +1,8 @@
<?php
use Users\Member;
use Users\Account;
use Helpers\View as view;
class CustomControllerAclManager extends Zend_Controller_Plugin_Abstract
{
// default user role if not logged or (or invalid role found)
@ -72,31 +76,23 @@
if(!$this->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();
}
}
}

View File

@ -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']