[Catalyst] Session expiry per user
Matt Lawrence
matt.lawrence at ymogen.net
Fri Mar 14 11:55:03 GMT 2008
Alexandre Jousset wrote:
> Hello list,
>
> I've problems to set session expiry time per user.
>
> My goal is to have a default expiry time of "until you quit the
> browser" unless the user logs in and select a checkbox to have the
> site "remember" her (i.e. set expiry time to 1 year).
>
> I use the following plugins for session management :
>
> Session Session::State::Cookie Session::Store::DBI
>
> I've looked at the docs and I've only found a way to set expiry
> time in MyApp.pm, and even with this I don't know how to set it for
> "until you quit the brower". If I put 0 the session expires immediately.
>
> To set the longer expiry time, I try:
>
> $c->config->{session}{expires} = 31536000 if
> $c->req->param('remember_me');
I think that will make the cookie expire on the 1st January 1971. Try
"+31536000".
I have a feeling that an undef expiry will result in a session cookie,
based on nothing more than guesswork and superstition.
Matt
More information about the Catalyst
mailing list