change user login function

This commit is contained in:
Jianxuan Li 2015-01-16 23:37:40 +08:00
parent a5e8eb8c06
commit cb9e731792
2 changed files with 13 additions and 34 deletions

View File

@ -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,8 +147,10 @@ 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;
@ -185,22 +185,18 @@ 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();
$user = $authAdapter->getResultRowObject(null,array('password'));
$auth->getStorage()->write($user);
$id = $user->id;
$results = $this->getEventManager()->trigger('login.success.updateStatus', $this, compact('id'));
return array('success'=>1);
return array(
'success'=>1,
'user' => $user
);
}
public function cookieLogin($data)

View File

@ -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{
}