@@ -, +, @@ (op==delete) Under Plack this results in an internal server error, the log tells you: Wrong CSRF token. --- authorities/authorities-home.pl | 17 +++++++++++++++++ .../prog/en/modules/authorities/searchresultlist.tt | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) --- a/authorities/authorities-home.pl +++ a/authorities/authorities-home.pl @@ -21,6 +21,8 @@ use strict; use warnings; use CGI qw ( -utf8 ); +use Digest::MD5 qw(md5_base64); +use Encode qw( encode ); use URI::Escape; use C4::Auth; @@ -36,6 +38,7 @@ use C4::Search::History; use Koha::Authority::Types; use Koha::SearchEngine::Search; use Koha::SearchEngine::QueryBuilder; +use Koha::Token; my $query = new CGI; my $dbh = C4::Context->dbh; @@ -58,6 +61,13 @@ if ( $op eq "delete" ) { debug => 1, } ); + + die "Wrong CSRF token" unless Koha::Token->new->check_csrf({ + id => Encode::encode( 'UTF-8', $loggedinuser ), + secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ), + token => scalar $query->param('csrf_token'), + }); + &DelAuthority( $authid, 1 ); if ( $query->param('operator') ) { @@ -111,6 +121,13 @@ if ( $op eq "do_search" ) { } ); + $template->param( + csrf_token => Koha::Token->new->generate_csrf({ + id => Encode::encode( 'UTF-8', $loggedinuser ), + secret => md5_base64( Encode::encode( 'UTF-8', C4::Context->config('pass') ) ), + }), + ); + # search history if (C4::Context->preference('EnableSearchHistory')) { if ( $startfrom == 1) { --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/searchresultlist.tt @@ -19,7 +19,8 @@ function confirm_deletion(id) { + "&orderby=[% orderby %]" + "&value=[% value |url %]" + "&startfrom=[% startfrom %]" - + "&resultsperpage=[% resultsperpage %]"; + + "&resultsperpage=[% resultsperpage %]" + + "&csrf_token=[% csrf_token %]"; } } --