From 56f22315626500d881d57d19da078b43b6265105 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 27 Oct 2025 21:54:56 +0200 Subject: [PATCH] Bug 38365: Generate the nonce Signed-off-by: David Cook --- C4/Auth.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/C4/Auth.pm b/C4/Auth.pm index 20242735e1a..e636e1221f8 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -692,6 +692,11 @@ sub get_template_and_user { $template->param( logged_in_user => $patron ); $template->param( sessionID => $sessionID ); + my $csp_nonce = Koha::Token->new()->generate( { pattern => '\w{10}' } ); + my $cache = Koha::Cache::Memory::Lite->get_instance(); + $cache->set_in_cache( 'csp_nonce', $csp_nonce ); + $template->param( csp_nonce => $csp_nonce ); + return ( $template, $borrowernumber, $cookie, $flags ); } -- 2.39.5