/** * Logout user * * @param array $userIdentity * @return void */ protected function logoutUser(array $userIdentity) { // clear logged user's identity UserIdentityService::getAuthService()->clearIdentity(); // skip a remember me time $this->getServiceLocator()->get('Zend\\Session\\SessionManager')->rememberMe(0); // fire the user logout event UserEvent::fireLogoutEvent($userIdentity['user_id'], $userIdentity['nick_name']); }
/** * Logout */ public function ajaxLogoutAction() { $request = $this->getRequest(); if ($this->isGuest() || !$request->isPost()) { return $this->createHttpNotFoundModel($this->getResponse()); } // clear logged user's identity $user = UserIdentityService::getCurrentUserIdentity(); UserIdentityService::getAuthService()->clearIdentity(); $this->serviceLocator->get('Zend\\Session\\SessionManager')->rememberMe(0); // fire the user logout event UserEvent::fireLogoutEvent($user['user_id'], $user['nick_name']); return $this->getResponse(); }