Forcing logout of users when user logs in again?

Is there actually any way to logout an already logged in user when the same users logs in over another browser or computer?
I know that there is the Logged User Session Name session variable. But how would I use this to kill the current ongoing session for the already logged in user?
I cannot direct the 'Security Logout' component to log out a specific user.

I found this: Auto Log Out on browser or browser tab close? (which didn't really help). And then I found this: How to logout on multiple domains?.

I will tinker around a bit, but I guess it won't be possible without eating some cookies on the user side?

Instead of using a normal login Security Provider step, use the password verify step to check the password from the login form. If matched, then set a field in your DB against the user to a new string value (such as a UUID). Use that value as the password for a traditional login step and set remember to 1 with a really short session time.

Because you are changing the value on new logins, old cookies will no longer have the correct ‘password’ and will fail, prompting a new login

1 Like

Another way, I remember doing it on some test with:
Insert UUID to a table when user login, set cookie like, "token"
On each server action retrieve the last one uuid and compare it, if not same then logout.

1 Like

Both solutions sound like the perfect way.
I will probably try out both tomorrow morning. Thank you very much guys! You are really a giant help :grin:.

Complementing @ franse, you can put steps in Globals that will run on each server action. If the session guard doesn't match what's in the database, run a Security Logout step.

1 Like