Bug 31492: Set CSRF token in circulation.pl

To test:
* Turn on patronimages system preferences
* Go to any patron account
* Hover over the 'dummy image' for the Add button
* Browse and select an image for upload
* Saving results in the following error:

The form submission failed (Wrong CSRF token). Try to come back, refresh the page, then try again.

Apply patch and try again. You shouldn't need to try twice, it should work on the first attempt now.

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: David Cook <dcook@prosentient.com.au>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f0e6f25428)
Signed-off-by: Jacob O'Mara <jacob.omara@ptfs-europe.com>
(cherry picked from commit 11d88ba12f)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 715afc2826)
Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
This commit is contained in:
Lucas Gass 2023-01-13 19:01:55 +00:00 committed by Arthur Suzuki
parent 123d2a144e
commit b9140b31a5
No known key found for this signature in database
GPG Key ID: 7558BEE2BEEEBCAA
1 changed files with 6 additions and 0 deletions

View File

@ -54,6 +54,7 @@ use Koha::Items;
use Koha::SearchEngine;
use Koha::SearchEngine::Search;
use Koha::Patron::Modifications;
use Koha::Token;
use List::MoreUtils qw( uniq );
@ -618,4 +619,9 @@ $template->param(
logged_in_user => $logged_in_user,
);
# Generate CSRF token for upload and delete image buttons
$template->param(
csrf_token => Koha::Token->new->generate_csrf({ session_id => $query->cookie('CGISESSID'),}),
);
output_html_with_http_headers $query, $cookie, $template->output;