I use the "Remeber me" function in Symfony 2.3, but because of my other program and symfony to realize simultaneous login, while exiting, but there is no interface to call me like "remeber me" function, only login function, so , I think it is possible to listen to the SF automatic login, and then in the monitoring inside call the program's login interface, so that you can achieve synchronous login, synchronous exit
Reply content:
I use the "Remeber me" function in Symfony 2.3, but because of my other program and symfony to realize simultaneous login, while exiting, but there is no interface to call me like "remeber me" function, only login function, so , I think it is possible to listen to the SF automatic login, and then in the monitoring inside call the program's login interface, so that you can achieve synchronous login, synchronous exit
You can listen to the Security.interactive_login event to intervene every time you log in to a successful scene.
The event is symfony\component\security\http\event\interactiveloginevent; your listening method:
use Symfony\Component\Security\Core\Authentication\Token\RememberMeToken;public function onLogin(InteractiveLoginEvent $event){ // 你可以在这里执行同步操作 // 如果你想区分主动登录和自动登录: $token = $event->getAuthenticationToken(); if ($token instanceof RememberMeToken) { // 是自动登录 }}