I am developing a website where in user is required to login to the system to be able to use it. The current functionality is: When user enters username and password, a check is made in DB to check if that user exists and if he has entered a correct password. Only then allow that user to login.
It was fine till this point, now client wants to add one more functionality to the logging feature, ie client would like to restrict only 1 session for that user to exists.
ie. if user1 is logged in from one browser of the PC then he should not be allowed to login from another system or another browser of the same PC.
How do I do that? I was planning to do it using a bit field in my database which will be set when user logs in 1st time. And if he tries to logging 2nd time check that field and allow to login only if bit field is not set.
But I feel it will cause issues,
1) if user by mistake closes the tab of the browser and tries to log in again he will not able to do so as the bit field will still be set in DB
2) when will the set field will have be cleared if users closes the browser by mistake?
If there is any other way to implement it then you are free to point me in a correct direction.
As pointed by some of the fellow members there are duplicates to this question but those questions are not really what I am looking for, as they are using form based authentication and I am not
.