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\Config;
|
||||
use Westdc\Helpers\Dbh as dbh;
|
||||
use Westdc\Db\Pdo as Db;
|
||||
use Westdc\Db\Db as Zend_Db;
|
||||
use Westdc\Mail\Mail;
|
||||
use Westdc\User\Member;
|
||||
|
||||
|
||||
class Account extends AbstractEventManager implements ServiceManagerAwareInterface
|
||||
{
|
||||
public $memberTable = "tbl_member";
|
||||
|
@ -149,9 +147,11 @@ class Account extends AbstractEventManager implements ServiceManagerAwareInterfa
|
|||
|
||||
if(isset($state['success']))
|
||||
{
|
||||
//$mb = new Member();
|
||||
//$mb->putcookie($data[$this->FieldUsername],md5($data[$this->FieldPasword]));
|
||||
}
|
||||
$user = (array)$state['user'];
|
||||
$this->getEventManager()->trigger('login.success', $this, compact('user'));
|
||||
}else{
|
||||
$this->getEventManager()->trigger('login.failed', $this, compact('data'));
|
||||
}
|
||||
|
||||
return $state;
|
||||
}//login
|
||||
|
@ -184,23 +184,19 @@ class Account extends AbstractEventManager implements ServiceManagerAwareInterfa
|
|||
;
|
||||
|
||||
$result = $authAdapter->authenticate();
|
||||
|
||||
$user = $authAdapter->getResultRowObject(null,array('password'));
|
||||
|
||||
|
||||
if(!$result->isValid())
|
||||
{
|
||||
return array("error"=>"用户信息验证失败");
|
||||
}
|
||||
|
||||
$email = $user->email;
|
||||
$results = $this->getEventManager()->trigger('login.success.createAvatar', $this, compact('email'));
|
||||
$user->avatar = $results->last();
|
||||
$auth->getStorage()->write($user);
|
||||
|
||||
$id = $user->id;
|
||||
$results = $this->getEventManager()->trigger('login.success.updateStatus', $this, compact('id'));
|
||||
|
||||
$user = $authAdapter->getResultRowObject(null,array('password'));
|
||||
$auth->getStorage()->write($user);
|
||||
|
||||
return array('success'=>1);
|
||||
return array(
|
||||
'success'=>1,
|
||||
'user' => $user
|
||||
);
|
||||
}
|
||||
|
||||
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