How can I prevent a register user from accessing the site from multiple devices?
I create a function onSecurityInteractiveLogin in a EventListener
<?php
namespace App\EventListener;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
class LoginListener
{
public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
{
$user = $event->getAuthenticationToken()->getUser();
$session = $event->getRequest()->getSession();
//TODO validate if that user is logged in
}
}
But I can't get if the user is logged in other device and close that session, I found a solution but in Symfony 2.3 in here.
Can anybody explain me a solution in Symfony 4?