checking if user is already logged in through cfloginuser
I'm using cfloginuser as a security mechanism in my application to secure web service calls that are being made.
One thing I would like to do is stop a second user from logging into the same account when they are already logged into another computer. Essentia开发者_如何学Golly what's happening, is that since both share the same username, the first one to login just gets kicked out as a logged in a user once the second login occurs.
Is there anyway I can check if a particular username is already logged in, therefore not even allowing the second login to even authenticate? (You can only be logged into one computer at a time)
The only way I can think of would be to store the user name in the application scope, and then remove it when they sign out. (and add it OnSessionEnd in your application.cfc in case they don't click the sign out link)
Then, when a user signs in, check the list of signed in users in your application scope, and don't allow them to do it a second time if the name is there.
Do keep in mind what Peter said, though. I think it is a good point.
精彩评论