[Seaside] Autologout implementation
Boris Popov
boris at deepcovelabs.com
Sun Apr 27 19:50:33 UTC 2008
I think he wanted the app to go back to the home page automatically when auto expiring. In which case you can just add a refresh periodical with lifetime just a tad longer than a session timeout.
Cheers!
-Boris (via BlackBerry)
----- Original Message -----
From: seaside-bounces at lists.squeakfoundation.org <seaside-bounces at lists.squeakfoundation.org>
To: Seaside - general discussion <seaside at lists.squeakfoundation.org>
Sent: Sun Apr 27 11:40:45 2008
Subject: Re: [Seaside] Autologout implementation
2008/4/27, Stefan Schmiedl <s at xss.de>:
> How would you implement automatic logout after a given period of
> inactivity?
Set the session timeout to this value.
Cheers
Philippe
> The app is running in a workshop, where a bunch of people use the same
> machine to access their scheduled tasks and other stuff. They will often
> leave "their" last page on the screen, so the goal donor requested an
> automated reload of the starting page.
>
> I did this for another app (in IOWA on Ruby) by meta-refreshing to the
> "/logout" page, which in turn expired the session and redirected to the
> starting page.
>
> Below is what I came up with in Seaside. This decoration is
> autmatically added to the pages if the users are in the autologout
> category.
>
> Has anybody a better idea for this?
>
> Thanks,
> s.
>
>
> Smalltalk.HS defineClass: #AutoLogoutDecoration
> superclass: #{Seaside.WADecoration}
> indexedType: #none
> private: false
> instanceVariableNames: 'delay '
> classInstanceVariableNames: ''
> imports: ''
> category: ''!
>
> "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
>
>
> !HS.AutoLogoutDecoration class methodsFor: 'instance creation'!
>
> delay: seconds
>
> ^(self new) delay: seconds;
> yourself! !
>
> "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
>
>
> !HS.AutoLogoutDecoration methodsFor: 'updating'!
>
> updateRoot: root
>
> root redirectTo: self urlForExpiry asString
> delay: self delay!
>
> urlForExpiry
>
> Continuation currentDo: [:cc | ^self session actionUrlForContinuation: cc].
> (self session) expire;
> redirect! !
>
> !HS.AutoLogoutDecoration methodsFor: 'accessing'!
>
> delay
> ^delay!
>
> delay: anObject
> delay := anObject! !
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
_______________________________________________
seaside mailing list
seaside at lists.squeakfoundation.org
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20080427/85a90c80/attachment.htm
More information about the seaside
mailing list