Hey Dennis,
Unfortunately, out of the box, you cannot limit the user to one active session. However, since Vanguard supports the database session driver, it's easy enough to customize it to allow only one active session per user.
A high-level overview of what you need to do is the following:
1. Make sure that you use a database session driver.
2. Update the login method within app/Http/Controllers/Web/Auth/LoginController.php controller and add the following check right after "$user->isBanned()" if statement:
// ...
$activeSessions = app(\Vanguard\Repositories\Session\SessionRepository::class)
->getUserSessions($user->id);
if (count($activeSessions) >= 1) {
return redirect()->to('login' . $to)
->withErrors(__('You are already logged in on another device.'));
}
// ...
Kind regards,
Milos
Thank you Milos.
I tried this and it works !
regards
Dennis