[Catalyst] Session expiry per user

Alexandre Jousset mid at gtmp.org
Fri Mar 14 16:07:23 GMT 2008


	Hello Bill,

Bill Moseley a écrit :
>> 	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).
> 
> There's a plugin that is designed for that:
> 
> http://search.cpan.org/~nuffin/Catalyst-Plugin-Session-DynamicExpiry-0.02/lib/Catalyst/Plugin/Session/DynamicExpiry.pm
> 
> I'm not using it, but I looked at it in detail one day and had some
> problems.  I think I posted a patch.  Yes, December 5th with the
> subject Patch for Catalyst::Plugin::Session::DynamicExpiry

	You posted a patch against a version 0.03. On CPAN the version is 0.02. 
I googled to find the SVN but with no luck. Can you tell me where it is 
please?

	I've also found a Catalyst::Plugin::Session::DynamicExpiry::Cookie (not 
on CPAN) that does the job.

	I've spent a lot of time on it because Firefox *keeps session cookies* 
when you close all tabs and ask it to restore session on 
reopen.......... Maybe it's FF that does this, maybe it's an extension, 
I don't know. The fact is that I've had to close the FF tab before the 
FF window in order to dismiss the cookie...

	I still have problems with the cookie TTL and the session TTL. With the 
module cited above, it does not seem to take into account my setting:

	$c->session_time_to_live(31536000) if $c->req->param('rme');

	and instead use the default session TTL (2 hours, I see that in my 
`sessions` table).

	Maybe I'm mixing wrongly session TTL and cookie TTL but I thought 
$c->session_time_to_live(x) refered to session, not cookie. However it 
seems to refer to cookie.

	Anyway, with setting session TTL to 1 year, it now works as I want 
(maybe not as it should?).

	Thanks a lot to you all!

PS : After some thinking I believe I start to understant it all ;-) but 
it's very confusing...
-- 
--      \^/                                            --
--    -/ O \---------------------------------------    --
--   | |/ \|      Alexandre (Midnite) Jousset      |   --
--    -|___|---------------------------------------    --



More information about the Catalyst mailing list