change user login function
This commit is contained in:
parent
a5e8eb8c06
commit
cb9e731792
|
@ -10,12 +10,10 @@ use Zend\Authentication\Adapter\DbTable;
|
||||||
use Westdc\Helpers\Assist as view;
|
use Westdc\Helpers\Assist as view;
|
||||||
use Westdc\Helpers\Config;
|
use Westdc\Helpers\Config;
|
||||||
use Westdc\Helpers\Dbh as dbh;
|
use Westdc\Helpers\Dbh as dbh;
|
||||||
use Westdc\Db\Pdo as Db;
|
|
||||||
use Westdc\Db\Db as Zend_Db;
|
use Westdc\Db\Db as Zend_Db;
|
||||||
use Westdc\Mail\Mail;
|
use Westdc\Mail\Mail;
|
||||||
use Westdc\User\Member;
|
use Westdc\User\Member;
|
||||||
|
|
||||||
|
|
||||||
class Account extends AbstractEventManager implements ServiceManagerAwareInterface
|
class Account extends AbstractEventManager implements ServiceManagerAwareInterface
|
||||||
{
|
{
|
||||||
public $memberTable = "tbl_member";
|
public $memberTable = "tbl_member";
|
||||||
|
@ -149,8 +147,10 @@ class Account extends AbstractEventManager implements ServiceManagerAwareInterfa
|
||||||
|
|
||||||
if(isset($state['success']))
|
if(isset($state['success']))
|
||||||
{
|
{
|
||||||
//$mb = new Member();
|
$user = (array)$state['user'];
|
||||||
//$mb->putcookie($data[$this->FieldUsername],md5($data[$this->FieldPasword]));
|
$this->getEventManager()->trigger('login.success', $this, compact('user'));
|
||||||
|
}else{
|
||||||
|
$this->getEventManager()->trigger('login.failed', $this, compact('data'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return $state;
|
return $state;
|
||||||
|
@ -185,22 +185,18 @@ class Account extends AbstractEventManager implements ServiceManagerAwareInterfa
|
||||||
|
|
||||||
$result = $authAdapter->authenticate();
|
$result = $authAdapter->authenticate();
|
||||||
|
|
||||||
$user = $authAdapter->getResultRowObject(null,array('password'));
|
|
||||||
|
|
||||||
if(!$result->isValid())
|
if(!$result->isValid())
|
||||||
{
|
{
|
||||||
return array("error"=>"用户信息验证失败");
|
return array("error"=>"用户信息验证失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
$email = $user->email;
|
$user = $authAdapter->getResultRowObject(null,array('password'));
|
||||||
$results = $this->getEventManager()->trigger('login.success.createAvatar', $this, compact('email'));
|
|
||||||
$user->avatar = $results->last();
|
|
||||||
$auth->getStorage()->write($user);
|
$auth->getStorage()->write($user);
|
||||||
|
|
||||||
$id = $user->id;
|
return array(
|
||||||
$results = $this->getEventManager()->trigger('login.success.updateStatus', $this, compact('id'));
|
'success'=>1,
|
||||||
|
'user' => $user
|
||||||
return array('success'=>1);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cookieLogin($data)
|
public function cookieLogin($data)
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Created by PhpStorm.
|
|
||||||
* User: Administrator
|
|
||||||
* Date: 2014/11/4
|
|
||||||
* Time: 11:23
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace Westdc\Service\ServiceAgent;
|
|
||||||
|
|
||||||
use Westdc\Member\Account as Westdc_Account;
|
|
||||||
|
|
||||||
class Account extends Westdc_Account{
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue