Hello, I have a problem when I try to get a attribute after user click on
logout:
This is my code:
I have two listener, one to listen core.controller
class CheckControllerListener
{
public function onCoreController(FilterControllerEvent $event)
{
if (HttpKernelInterface::MASTER_REQUEST ===
$event->getRequestType()) {
$aController = $event->getController();
if (isset($aController[0]) && $aController[0] instanceof
MyController ) {
$controller = $aController[0];
$controller->preExecute();
}
}
}
}
and one for security.interactive_login:
class UserLoginListener
{
protected $session;
public function __construct(Session $session)
{
$this->session = $session;
}
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
{
$this->session->set('check_session', false);
}
}
Then in MyController I have this method:
public function preExecute()
{
$session = $this->get('request')->getSession();
$user = $this->get('security.context')->getToken()->getUser();
// Check if user have 'check_session' attribute in his session
if($session->has('check_session'))
{
if($session->get('check_session') == false &&
$user->isGranted('ROLE_USER'))
{
// Do something...
}else{
$session->set('check_session', true);
}
}else{
// initialize option
$session->set('check_session', true);
}
}
I test this:
-User is not logged, check_session is true. OK
-Then User is logged, check_session is false. OK
-Then User click on logout, and $session->has('check_session') return false.
Why ?
Thank you
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en