public function logoutAction() { $auth = new AuthenticationService(); if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); } $auth->clearIdentity(); $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); return $this->redirect()->toRoute('myauth', array('controller' => 'index', 'action' => 'login')); }
public function logoutAction() { $auth = $this->getServiceLocator()->get('Zend\\Authentication\\AuthenticationService'); if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); } $auth->clearIdentity(); $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); return $this->redirect()->toRoute('home/login'); }
public function logoutAction() { $authService = $this->_get_auth_service(); if ($authService->hasIdentity()) { // Identity exists; get it $identity = $authService->getIdentity(); } $authService->clearIdentity(); $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); return $this->redirect()->toRoute('home'); }
public function logoutAction() { $auth = $this->getServiceLocator()->get('Zend\\Authentication\\AuthenticationService'); // @todo Set up the auth adapter, $authAdapter if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); } $auth->clearIdentity(); $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute()); }
public function logoutAction() { $auth = new AuthenticationService(); // or prepare in the globa.config.php and get it from there // $auth = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService'); if ($auth->hasIdentity()) { $identity = $auth->getIdentity(); } $auth->clearIdentity(); // $auth->getStorage()->session->getManager()->forgetMe(); // no way to get the sessionmanager from storage $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); return $this->redirect()->toRoute('auth/default', array('controller' => 'index', 'action' => 'login')); }
public function logoutAction() { // in the controller // $auth = new AuthenticationService(); $auth = $this->getServiceLocator()->get('Zend\\Authentication\\AuthenticationService'); // @todo Set up the auth adapter, $authAdapter if ($auth->hasIdentity()) { // Identity exists; get it $identity = $auth->getIdentity(); //- echo '<pre>'; //- print_r($identity); //- echo '</pre>'; } $auth->clearIdentity(); //- $auth->getStorage()->session->getManager()->forgetMe(); // no way to get to the sessionManager from the storage $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); // $view = new ViewModel(array( // 'message' => 'Hello world', // )); // $view->setTemplate('foo/baz-bat/do-something-crazy'); // return $view; // return $this->redirect()->toRoute('home'); return $this->redirect()->toRoute('auth-doctrine/default', array('controller' => 'index', 'action' => 'login')); }
public function signOutAction() { // $auth = $this->getServiceLocator()->get('Zend\Authentication\AuthenticationService'); if ($this->doctineAuthenticationService->hasIdentity()) { $this->doctineAuthenticationService->clearIdentity(); $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); } return $this->redirect()->toRoute($this->redirects['after-sign-out']['route']); // return $this->redirectToRefer(); }
/** * Logout and clear the identity */ public function logoutAction() { $this->UserAuthentication()->getAuthAdapter()->resetAdapters(); $this->UserAuthentication()->getAuthAdapter()->logoutAdapters(); $this->getServiceLocator()->get('user_remember')->forgetMe(); $this->UserAuthentication()->getAuthService()->clearIdentity(); $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); $redirect = $this->params()->fromPost('redirect', $this->params()->fromQuery('redirect', false)); if ($this->getOptions()->getUseRedirectParameterIfPresent() && $redirect) { return $this->redirect()->toUrl($redirect); } return $this->redirect()->toRoute($this->getOptions()->getLogoutRedirectRoute()); }
public function signOutAction() { $auth = $this->getServiceLocator()->get('Zend\\Authentication\\AuthenticationService'); if ($auth->hasIdentity()) { $auth->clearIdentity(); $sessionManager = new \Zend\Session\SessionManager(); $sessionManager->forgetMe(); } return $this->redirect()->toRoute('om-zf2-user-account-sign-in'); }