Bug 38365: Only get the nonce in templates if CSP is enabled
Signed-off-by: Lari Taskula <lari.taskula@hypernova.fi> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
da52fd9c6f
commit
c8bfd03386
|
|
@ -172,7 +172,12 @@ It should be cached by Koha::Middleware::ContentSecurityPolicy.
|
|||
=cut
|
||||
|
||||
sub CSPNonce {
|
||||
return Koha::ContentSecurityPolicy->new->get_nonce;
|
||||
my $csp = Koha::ContentSecurityPolicy->new();
|
||||
my $nonce;
|
||||
if ( $csp->is_enabled ) {
|
||||
$nonce = $csp->get_nonce;
|
||||
}
|
||||
return $nonce;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue