[Catalyst] Check session expiry without extending it

Ben van Staveren benvanstaveren at gmail.com
Thu Mar 4 17:26:56 GMT 2010


The way I got around this was by sticking all ajax stuff in a separate =

controller hierarchy that would return special content based on the =

request and whether or not the session lived. for json it'd just return =

a specific flag in the object it'd throw out (which was parsed by a =

global callback before calling my user defined stuff) that'd gracefully =

error the request for that, and any text/html would just output a script =

that'd toss up a dialog that said the session expired, and that the user =

should log in again.

Clunky, but it works, sort of.

Bill Moseley wrote:
>
>
> On Thu, Mar 4, 2010 at 7:05 AM, Peter Karman <peter at peknet.com =

> <mailto:peter at peknet.com>> wrote:
>
>
>     // make sure we are logged in before every xhr request
>     Ext.Ajax.on('beforerequest', function(conn, opts) {
>        if (!AIR.Auth.isAuthenticated()) {
>            AIR.Auth.login();
>            return false;
>        }
>        return true;
>     });
>
>
> I thought about this, but in our case the ajax was checking for a =

> specific session because the server-side session had state info need =

> for the ajax request.  So, just allowing the user to log in again was =

> not possible.
>
> That's probably bad design on top of bad design.  In our case probably =

> better to rethink  then entire process and just make request that can =

> be independent and either work or fail in some graceful way.  making =

> assumptions about expected state is problem the root cause.
>
>  =

>
> -- =

> Bill Moseley
> moseley at hank.org <mailto:moseley at hank.org>
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.u=
k/
> Dev site: http://dev.catalyst.perl.org/
>   =


-- =

Ben van Staveren
phone: +62 81 70777529
email: benvanstaveren at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100305/544bb=
3db/attachment.htm


More information about the Catalyst mailing list