Prevent users from logining more than one browser/device

Not that I know of.

The problem with web apps is that you can never be sure a user is still logged in, as often just closing the browser gives no indication you’ve gone away. This makes knowing for certain if a user is actually logged in at any point in time rather difficult.

You could set up a timer on the client that calls a server function every x minutes, which in turn updates a “last_pinged” column in your users table.

When that user attempts to log in, you could check the “last_pinged” time to see if it is older than x minutes. If it is, you can assume the other login to be dead, and replace it with the new one. If it is within the time, you could display “You appear to be logged in elsewhere. Try again in X minutes”.

Does that make sense?