fixed bug in Auth Servic classes

This commit is contained in:
Jianxuan Li 2015-01-12 17:13:14 +08:00
parent 23ac2439f8
commit 053c2f2f4b
2 changed files with 25 additions and 15 deletions

View File

@ -2,11 +2,9 @@
namespace Westdc\Authentication;
use Zend\Permissions\Acl\Acl;
use Zend\Permissions\Acl\Role\GenericRole as Role;
use Zend\Permissions\Acl\Resource\GenericResource as Resource;
use Westdc\Helpers\Assist as view;
use Westdc\Member\Cookie;
use Zend\Mvc\MvcEvent;
use Westdc\User\Account;
class AuthenticationService
{
@ -86,7 +84,7 @@ class AuthenticationService
if($mb->checkcookie())
{
$account = new Account();
$account->cookieLogin(array($mb->FieldUsername=>$mb->user,$mb->FieldPasword=>$mb->srpwd));
$account->cookieLogin(array('username'=>$mb->user));
}
}
}

View File

@ -60,16 +60,21 @@ class Account implements EventManagerAwareInterface
}
//获取账号信息,数组
public function getAccountInfo($id = 0)
{
if($id == 0)
{
$id = view::User('id');
}
$sql = "SELECT * FROM {$this->memberTable} WHERE id=$id";
$rs = $this->db->query($sql);
return $rs->fetch();
}
public function getAccountInfo($id = 0)
{
if(is_string($id))
$sql = "SELECT * FROM {$this->conf->table->member} WHERE username='$id'";
elseif(is_numeric($id))
{
if($id == 0)
$id == view::User('id');
$sql = "SELECT * FROM {$this->conf->table->member} WHERE id=$id";
}
$rs = $this->db->query($sql);
return $rs->fetch(\PDO::FETCH_ASSOC);
}
//注册
public function register($data)
@ -212,7 +217,14 @@ class Account implements EventManagerAwareInterface
public function cookieLogin($data)
{
return $this->storeLogin($data,false);
$data = $this->getAccountInfo($data['username']);
if(!$data)
{
return false;
}
return $this->storeLogin($data,false);
}
//注册信息参数