From df0b65668327221571085c2da461fe1540efdecb Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Fri, 31 May 2019 08:35:51 +0530 Subject: [PATCH] Bug 22990: Introduce a new param "check" to check csrf token. --- C4/Output.pm | 9 ++++----- acqui/basketheader.pl | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/C4/Output.pm b/C4/Output.pm index 7193ee3..354b63e 100644 --- a/C4/Output.pm +++ b/C4/Output.pm @@ -340,16 +340,15 @@ sub output_and_exit_if_error { { $error = 'cannot_see_patron_infos'; } - } - elsif ( $params->{module} eq 'CSRF_TOKEN_CHECK' ) { + } + } elsif ( $params->{check} eq 'csrf_token' ) { $error = 'wrong_csrf_token' - unless Koha::Token->new->check_csrf( + unless Koha::Token->new->check_csrf( { session_id => scalar $query->cookie('CGISESSID'), token => scalar $query->param('csrf_token'), } - ); - } + ); } output_and_exit( $query, $cookie, $template, $error ) if $error; return; diff --git a/acqui/basketheader.pl b/acqui/basketheader.pl index 2cb3584..04ed473 100755 --- a/acqui/basketheader.pl +++ b/acqui/basketheader.pl @@ -142,8 +142,8 @@ if ( $op eq 'add_form' ) { #End Edit } elsif ( $op eq 'add_validate' ) { #we are confirming the changes, save the basket -#we are checking CSRF Token. Module CSRF_TOKEN_CHECK indicate for CSRF token checking, - output_and_exit_if_error($input, $cookie, $template, { module => 'CSRF_TOKEN_CHECK' }); +#we are checking CSRF Token. + output_and_exit_if_error($input, $cookie, $template, { check => 'csrf_token' }); if ( $is_an_edit ) { ModBasketHeader( -- 2.7.4