Add support for browser-session cookies, using a cookieTTL value of
"session".
This commit is contained in:
parent
31cbd665e6
commit
a170904340
3 changed files with 9 additions and 3 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
- fix: Spectre pings not using correct IP address
|
- fix: Spectre pings not using correct IP address
|
||||||
- fix: search functionality throwing fatal errors
|
- fix: search functionality throwing fatal errors
|
||||||
- fix: DBI connect errors infinitely recurse
|
- fix: DBI connect errors infinitely recurse
|
||||||
|
- add: setting cookieTTL to "session" now creates browser-session cookies
|
||||||
|
|
||||||
7.0.7
|
7.0.7
|
||||||
- rfe: Image Management (funded by Formation Design Systems)
|
- rfe: Image Management (funded by Formation Design Systems)
|
||||||
|
|
|
||||||
|
|
@ -241,13 +241,16 @@ sub getCookieName {
|
||||||
|
|
||||||
=head2 getCookieTTL ( )
|
=head2 getCookieTTL ( )
|
||||||
|
|
||||||
Returns the cookie time to live defined in the config file. Returns "10y" if one isn't defined.
|
Returns the cookie time to live defined in the config file. Returns "+10y" if one isn't defined.
|
||||||
|
This may also be "session" to indicate that the cookie should only live for the current browser
|
||||||
|
session.
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
sub getCookieTTL {
|
sub getCookieTTL {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
return $self->get("cookieTTL") || "+10y";
|
my $configTTL = $self->get("cookieTTL");
|
||||||
|
return defined($configTTL)? $configTTL : "+10y";
|
||||||
}
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,7 @@ The value to set.
|
||||||
=head3 timeToLive
|
=head3 timeToLive
|
||||||
|
|
||||||
The time that the cookie should remain in the browser. Defaults to "+10y" (10 years from now).
|
The time that the cookie should remain in the browser. Defaults to "+10y" (10 years from now).
|
||||||
|
This may be "session" to indicate that the cookie is for the current browser session only.
|
||||||
|
|
||||||
=head3 domain
|
=head3 domain
|
||||||
|
|
||||||
|
|
@ -291,9 +292,10 @@ sub setCookie {
|
||||||
my $cookie = Apache2::Cookie->new($self->session->request,
|
my $cookie = Apache2::Cookie->new($self->session->request,
|
||||||
-name=>$name,
|
-name=>$name,
|
||||||
-value=>$value,
|
-value=>$value,
|
||||||
-expires=>$ttl,
|
|
||||||
-path=>'/'
|
-path=>'/'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$cookie->expires($ttl) if $ttl ne 'session';
|
||||||
$cookie->domain($domain) if ($domain);
|
$cookie->domain($domain) if ($domain);
|
||||||
$cookie->bake($self->session->request);
|
$cookie->bake($self->session->request);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue