automatically log out after inactivity timeout

22 views
Skip to first unread message

daboe01

unread,
Apr 10, 2016, 1:50:54 PM4/10/16
to Cappuccino & Objective-J
hi gents,
has anybody done this in a generic fashion and is willing to share the details?
thanks and best greetings,
daniel

Keary Suska

unread,
Apr 10, 2016, 3:46:50 PM4/10/16
to objec...@googlegroups.com

> On Apr 10, 2016, at 11:50 AM, 'daboe01' via Cappuccino & Objective-J <objec...@googlegroups.com> wrote:
>
> hi gents,
> has anybody done this in a generic fashion and is willing to share the details?
>

I have had to implement such a thing in a current project, though it isn’t entirely generic, especially as the client-server communication would tend to be implementation-defined, as well as what events reset the timer.

In my case I also pop up a heads-up warning message, which has some complexities to it, as well as timing issues. With the latter it is an issue with having events occur on a whole-minute boundary.

Also I didn’t try to watch all possible events, but my project doesn’t involve any situations where, for instance, someone might be typing a long document and I need to be catching keypresses so I don’t interrupt with a timeout. Fortunately it wouldn’t be hard to do this on a view-by-view basis but there wouldn’t be any global, single-point approach.

In a nutshell, on the front-end you set a repeating CPTimer that invokes a method that checks the “status” of the session, and if it is expired, calls the logout method. I maintain an object that is updated with every back-end call (as I have to coordinate with the back-end session handling) so the front-end always knows when the expiration time is. I keep all of the front-end logic in the AppController as it has global accessibility.

I don’t recall exactly why but I seemed to have the best success having the timer fire at short intervals, currently 60 seconds, rather than trying to have it fire just before an interesting time, such as the early warning point or point of expiration. YMMV.

As I said I am having some issues with my warning message, where it comes up seconds before expiration (when it is supposed to be close to 1 minute), which I haven’t quite solved yet.

If need more detail than this, I am happy to share.

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

daboe01

unread,
Apr 12, 2016, 3:05:45 PM4/12/16
to Cappuccino & Objective-J, cappu...@esoteritech.com
thank you for your helpful insights.
best greetings,
daniel
Reply all
Reply to author
Forward
0 new messages