From 33ced673b164129bacb4d0f9b09d8bec3a6267c1 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 --- 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.34.1