user has loged in

17 views
Skip to first unread message

Arleston Lueders

unread,
Oct 19, 2012, 4:36:57 PM10/19/12
to cfwh...@googlegroups.com
Hi Folks,

I would like to know how can I restrict access for just one user in my application. If another user log in with the same ID, it blocks or shows a message "Just alowed 1 login per user".

How can I know when this user has loged off? I would like to implement this in my app, but not sure where to start.

Thanks guys.

Chris G

unread,
Oct 19, 2012, 4:56:12 PM10/19/12
to cfwh...@googlegroups.com
There may be a better way, but my first thought is to track the logged in userId in the application scope. When a new user logs in, validate their credentials and make sure that ID doesn't already exist in the application scope.

Risto

unread,
Oct 19, 2012, 8:03:21 PM10/19/12
to cfwh...@googlegroups.com
Just set a flag called loggedin or something in the db. When the user logs in check by doing where user "whatever" and loggedin eq false. If someone is already logged in with that user
display your message.

When the user clicks logout just set the loggedin flag back to false and log them out. Obviously you could make this as sophisticated as you want, but that's the basics.

I'm also writing this not having any idea how you authenticate, or even if your using a database.

Chris G

unread,
Oct 19, 2012, 8:19:31 PM10/19/12
to cfwh...@googlegroups.com
that would work, assuming the user is responsible enough to logout explicitly. That may or may not be realistic.

even with the application variable approach, you'd have to worry about user's simply walking away from their machine, so with either approach, you'd have to develop a mechanism that times out.

You'd want something you could refresh whenever there is activity. I'd hate to track that with a DB call everytime. I'd still go with the application variable because everytime that user loads a new page, you could refresh the variable. If the user walks away, that variable will disappear automatically once the timeout has been reached (right?)

Per Djurner

unread,
Oct 20, 2012, 3:13:09 AM10/20/12
to cfwh...@googlegroups.com
Sounds like onSessionEnd would be useful here.
--
You received this message because you are subscribed to the Google Groups "ColdFusion on Wheels" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cfwheels/-/sqt2IlsjkBgJ.
To post to this group, send email to cfwh...@googlegroups.com.
To unsubscribe from this group, send email to cfwheels+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cfwheels?hl=en.
Reply all
Reply to author
Forward
0 new messages