fixed login bug
This commit is contained in:
parent
0898797ca4
commit
5a0ccd3944
|
@ -54,13 +54,18 @@ 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->conf->table->member} WHERE id=$id";
|
{
|
||||||
|
if($id == 0)
|
||||||
|
$id == view::User('id');
|
||||||
|
$sql = "SELECT * FROM {$this->conf->table->member} WHERE id=$id";
|
||||||
|
}
|
||||||
|
|
||||||
$rs = $this->db->query($sql);
|
$rs = $this->db->query($sql);
|
||||||
return $rs->fetch();
|
return $rs->fetch(\PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
//注册
|
//注册
|
||||||
|
@ -158,7 +163,7 @@ class Account implements EventManagerAwareInterface
|
||||||
|
|
||||||
$auth = new AuthenticationService();
|
$auth = new AuthenticationService();
|
||||||
$auth->setStorage(new SessionStorage($this->config->session_namespace));
|
$auth->setStorage(new SessionStorage($this->config->session_namespace));
|
||||||
|
|
||||||
$email = $user->email;
|
$email = $user->email;
|
||||||
$results = $this->getEventManager()->trigger('login.success.createAvatar', $this, compact('email'));
|
$results = $this->getEventManager()->trigger('login.success.createAvatar', $this, compact('email'));
|
||||||
$user->avatar = $results->last();
|
$user->avatar = $results->last();
|
||||||
|
@ -167,13 +172,19 @@ class Account implements EventManagerAwareInterface
|
||||||
$id = $user->id;
|
$id = $user->id;
|
||||||
$results = $this->getEventManager()->trigger('login.success.updateStatus', $this, compact('id'));
|
$results = $this->getEventManager()->trigger('login.success.updateStatus', $this, compact('id'));
|
||||||
|
|
||||||
var_dump($user);
|
|
||||||
exit();
|
|
||||||
return array('success'=>1);
|
return array('success'=>1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cookieLogin($data)
|
public function cookieLogin($data)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$data = $this->getAccountInfo($data['username']);
|
||||||
|
|
||||||
|
if(!$data)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return $this->storeLogin($data,false);
|
return $this->storeLogin($data,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue