[Seaside] Autologout implementation
Philippe Marschall
philippe.marschall at gmail.com
Sun Apr 27 18:40:45 UTC 2008
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
>
More information about the seaside
mailing list