fixed bug in Auth Servic classes
This commit is contained in:
parent
23ac2439f8
commit
053c2f2f4b
|
@ -2,11 +2,9 @@
|
||||||
namespace Westdc\Authentication;
|
namespace Westdc\Authentication;
|
||||||
|
|
||||||
use Zend\Permissions\Acl\Acl;
|
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\Helpers\Assist as view;
|
||||||
use Westdc\Member\Cookie;
|
use Westdc\Member\Cookie;
|
||||||
use Zend\Mvc\MvcEvent;
|
use Westdc\User\Account;
|
||||||
|
|
||||||
class AuthenticationService
|
class AuthenticationService
|
||||||
{
|
{
|
||||||
|
@ -86,7 +84,7 @@ class AuthenticationService
|
||||||
if($mb->checkcookie())
|
if($mb->checkcookie())
|
||||||
{
|
{
|
||||||
$account = new Account();
|
$account = new Account();
|
||||||
$account->cookieLogin(array($mb->FieldUsername=>$mb->user,$mb->FieldPasword=>$mb->srpwd));
|
$account->cookieLogin(array('username'=>$mb->user));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,16 +60,21 @@ class Account implements EventManagerAwareInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取账号信息,数组
|
//获取账号信息,数组
|
||||||
public function getAccountInfo($id = 0)
|
public function getAccountInfo($id = 0)
|
||||||
{
|
{
|
||||||
if($id == 0)
|
|
||||||
{
|
if(is_string($id))
|
||||||
$id = view::User('id');
|
$sql = "SELECT * FROM {$this->conf->table->member} WHERE username='$id'";
|
||||||
}
|
elseif(is_numeric($id))
|
||||||
$sql = "SELECT * FROM {$this->memberTable} WHERE id=$id";
|
{
|
||||||
$rs = $this->db->query($sql);
|
if($id == 0)
|
||||||
return $rs->fetch();
|
$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)
|
public function register($data)
|
||||||
|
@ -212,7 +217,14 @@ class Account implements EventManagerAwareInterface
|
||||||
|
|
||||||
public function cookieLogin($data)
|
public function cookieLogin($data)
|
||||||
{
|
{
|
||||||
return $this->storeLogin($data,false);
|
$data = $this->getAccountInfo($data['username']);
|
||||||
|
|
||||||
|
if(!$data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->storeLogin($data,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
//注册信息参数
|
//注册信息参数
|
||||||
|
|
Loading…
Reference in New Issue