diff --git a/Westdc/Helpers/Auth.php b/Westdc/Helpers/Auth.php index ecd87f0..11c132c 100644 --- a/Westdc/Helpers/Auth.php +++ b/Westdc/Helpers/Auth.php @@ -7,6 +7,7 @@ use Zend\Authentication\Storage\Session as SessionStorage; class Auth { public $auth; + function __construct($getAuthService = false) { $config = Config::get(); @@ -25,11 +26,23 @@ class Auth return $this->auth->clearIdentity(); } - public function getIdentity($field) + public function getIdentity($field = "") { + if(empty($field)) + return $this->auth->getIdentity(); + if(isset($this->auth->getIdentity()->$field)) return $this->auth->getIdentity()->$field; else return null; } + + public function write($user) + { + + if(is_array($user)) + $user = (object)$user; + + $this->auth->getStorage()->write($user); + } } \ No newline at end of file diff --git a/Westdc/Member/Account.php b/Westdc/Member/Account.php index b4b2335..d9856ae 100644 --- a/Westdc/Member/Account.php +++ b/Westdc/Member/Account.php @@ -130,7 +130,7 @@ class Account extends AbstractEventManager implements ServiceManagerAwareInterfa //登陆 public function login($data) { - $results = $this->getEventManager()->trigger('login.checkParam', $this, compact('data')); + $results = $this->getEventManager()->trigger('login.pre', $this, compact('data')); $cache_data = $results->last(); if($cache_data !== true)