Block user login if he's already logged in on another device

Hi!
I’d like to prevent a user from login when he is already logged in on other device or other browser.
Could you tell me how can achieve this?

I’ve found some infor about $_SESSION['cockpit.app.auth']['user'] but how can I use it?