Subject: | Cookie Expiry Date not set for "remember" session |
Only the first time the plack_session cookie is returned to the browser
the expiry date is set. Every subsequent cookie returned is a session
cookie (without expiry date set). Since the "remember" marker is removed
from the session data there is no chance to set the expiry date again on
the cookie if it is sent again.
My proposed fix is attached:
- remove deletion of remember attribute after setting expiry date on
cookie
- setting the remember attribute on every valid login to the actual
state of the checkbox
- remove remember attribute on logout
Subject: | auth-form-expiry.patch |
--- /usr/share/perl5/vendor_perl/Plack/Middleware/Auth/Form.pm 2011-08-04 21:59:06.000000000 +0200
+++ /usr/share/perl5/vendor_perl/Plack/Middleware/Auth/Form.pm.new 2012-03-20 06:50:23.974449572 +0100
@@ -31,7 +31,6 @@
if( $path ne '/logout' ){
$env->{'psgix.session.options'}{expires} = time + 60 * 60 * 24 * 30;
}
- delete $env->{'psgix.session'}{remember};
}
if( $path eq '/login' ){
@@ -75,7 +74,7 @@
}
if( !$login_error ){
$env->{'psgix.session'}{user_id} = $user_id;
- $env->{'psgix.session'}{remember} = 1 if $params->get( 'remember' );
+ $env->{'psgix.session'}{remember} = ($params->get( 'remember' ) ? 1 : 0);
my $redir_to = delete $env->{'psgix.session'}{redir_to};
$redir_to = '/' if
URI->new( $redir_to )->path eq $env->{PATH_INFO};
@@ -130,6 +129,7 @@
my($self, $env) = @_;
if( $env->{REQUEST_METHOD} eq 'POST' ){
delete $env->{'psgix.session'}{user_id};
+ delete $env->{'psgix.session'}{remember};
}
return [
303,