Set pdata cookie only if needed (#1461)
This commit is contained in:
parent
8de024ddb6
commit
854cf7be77
|
@ -34,9 +34,11 @@ sub handler {
|
|||
|
||||
bless $req, 'Lemonldap::NG::Portal::Main::Request';
|
||||
$req->init();
|
||||
my $sp = 0;
|
||||
|
||||
# Restore pdata
|
||||
if ( my $v = $req->cookies->{ $self->conf->{cookieName} . 'pdata' } ) {
|
||||
$sp = 1;
|
||||
eval { $req->pdata( JSON::from_json($v) ); };
|
||||
if ($@) {
|
||||
$self->logger->error("Bad JSON content in cookie pdata");
|
||||
|
@ -46,6 +48,7 @@ sub handler {
|
|||
my $res = $self->Lemonldap::NG::Common::PSGI::Router::handler($req);
|
||||
|
||||
# Save pdata
|
||||
if ( $sp or %{ $req->pdata } ) {
|
||||
my %v = (
|
||||
name => $self->conf->{cookieName} . 'pdata',
|
||||
(
|
||||
|
@ -55,6 +58,7 @@ sub handler {
|
|||
)
|
||||
);
|
||||
push @{ $res->[1] }, 'Set-Cookie', $self->cookie(%v);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user