修改AccountController中返回消息的bug,提交AclManager中有关自动登录的代码,修改member类中关键字支持php5.5+
This commit is contained in:
parent
a1f43ad574
commit
0288b30ab6
|
@ -350,9 +350,11 @@ class AccountController extends Zend_Controller_Action
|
||||||
|
|
||||||
view::Post($this,"登录成功,正在跳转",$tohref);
|
view::Post($this,"登录成功,正在跳转",$tohref);
|
||||||
return true;
|
return true;
|
||||||
|
}else{
|
||||||
|
$this->view->captcha = $captcha->setCaptcha();
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->captcha = $captcha->setCaptcha();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function captchaAction()
|
public function captchaAction()
|
||||||
|
|
|
@ -6,21 +6,6 @@
|
||||||
$this->breadcrumb('<a href="/account/login">用户登录</a>');
|
$this->breadcrumb('<a href="/account/login">用户登录</a>');
|
||||||
$this->breadcrumb()->setSeparator(' > ');
|
$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">
|
<div class="row-fluid">
|
||||||
<form class="form-horizontal" method="post">
|
<form class="form-horizontal" method="post">
|
||||||
<?php if(empty($this->error)) { ?>
|
<?php if(empty($this->error)) { ?>
|
||||||
|
@ -29,7 +14,7 @@
|
||||||
</div>
|
</div>
|
||||||
<? }else{ ?>
|
<? }else{ ?>
|
||||||
<div class="alert alert-error alert-login">
|
<div class="alert alert-error alert-login">
|
||||||
<?= $this->error['error'] ?>
|
<?= isset($this->error['error'])? $this->error['error'] : $this->error ?>
|
||||||
</div>
|
</div>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<div class="control-group">
|
<div class="control-group">
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Users\Member;
|
||||||
|
use Users\Account;
|
||||||
|
use Helpers\View as view;
|
||||||
class CustomControllerAclManager extends Zend_Controller_Plugin_Abstract
|
class CustomControllerAclManager extends Zend_Controller_Plugin_Abstract
|
||||||
{
|
{
|
||||||
// default user role if not logged or (or invalid role found)
|
// default user role if not logged or (or invalid role found)
|
||||||
|
@ -72,31 +76,23 @@
|
||||||
|
|
||||||
if(!$this->auth->hasIdentity())
|
if(!$this->auth->hasIdentity())
|
||||||
{
|
{
|
||||||
$mb = new member();
|
$member = new Member();
|
||||||
$mb->db=$this->db;
|
|
||||||
if($mb->checkcookie())
|
if($member->checkcookie())
|
||||||
|
{
|
||||||
|
$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 = Zend_Auth::getInstance();
|
||||||
$authAdapter = new Zend_Auth_Adapter_DbTable($this->db);
|
$auth->clearIdentity();
|
||||||
$authAdapter->setTableName('users')
|
Member::flushcookie();
|
||||||
->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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,9 +3,9 @@ namespace Users;
|
||||||
|
|
||||||
class Member
|
class Member
|
||||||
{
|
{
|
||||||
var $ck='DCC3ER4T8L2EFX94OPDF';
|
public $ck='DCC3ER4T8L2EFX94OPDF';
|
||||||
var $db; //传入PDO对象
|
public $db; //传入PDO对象
|
||||||
var $mid; //会员ID
|
public $mid; //会员ID
|
||||||
|
|
||||||
public $scr; //cookie 安全码 $_COOKIE['scr']
|
public $scr; //cookie 安全码 $_COOKIE['scr']
|
||||||
public $user;//cookie User $_COOKIE['user']
|
public $user;//cookie User $_COOKIE['user']
|
||||||
|
|
Loading…
Reference in New Issue