Append debug messages & Fix issue (#1509)
This commit is contained in:
parent
67e9dc23b1
commit
aaaa8f54f5
|
@ -44,17 +44,17 @@ sub getStatus {
|
|||
if ( $ENV{LLNGSTATUSHOST} ) {
|
||||
require IO::Socket::INET;
|
||||
foreach ( 64322 .. 64331 ) {
|
||||
if ( $statusOut =
|
||||
IO::Socket::INET->new( Proto => 'udp', LocalPort => $_ ) )
|
||||
if ( $statusOut
|
||||
= IO::Socket::INET->new( Proto => 'udp', LocalPort => $_ ) )
|
||||
{
|
||||
$args =
|
||||
' host=' . ( $ENV{LLNGSTATUSCLIENT} || 'localhost' ) . ":$_";
|
||||
$args = ' host='
|
||||
. ( $ENV{LLNGSTATUSCLIENT} || 'localhost' ) . ":$_";
|
||||
last;
|
||||
}
|
||||
}
|
||||
return $class->abort( $req,
|
||||
"$class: status page can not be displayed, unable to open socket" )
|
||||
unless ($statusOut);
|
||||
"$class: status page can not be displayed, unable to open socket"
|
||||
) unless ($statusOut);
|
||||
}
|
||||
return $class->abort( $req, "$class: status page can not be displayed" )
|
||||
unless ( $statusPipe and $statusOut );
|
||||
|
@ -243,8 +243,8 @@ sub lmLog {
|
|||
sub checkMaintenanceMode {
|
||||
my ( $class, $req ) = @_;
|
||||
my $vhost = $class->resolveAlias($req);
|
||||
my $_maintenance =
|
||||
( defined $class->tsv->{maintenance}->{$vhost} )
|
||||
my $_maintenance
|
||||
= ( defined $class->tsv->{maintenance}->{$vhost} )
|
||||
? $class->tsv->{maintenance}->{$vhost}
|
||||
: $class->tsv->{maintenance}->{_};
|
||||
|
||||
|
@ -272,8 +272,8 @@ sub grant {
|
|||
}
|
||||
}
|
||||
for (
|
||||
my $i = 0 ;
|
||||
$i < ( $class->tsv->{locationCount}->{$vhost} || 0 ) ;
|
||||
my $i = 0;
|
||||
$i < ( $class->tsv->{locationCount}->{$vhost} || 0 );
|
||||
$i++
|
||||
)
|
||||
{
|
||||
|
@ -405,8 +405,8 @@ sub fetchId {
|
|||
: $class->tsv->{https}->{_}
|
||||
);
|
||||
my $cn = $class->tsv->{cookieName};
|
||||
my $value =
|
||||
$lookForHttpCookie
|
||||
my $value
|
||||
= $lookForHttpCookie
|
||||
? ( $t =~ /${cn}http=([^,; ]+)/o ? $1 : 0 )
|
||||
: ( $t =~ /$cn=([^,; ]+)/o ? $1 : 0 );
|
||||
|
||||
|
@ -446,8 +446,7 @@ sub retrieveSession {
|
|||
# 2. Get the session from cache or backend
|
||||
my $session = $req->data->{session} = (
|
||||
Lemonldap::NG::Common::Session->new(
|
||||
{
|
||||
storageModule => $class->tsv->{sessionStorageModule},
|
||||
{ storageModule => $class->tsv->{sessionStorageModule},
|
||||
storageModuleOptions => $class->tsv->{sessionStorageOptions},
|
||||
cacheModule => $class->tsv->{sessionCacheModule},
|
||||
cacheModuleOptions => $class->tsv->{sessionCacheOptions},
|
||||
|
@ -462,11 +461,49 @@ sub retrieveSession {
|
|||
$class->data( $session->data );
|
||||
$class->logger->debug("Get session $id from Handler::Main::Run");
|
||||
|
||||
# Verify that session is valid
|
||||
$class->logger->error(
|
||||
"_utime is not defined. This should not happen. Check if it is well transmitted to handler"
|
||||
) unless $session->data->{_utime};
|
||||
|
||||
$class->logger->debug("Check session validity from Handler");
|
||||
$class->logger->debug(
|
||||
"Session timeout -> " . $class->tsv->{timeout} );
|
||||
$class->logger->debug( "Session timeoutActivity -> "
|
||||
. $class->tsv->{timeoutActivity}
|
||||
. "s" )
|
||||
if ( $class->tsv->{timeoutActivity} );
|
||||
$class->logger->debug(
|
||||
"Session _utime -> " . $session->data->{_utime} );
|
||||
$class->logger->debug( "now -> " . $now );
|
||||
$class->logger->debug( "_lastSeen -> " . $session->data->{_lastSeen} )
|
||||
if ( $session->data->{_lastSeen} );
|
||||
my $delta = $now - $session->data->{_lastSeen};
|
||||
$class->logger->debug( "now - _lastSeen = " . $delta )
|
||||
if ( $session->data->{_lastSeen} );
|
||||
$class->logger->debug( "Session timeoutActivityInterval -> "
|
||||
. $class->tsv->{timeoutActivityInterval} )
|
||||
if ( $class->tsv->{timeoutActivityInterval} );
|
||||
my $ttl = $class->tsv->{timeout} - $now + $session->data->{_utime};
|
||||
$class->logger->debug( "Session TTL = " . $ttl );
|
||||
|
||||
if ($now - $session->data->{_utime} > $class->tsv->{timeout}
|
||||
or ( $class->tsv->{timeoutActivity}
|
||||
and $session->data->{_lastSeen}
|
||||
and $delta > $class->tsv->{timeoutActivity} )
|
||||
)
|
||||
{
|
||||
$class->logger->info("Session $id expired");
|
||||
|
||||
# Clean cached data
|
||||
$class->data( {} );
|
||||
return 0;
|
||||
}
|
||||
|
||||
# Update the session to notify activity, if necessary
|
||||
if (
|
||||
$class->tsv->{timeoutActivity}
|
||||
and ( $now - $session->data->{_lastSeen} >
|
||||
$class->tsv->{timeoutActivityInterval} )
|
||||
if ($class->tsv->{timeoutActivity}
|
||||
and ( $now - $session->data->{_lastSeen}
|
||||
> $class->tsv->{timeoutActivityInterval} )
|
||||
)
|
||||
{
|
||||
$req->data->{session}->update( { '_lastSeen' => $now } );
|
||||
|
@ -481,26 +518,6 @@ sub retrieveSession {
|
|||
}
|
||||
}
|
||||
|
||||
# Verify that session is valid
|
||||
$class->logger->error(
|
||||
"_utime is not defined. This should not happen. Check if it is well transmitted to handler"
|
||||
) unless $session->data->{_utime};
|
||||
|
||||
$class->logger->debug( "Check session timeoutActivity from Handler -> " . $class->tsv->{timeoutActivity} ."s" );
|
||||
if (
|
||||
$now - $session->data->{_utime} > $class->tsv->{timeout}
|
||||
or ( $class->tsv->{timeoutActivity}
|
||||
and $session->data->{_lastSeen}
|
||||
and ( ( $now - $session->data->{_lastSeen} ) > $class->tsv->{timeoutActivity} ) )
|
||||
)
|
||||
{
|
||||
$class->logger->info("Session $id expired");
|
||||
|
||||
# Clean cached data
|
||||
$class->data( {} );
|
||||
return 0;
|
||||
}
|
||||
|
||||
$class->dataUpdate($now);
|
||||
return $session->data;
|
||||
}
|
||||
|
@ -525,8 +542,8 @@ sub _buildUrl {
|
|||
? $class->tsv->{https}->{$vhost}
|
||||
: $class->tsv->{https}->{_}
|
||||
);
|
||||
my $portString =
|
||||
$class->tsv->{port}->{$vhost}
|
||||
my $portString
|
||||
= $class->tsv->{port}->{$vhost}
|
||||
|| $class->tsv->{port}->{_}
|
||||
|| $req->{env}->{SERVER_PORT};
|
||||
$portString = (
|
||||
|
@ -548,8 +565,8 @@ sub isUnprotected {
|
|||
my ( $class, $req, $uri ) = @_;
|
||||
my $vhost = $class->resolveAlias($req);
|
||||
for (
|
||||
my $i = 0 ;
|
||||
$i < ( $class->tsv->{locationCount}->{$vhost} || 0 ) ;
|
||||
my $i = 0;
|
||||
$i < ( $class->tsv->{locationCount}->{$vhost} || 0 );
|
||||
$i++
|
||||
)
|
||||
{
|
||||
|
@ -568,7 +585,8 @@ sub sendHeaders {
|
|||
if ( defined $class->tsv->{forgeHeaders}->{$vhost} ) {
|
||||
|
||||
# Log headers in debug mode
|
||||
my %headers = $class->tsv->{forgeHeaders}->{$vhost}->( $req, $session );
|
||||
my %headers
|
||||
= $class->tsv->{forgeHeaders}->{$vhost}->( $req, $session );
|
||||
foreach my $h ( sort keys %headers ) {
|
||||
if ( defined( my $v = $headers{$h} ) ) {
|
||||
$class->logger->debug("Send header $h with value $v");
|
||||
|
@ -673,8 +691,8 @@ sub postOutputFilter {
|
|||
$class->logger->debug("Filling a html form with fake data");
|
||||
|
||||
$class->unset_header_in( $req, "Accept-Encoding" );
|
||||
my %postdata =
|
||||
$class->tsv->{outputPostData}->{$vhost}->{$uri}->( $req, $session );
|
||||
my %postdata = $class->tsv->{outputPostData}->{$vhost}->{$uri}
|
||||
->( $req, $session );
|
||||
my $formParams = $class->tsv->{postFormParams}->{$vhost}->{$uri};
|
||||
my $js = $class->postJavascript( $req, \%postdata, $formParams );
|
||||
$class->addToHtmlHead( $req, $js );
|
||||
|
@ -691,8 +709,8 @@ sub postInputFilter {
|
|||
if ( defined( $class->tsv->{inputPostData}->{$vhost}->{$uri} ) ) {
|
||||
$class->logger->debug("Replacing fake data with real form data");
|
||||
|
||||
my %data =
|
||||
$class->tsv->{inputPostData}->{$vhost}->{$uri}->( $req, $session );
|
||||
my %data = $class->tsv->{inputPostData}->{$vhost}->{$uri}
|
||||
->( $req, $session );
|
||||
foreach ( keys %data ) {
|
||||
$data{$_} = uri_escape( $data{$_} );
|
||||
}
|
||||
|
@ -712,18 +730,19 @@ sub postJavascript {
|
|||
foreach my $name ( keys %$data ) {
|
||||
use bytes;
|
||||
my $value = "x" x bytes::length( $data->{$name} );
|
||||
$filler .=
|
||||
"form.find('input[name=\"$name\"], select[name=\"$name\"], textarea[name=\"$name\"]').val('$value')\n";
|
||||
$filler
|
||||
.= "form.find('input[name=\"$name\"], select[name=\"$name\"], textarea[name=\"$name\"]').val('$value')\n";
|
||||
}
|
||||
|
||||
my $submitter =
|
||||
$formParams->{buttonSelector} eq "none" ? ""
|
||||
my $submitter
|
||||
= $formParams->{buttonSelector} eq "none" ? ""
|
||||
: $formParams->{buttonSelector}
|
||||
? "form.find('$formParams->{buttonSelector}').click();\n"
|
||||
: "form.submit();\n";
|
||||
|
||||
my $jqueryUrl = $formParams->{jqueryUrl} || "";
|
||||
$jqueryUrl = &{ $class->tsv->{portal} } . "skins/common/js/jquery-1.10.2.js"
|
||||
$jqueryUrl
|
||||
= &{ $class->tsv->{portal} } . "skins/common/js/jquery-1.10.2.js"
|
||||
if ( $jqueryUrl eq "default" );
|
||||
$jqueryUrl = "<script type='text/javascript' src='$jqueryUrl'></script>\n"
|
||||
if ($jqueryUrl);
|
||||
|
|
|
@ -17,7 +17,7 @@ use strict;
|
|||
use URI::Escape;
|
||||
|
||||
# List constants
|
||||
sub authProcess { qw(extractFormInfo getUser authenticate) }
|
||||
sub authProcess {qw(extractFormInfo getUser authenticate)}
|
||||
|
||||
sub sessionData {
|
||||
qw(setAuthSessionInfo setSessionInfo setMacros setGroups setPersistentSessionInfo
|
||||
|
@ -56,11 +56,9 @@ sub handler {
|
|||
if ( $sp or %{ $req->pdata } ) {
|
||||
my %v = (
|
||||
name => $self->conf->{cookieName} . 'pdata',
|
||||
(
|
||||
%{ $req->pdata }
|
||||
( %{ $req->pdata }
|
||||
? ( value => uri_escape( JSON::to_json( $req->pdata ) ) )
|
||||
: (
|
||||
value => '',
|
||||
: ( value => '',
|
||||
expires => 'Wed, 21 Oct 2015 00:00:00 GMT'
|
||||
)
|
||||
)
|
||||
|
@ -94,8 +92,7 @@ sub login {
|
|||
my ( $self, $req ) = @_;
|
||||
return $self->do(
|
||||
$req,
|
||||
[
|
||||
'controlUrl', @{ $self->beforeAuth },
|
||||
[ 'controlUrl', @{ $self->beforeAuth },
|
||||
$self->authProcess, @{ $self->betweenAuthAndData },
|
||||
$self->sessionData, @{ $self->afterData },
|
||||
$self->validSession, @{ $self->endAuth },
|
||||
|
@ -107,8 +104,7 @@ sub postLogin {
|
|||
my ( $self, $req ) = @_;
|
||||
return $self->do(
|
||||
$req,
|
||||
[
|
||||
'restoreArgs', 'controlUrl',
|
||||
[ 'restoreArgs', 'controlUrl',
|
||||
@{ $self->beforeAuth }, $self->authProcess,
|
||||
@{ $self->betweenAuthAndData }, $self->sessionData,
|
||||
@{ $self->afterData }, $self->validSession,
|
||||
|
@ -121,8 +117,7 @@ sub authenticatedRequest {
|
|||
my ( $self, $req ) = @_;
|
||||
return $self->do(
|
||||
$req,
|
||||
[
|
||||
'importHandlerData', 'controlUrl',
|
||||
[ 'importHandlerData', 'controlUrl',
|
||||
'checkLogout', @{ $self->forAuthUser }
|
||||
]
|
||||
);
|
||||
|
@ -132,8 +127,7 @@ sub postAuthenticatedRequest {
|
|||
my ( $self, $req ) = @_;
|
||||
return $self->do(
|
||||
$req,
|
||||
[
|
||||
'importHandlerData', 'restoreArgs',
|
||||
[ 'importHandlerData', 'restoreArgs',
|
||||
'controlUrl', 'checkLogout',
|
||||
@{ $self->forAuthUser }
|
||||
]
|
||||
|
@ -151,8 +145,7 @@ sub refresh {
|
|||
delete $data{$_} unless ( /^_/ or /^(?:startTime)$/ );
|
||||
}
|
||||
$req->steps(
|
||||
[
|
||||
'getUser',
|
||||
[ 'getUser',
|
||||
@{ $self->betweenAuthAndData },
|
||||
'setAuthSessionInfo',
|
||||
'setSessionInfo',
|
||||
|
@ -170,21 +163,21 @@ sub refresh {
|
|||
if ($res) {
|
||||
$req->info(
|
||||
$self->loadTemplate(
|
||||
'simpleInfo', params => { trspan => 'rightsReloadNeedsLogout' }
|
||||
'simpleInfo',
|
||||
params => { trspan => 'rightsReloadNeedsLogout' }
|
||||
)
|
||||
);
|
||||
$req->urldc( $self->conf->{portal} );
|
||||
return $self->do( $req, [ sub { PE_INFO } ] );
|
||||
return $self->do( $req, [ sub {PE_INFO} ] );
|
||||
}
|
||||
return $self->do( $req, [ sub { PE_OK } ] );
|
||||
return $self->do( $req, [ sub {PE_OK} ] );
|
||||
}
|
||||
|
||||
sub logout {
|
||||
my ( $self, $req ) = @_;
|
||||
return $self->do(
|
||||
$req,
|
||||
[
|
||||
'controlUrl', @{ $self->beforeLogout },
|
||||
[ 'controlUrl', @{ $self->beforeLogout },
|
||||
'authLogout', 'deleteSession'
|
||||
]
|
||||
);
|
||||
|
@ -201,7 +194,7 @@ sub do {
|
|||
|
||||
# Update status
|
||||
if ( my $p = $self->HANDLER->tsv->{statusPipe} ) {
|
||||
$p->print( ( $req->user ? $req->user : $req->address ) . ' => '
|
||||
$p->print(( $req->user ? $req->user : $req->address ) . ' => '
|
||||
. $req->uri
|
||||
. " $err\n" );
|
||||
}
|
||||
|
@ -215,9 +208,7 @@ sub do {
|
|||
if ( ( $err > 0 and !$req->id ) or $err eq PE_SESSIONNOTGRANTED ) {
|
||||
return [
|
||||
401,
|
||||
[
|
||||
'WWW-Authenticate' => "SSO " . $self->conf->{portal}
|
||||
],
|
||||
[ 'WWW-Authenticate' => "SSO " . $self->conf->{portal} ],
|
||||
[qq'{"result":0,"error":$err}']
|
||||
];
|
||||
}
|
||||
|
@ -231,16 +222,14 @@ sub do {
|
|||
else {
|
||||
return $self->sendJSONresponse(
|
||||
$req,
|
||||
{
|
||||
result => 1,
|
||||
{ result => 1,
|
||||
code => $err
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (
|
||||
$err
|
||||
if ( $err
|
||||
and $err != PE_LOGOUT_OK
|
||||
and (
|
||||
$err != PE_REDIRECT
|
||||
|
@ -267,8 +256,7 @@ sub do {
|
|||
|
||||
sub getModule {
|
||||
my ( $self, $req, $type ) = @_;
|
||||
if (
|
||||
my $mod = {
|
||||
if (my $mod = {
|
||||
auth => '_authentication',
|
||||
user => '_userDB',
|
||||
password => '_passwordDB'
|
||||
|
@ -280,8 +268,8 @@ sub getModule {
|
|||
}
|
||||
else {
|
||||
my $s = ref( $self->$mod );
|
||||
$s =~
|
||||
s/^Lemonldap::NG::Portal::(?:(?:Issuer|UserDB|Auth|Password)::)?//;
|
||||
$s
|
||||
=~ s/^Lemonldap::NG::Portal::(?:(?:Issuer|UserDB|Auth|Password)::)?//;
|
||||
return $s;
|
||||
}
|
||||
}
|
||||
|
@ -308,8 +296,9 @@ sub autoRedirect {
|
|||
$req->data->{redirectFormMethod} = "get";
|
||||
}
|
||||
else {
|
||||
return [ 302,
|
||||
[ Location => $req->{urldc}, @{ $req->respHeaders } ], [] ];
|
||||
return [
|
||||
302, [ Location => $req->{urldc}, @{ $req->respHeaders } ], []
|
||||
];
|
||||
}
|
||||
}
|
||||
my ( $tpl, $prms ) = $self->display($req);
|
||||
|
@ -330,8 +319,7 @@ sub getApacheSession {
|
|||
}
|
||||
|
||||
my $as = Lemonldap::NG::Common::Session->new(
|
||||
{
|
||||
storageModule => $self->conf->{globalStorage},
|
||||
{ storageModule => $self->conf->{globalStorage},
|
||||
storageModuleOptions => $self->conf->{globalStorageOptions},
|
||||
cacheModule => $self->conf->{localSessionStorage},
|
||||
cacheModuleOptions => $self->conf->{localSessionStorageOptions},
|
||||
|
@ -345,8 +333,7 @@ sub getApacheSession {
|
|||
if ( my $err = $as->error ) {
|
||||
$self->lmLog(
|
||||
$err,
|
||||
(
|
||||
$err =~ /(?:Object does not exist|Invalid session ID)/
|
||||
( $err =~ /(?:Object does not exist|Invalid session ID)/
|
||||
? 'notice'
|
||||
: 'error'
|
||||
)
|
||||
|
@ -358,17 +345,20 @@ sub getApacheSession {
|
|||
$self->logger->debug("Session $args{kind} $id not found");
|
||||
return;
|
||||
}
|
||||
$self->logger->debug("Get session $id from Portal::Main::Run") if ( $id );
|
||||
$self->logger->debug("Check session timeoutActivity -> " . $self->conf->{timeoutActivity} . "s");
|
||||
$self->logger->debug("Get session $id from Portal::Main::Run") if ($id);
|
||||
$self->logger->debug(
|
||||
"Check session validity -> " . $self->conf->{timeoutActivity} . "s" )
|
||||
if ( $self->conf->{timeoutActivity} );
|
||||
my $now = time;
|
||||
if (
|
||||
$id
|
||||
if ( $id
|
||||
and defined $as->data->{_utime}
|
||||
and (
|
||||
( ( $now - $as->data->{_utime} ) > $self->conf->{timeout} )
|
||||
or ( $self->conf->{timeoutActivity}
|
||||
and $as->data->{_lastSeen}
|
||||
and ( ( $now - $as->data->{_lastSeen} ) > $self->conf->{timeoutActivity} ) )
|
||||
and ( ( $now - $as->data->{_lastSeen} )
|
||||
> $self->conf->{timeoutActivity} )
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
|
@ -393,8 +383,7 @@ sub getPersistentSession {
|
|||
$info->{_session_uid} = $uid;
|
||||
|
||||
my $ps = Lemonldap::NG::Common::Session->new(
|
||||
{
|
||||
storageModule => $self->conf->{persistentStorage},
|
||||
{ storageModule => $self->conf->{persistentStorage},
|
||||
storageModuleOptions => $self->conf->{persistentStorageOptions},
|
||||
id => $pid,
|
||||
force => 1,
|
||||
|
@ -438,7 +427,8 @@ sub updatePersistentSession {
|
|||
|| $req->userData->{ $self->conf->{whatToTrace} };
|
||||
$self->logger->debug("Found 'whatToTrace' -> $uid");
|
||||
unless ($uid) {
|
||||
$self->logger->debug('No uid found, skipping updatePersistentSession');
|
||||
$self->logger->debug(
|
||||
'No uid found, skipping updatePersistentSession');
|
||||
return ();
|
||||
}
|
||||
$self->logger->debug("Update $uid persistent session");
|
||||
|
@ -480,14 +470,14 @@ sub updateSession {
|
|||
foreach ( keys %$infos ) {
|
||||
$self->logger->debug(
|
||||
"Update sessionInfo $_ with " . $infos->{$_} );
|
||||
$req->{sessionInfo}->{$_} = $self->HANDLER->data->{$_} =
|
||||
$infos->{$_};
|
||||
$req->{sessionInfo}->{$_} = $self->HANDLER->data->{$_}
|
||||
= $infos->{$_};
|
||||
}
|
||||
|
||||
# Update session in global storage with _updateTime
|
||||
$infos->{_updateTime} = strftime( "%Y%m%d%H%M%S", localtime() );
|
||||
if ( my $apacheSession =
|
||||
$self->getApacheSession( $id, info => $infos ) )
|
||||
if ( my $apacheSession
|
||||
= $self->getApacheSession( $id, info => $infos ) )
|
||||
{
|
||||
if ( $apacheSession->error ) {
|
||||
$self->logger->error("Cannot update session $id");
|
||||
|
@ -570,8 +560,8 @@ sub isTrustedUrl {
|
|||
|
||||
sub stamp {
|
||||
my $self = shift;
|
||||
my $res =
|
||||
$self->conf->{cipher}
|
||||
my $res
|
||||
= $self->conf->{cipher}
|
||||
? $self->conf->{cipher}->encrypt( time() )
|
||||
: 1;
|
||||
$res =~ s/\+/%2B/g;
|
||||
|
@ -732,7 +722,8 @@ sub sendHtml {
|
|||
'X-Content-Type-Options' => 'nosniff';
|
||||
|
||||
# Set authorized URL for POST
|
||||
my $csp = $self->csp . "form-action 'self' " . $self->conf->{cspFormAction};
|
||||
my $csp
|
||||
= $self->csp . "form-action 'self' " . $self->conf->{cspFormAction};
|
||||
if ( my $url = $req->urldc ) {
|
||||
$self->logger->debug("Required urldc : $url");
|
||||
$url =~ s#(https?://[^/]+).*#$1#;
|
||||
|
@ -743,13 +734,14 @@ sub sendHtml {
|
|||
if ( defined $url ) {
|
||||
$self->logger->debug("Required Params URL : $url");
|
||||
if ( $url =~ s#(https?://[^/]+).*#$1# ) {
|
||||
$self->logger->debug("Set CSP form-action with Params URL : $url");
|
||||
$self->logger->debug(
|
||||
"Set CSP form-action with Params URL : $url");
|
||||
$csp .= " $url";
|
||||
}
|
||||
}
|
||||
if ( defined $req->{cspFormAction} ) {
|
||||
$self->logger->debug(
|
||||
"Set CSP form-action with request URL: " . $req->{cspFormAction} );
|
||||
$self->logger->debug( "Set CSP form-action with request URL: "
|
||||
. $req->{cspFormAction} );
|
||||
$csp .= " " . $req->{cspFormAction};
|
||||
}
|
||||
|
||||
|
@ -789,8 +781,8 @@ sub sendHtml {
|
|||
|
||||
sub sendCss {
|
||||
my ( $self, $req ) = @_;
|
||||
my $s =
|
||||
'html,body{background:url("'
|
||||
my $s
|
||||
= 'html,body{background:url("'
|
||||
. $self->staticPrefix
|
||||
. '/common/backgrounds/'
|
||||
. $self->conf->{portalSkinBackground}
|
||||
|
@ -798,8 +790,7 @@ sub sendCss {
|
|||
. 'background-size:cover;}';
|
||||
return [
|
||||
200,
|
||||
[
|
||||
'Content-Type' => 'text/css',
|
||||
[ 'Content-Type' => 'text/css',
|
||||
'Content-Length' => length($s),
|
||||
'Cache-Control' => 'public,max-age=3600',
|
||||
],
|
||||
|
@ -828,7 +819,7 @@ sub lmError {
|
|||
sub rebuildCookies {
|
||||
my ( $self, $req ) = @_;
|
||||
my @tmp;
|
||||
for ( my $i = 0 ; $i < @{ $req->{respHeaders} } ; $i += 2 ) {
|
||||
for ( my $i = 0; $i < @{ $req->{respHeaders} }; $i += 2 ) {
|
||||
push @tmp, $req->respHeaders->[0], $req->respHeaders->[1]
|
||||
unless ( $req->respHeaders->[0] eq 'Set-Cookie' );
|
||||
}
|
||||
|
@ -873,7 +864,8 @@ sub registerLogin {
|
|||
|
||||
# Forget oldest logins
|
||||
splice @{ $history->{$type} }, $self->conf->{ $type . "Number" }
|
||||
if ( scalar @{ $history->{$type} } > $self->conf->{ $type . "Number" } );
|
||||
if (
|
||||
scalar @{ $history->{$type} } > $self->conf->{ $type . "Number" } );
|
||||
|
||||
# Save into persistent session
|
||||
$self->updatePersistentSession( $req, { _loginHistory => $history, } );
|
||||
|
@ -884,8 +876,8 @@ sub registerLogin {
|
|||
# @return hashref
|
||||
sub _sumUpSession {
|
||||
my ( $self, $session, $withoutUser ) = @_;
|
||||
my $res =
|
||||
$withoutUser
|
||||
my $res
|
||||
= $withoutUser
|
||||
? {}
|
||||
: { user => $session->{ $self->conf->{whatToTrace} } };
|
||||
$res->{$_} = $session->{$_}
|
||||
|
@ -898,8 +890,8 @@ sub _sumUpSession {
|
|||
sub loadTemplate {
|
||||
my ( $self, $name, %prm ) = @_;
|
||||
$name .= '.tpl';
|
||||
my $file =
|
||||
$self->conf->{templateDir} . '/'
|
||||
my $file
|
||||
= $self->conf->{templateDir} . '/'
|
||||
. $self->conf->{portalSkin} . '/'
|
||||
. $name;
|
||||
$file = $self->conf->{templateDir} . '/common/' . $name
|
||||
|
|
Loading…
Reference in New Issue
Block a user