[Catalyst] Session cookie and permanent state

Bill Moseley moseley at hank.org
Sat Sep 23 15:05:40 CEST 2006


On Sat, Sep 23, 2006 at 04:15:48AM +0000, fayland wrote:
> hey, we have one function in our login interface like "remember me?" 
> guess it's very common.
> I have some code as follows:
> ------------------
> if ($c->login($username, $password) {
>         # make cookie expire
>         if ($c->req->param('permanent')) {
>             $c->session_expire_key( __user => 1000000000000 );
>             $c->update_session_cookie( $c->make_session_cookie( 
> $c->sessionid, expires => 1000000000000 ) ); # forever
>         } else {
>             $c->update_session_cookie( $c->make_session_cookie( 
> $c->sessionid, expires => 0 ) );
>         }
> }
> -------------------
> I bet there is something wrong. anyone can give me a hand?
> Thanks.

For one thing, 1000000000000 is too big.

I'd use a separate cookie for "remember me" -- I think that's
different then from the session.





-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list