From 21d74e239d9660d01b632e5c821167f24522b06a Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Thu, 30 May 2019 20:57:57 +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..10a7d1c 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_CHECK' ) { $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..39270ae 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_CHECK' }); if ( $is_an_edit ) { ModBasketHeader( -- 2.7.4