On 2/20/07, Gavin Henry <[EMAIL PROTECTED]> wrote:
Dear All,
How would you advise implementing an automated logout system?
Polling via js?
Server side timing?
Not sure, but I've seen many sites (banking etc.) do this.
Thanks,
Gavin.
--
Walking the road to enlightenment... I found a penguin and a camel on the
way..... Fancy a [EMAIL PROTECTED] Just ask!!!
http://perlmonks.org/?node_id=386673
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
Hi Gavin,
If you aren't doing any AJAX interactions, the simple approach is to
add a JavaScript listener to the onload event that calls the following
(untested) function:
var activityTimer;
function setActivityTimeout(time) {
if ( activityTimer ) clearTimeout(activityTimer);
activityTimer = window.setTimeout( function() {
alert("You have been logged out.");
document.location = "/";
}, time || 600);
}
On each page unload, this timer will be canceled. If you do any AJAX
loads that count as activity, simply call setActivityTimeout() on the
initiation of the remote event. And, of course, expire the session on
the server to match whatever is your client side time out as well.
-J
--
J. Shirley :: [EMAIL PROTECTED] :: Killing two stones with one bird...
http://www.toeat.com - http://code.toeat.com/~jshirley
_______________________________________________
List: [email protected]
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/