Hmm, there were still some problems. It only seems to work when listening to
the finish event and clearing the session if it matcher zfcuser/login

    public function onBootstrap(\Zend\Mvc\MvcEvent $e) {

                $app = $e->getParam('application');
                $em  = $app->getEventManager()->getSharedManager();
                $app->getEventManager()->attach('finish', array($this, 
'onFinish'));

    }

        public function onFinish(\Zend\Mvc\MvcEvent $e){
        $app        = $e->getTarget();
        $match      = $app->getMvcEvent()->getRouteMatch();
        $controller = $match->getParam('controller');
        $action     = $match->getParam('action');


                $sm         = $app->getServiceManager();
                $userService = $sm->get('zfcuser_user_service');
                $authService = $userService->getAuthService();

                if(!$authService->hasIdentity() AND $controller == 'zfcuser' 
AND ($action
== 'login')){
                        $session = new \Zend\Session\Container('***');
                        $session->getManager()->destroy();
                }
        }




--
View this message in context: 
http://zend-framework-community.634137.n4.nabble.com/ZF2-ZfcUser-Clear-Sessions-before-login-tp4657794p4657799.html
Sent from the Zend Framework mailing list archive at Nabble.com.

-- 
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]


Reply via email to