fixed bug in user login action

This commit is contained in:
Li Jianxuan 2015-01-08 04:47:25 +00:00
parent 5525ac67e5
commit 0898797ca4
2 changed files with 15 additions and 10 deletions

View File

@ -152,12 +152,13 @@ class Account implements EventManagerAwareInterface
//storeLogin
private function storeLogin($data,$md5 = true)
{
$auth = new AuthenticationService();
$auth->setStorage(new SessionStorage($this->config->session_namespace));
$user = (object)$data;
{
unset($data['password']);
$user = (object)$data;
$auth = new AuthenticationService();
$auth->setStorage(new SessionStorage($this->config->session_namespace));
$email = $user->email;
$results = $this->getEventManager()->trigger('login.success.createAvatar', $this, compact('email'));
$user->avatar = $results->last();
@ -165,7 +166,9 @@ class Account implements EventManagerAwareInterface
$id = $user->id;
$results = $this->getEventManager()->trigger('login.success.updateStatus', $this, compact('id'));
var_dump($user);
exit();
return array('success'=>1);
}

View File

@ -7,6 +7,7 @@ use Sookon\User\Gravatar;
use Sookon\Helpers\View as view;
use Zend\EventManager\EventInterface;
use Sookon\User\Config;
use Sookon\Helpers\Config as ConfigHelper;
class LoginHandle implements \Sookon\User\Event\LoginEvent
{
@ -22,8 +23,9 @@ class LoginHandle implements \Sookon\User\Event\LoginEvent
{
$this->db = new Db();
$this->conf = Config::get();
$config = Config::get('sync');
$config = ConfigHelper::get('sync');
$this->dsn = array(
array('host'=>$config->qinghaihu->hostname,'db'=>$config->qinghaihu->database,'user'=>$config->qinghaihu->username,'pwd'=>$config->qinghaihu->password),
array('host'=>$config->sanjiangyuan->hostname,'db'=>$config->sanjiangyuan->database,'user'=>$config->sanjiangyuan->username,'pwd'=>$config->sanjiangyuan->password),
@ -121,7 +123,7 @@ class LoginHandle implements \Sookon\User\Event\LoginEvent
$sql = "SELECT * FROM $memberTable WHERE {$this->conf->field->uname}=?";
$sth = $db->prepare($sql);
$rs = $sth->execute(array($username));
$row = $sth->fetch();
$row = $sth->fetch(\PDO::FETCH_ASSOC);
if(!isset($row['id']) || empty($row['id']))
{