As far as I know that feature is broken..
you can check the bug here:
https://rt.cpan.org/Public/Bug/Display.html?id=59595

What I usually do is after the login is successful I add:
$c->session->{remember} = 1 if $c->req->param('remember');

and then in MyApp.pm I override calculate_extended_session_expires like
that:

sub calculate_extended_session_expires {
     my ($c, $prev) = @_;

     if ($c->session->{remember_me}) {
         return time() + 31536000;
     }
     else {
         return $c->NEXT::calculate_extended_session_expires($prev);
     }
}

That's working but I get some warnings that using NEXT:: is deprecated so
you probably could use some method modifier.

Cheers,
Dimitar

On Fri, Feb 17, 2012 at 11:54 AM, Jesse Sheidlower <[email protected]> wrote:

> On Thu, Feb 16, 2012 at 08:42:09PM +0100, Paolo Gianrossi wrote:
> > Hi Jesse,
> >  what I do is (blatantly taken from CatalystX::SimpleLogin source)
> > something like
> >
> >  # in Login controller, and action login
> >
> >  my $parms = $c->request->body_parameters;
> >
> >  if ($c->authenticate({ username => $parms->{username},
> >                                    password => $parms->{password}} )) {
> >              $c->extend_session_expires(999999999999) if
> > $c->request->address =~ m/^192\.168/g; #or whatever way to determine
> local
> > network...
> >
>  $c->response->redirect($c->uri_for_action('whatever/action'));
> >   }
> >   #....
>
> I'm afraid that this did not work. I did test to make sure the IP
> address was being correctly matched, so I know that the
> $c->extend_session_expires(999999999999) was executed. But the affected
> users still had to log in after an hour of non-use.
>
> Any other session experts have a thought?
>
> Jesse Sheidlower
>
> >
> >   HTH!
> >
> > cheers
> > paolino
> >
> > --
> > Paolo Gianrossi
> >
> > (An unmatched left parenthesis
> >  creates an unresolved tension
> >  that will stay with you all day
> >                                    -- xkcd
> >
> >
> >
> > 2012/2/16 Jesse Sheidlower <[email protected]>
> >
> > >
> > > Using Catalyst::Plugin::Session, is there any way to extend a session
> > > _longer_ than the expiry time I give in my conf file? The docs for
> > > session_expire_key say it's only useful if _shorter_ than the default
> > > expiry time.
> > >
> > > The situation I'm trying to solve is basically that I have an app with
> > > local and external users, and I'd like to make it so that users on the
> > > internal network have permanent cookies, and thus don't have to
> re-login
> > > all the time, but outside users have their sessions expire in an hour.
> > >
> > > I suppose I could just set an infinite expiration in my conf file, and
> > > then use session_expire_key to shorten the sessions for external users,
> > > but that seems like the reverse of what I really want, which is to give
> > > more rights to one group, not to give less rights to another.
> > >
> > > Jesse Sheidlower
>
> _______________________________________________
> List: [email protected]
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/[email protected]/
> Dev site: http://dev.catalyst.perl.org/
>
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to