there's no especially sane way to extend the session cookie on a per- user basis that i have found.

here is a hack that i am experimenting with:

if ($c->login($username, $password)) {
    $c->session->{remember_me} = $c->req->params->{remember_me};
    # ...
}

and in package MyApp.pm (or a plugin or a subclass of the State::Cookie plugin or ...)

sub calculate_session_cookie_expires {
    my $c = shift;
    return $c->session->{remember_me}
        ? time() + 60 * 60 * 24 * 90   # 90 days
        : $c->NEXT::calculate_session_cookie_expires(@_);
}


On May 15, 2007, at 6:47 PM, Evaldas Imbrasas wrote:

On 5/15/07, Jonathan Rockway <[EMAIL PROTECTED]> wrote:
Use the session plugin and set the session expiration to ... 1 week. If some
data needs to expire sooner than that ... expire it sooner than that.

Here's what I would do. Create a session and log the user in. Store a "last
login" time in the user_class.  If the last_login (or last_activity;
whatever) is too long ago, delete data from the session and start over.

Yep, makes sense. However, even in that case, I was hoping that the
standard session/auth plugins would support this functionality without
doing anything additional in my Controller::Auth, i.e.:

if ($c->req->params->{login_remember}) {
 $c->login($email, $password, $expires_long);
} else {
 $c->login($email, $password, $expires_short);
}

Am I wrong in thinking that pretty much any decent login system has to
support this anyway?.. (This is my first Catalyst project, so I
wouldn't be surprised if there's a one-liner out there that would
solve this problem without a need for the above - sorry if that's the
case.)

--
-----------------------------------------------------
Evaldas Imbrasas
http://www.imbrasas.com

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/ catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

---
michael reece :: software engineer :: [EMAIL PROTECTED]



_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to