Bugzilla – Attachment 54470 Details for
Bug 17109
sendbasket: Remove second authentication, add CSRF token
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17109: Remove second authentication from (opac-)sendbasket
Bug-17109-Remove-second-authentication-from-opac-s.patch (text/plain), 3.65 KB, created by
Marc Véron
on 2016-08-15 13:02:35 UTC
(
hide
)
Description:
Bug 17109: Remove second authentication from (opac-)sendbasket
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-08-15 13:02:35 UTC
Size:
3.65 KB
patch
obsolete
>From ae28c3c50117d355b6dbb2dae9e348b947874c59 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 11 Aug 2016 13:10:21 +0200 >Subject: [PATCH] Bug 17109: Remove second authentication from > (opac-)sendbasket >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Patch deals with opac and intranet variant. >If we authenticated the first time, it is not necessary to do it >a second time rightaway. > >Replaces a call to get_template_and_user (including checkauth) by >gettemplate. > >Also removes duplicate use C4::Biblio statements. > >Test plan: >[1] Put a few books in the cart. >[2] Send the cart from OPAC. >[3] Send the cart from intranet. > >Tested 3 patches together. Works as expected. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > basket/sendbasket.pl | 19 ++++++++----------- > opac/opac-sendbasket.pl | 17 +++++++---------- > 2 files changed, 15 insertions(+), 21 deletions(-) > >diff --git a/basket/sendbasket.pl b/basket/sendbasket.pl >index 14c9882..16155d7 100755 >--- a/basket/sendbasket.pl >+++ b/basket/sendbasket.pl >@@ -15,8 +15,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use Encode qw(encode); >@@ -29,7 +28,7 @@ use C4::Biblio; > use C4::Items; > use C4::Auth; > use C4::Output; >-use C4::Biblio; >+use C4::Templates (); > use Koha::Email; > > my $query = new CGI; >@@ -53,15 +52,13 @@ if ( $email_add ) { > my $email = Koha::Email->new(); > my %mail = $email->create_message_headers({ to => $email_add }); > my $comment = $query->param('comment'); >- my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( >- { >- template_name => "basket/sendbasket.tt", >- query => $query, >- type => "intranet", >- authnotrequired => 0, >- flagsrequired => { catalogue => 1 }, >- } >+ >+ # Since we are already logged in, no need to check credentials again >+ # We only need to add OPACBaseURL >+ my $template2 = C4::Templates::gettemplate( >+ 'basket/sendbasket.tt', 'intranet', $query, > ); >+ $template2->param( OPACBaseURL => C4::Context->preference('OPACBaseURL') ); > > my @bibs = split( /\//, $bib_list ); > my @results; >diff --git a/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl >index 97b64fd..baa88b5 100755 >--- a/opac/opac-sendbasket.pl >+++ b/opac/opac-sendbasket.pl >@@ -17,8 +17,7 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >-use strict; >-use warnings; >+use Modern::Perl; > > use CGI qw ( -utf8 ); > use Encode qw(encode); >@@ -31,8 +30,8 @@ use C4::Biblio; > use C4::Items; > use C4::Auth; > use C4::Output; >-use C4::Biblio; > use C4::Members; >+use C4::Templates (); > use Koha::Email; > > my $query = new CGI; >@@ -67,14 +66,12 @@ if ( $email_add ) { > }); > $mail{'X-Abuse-Report'} = C4::Context->preference('KohaAdminEmailAddress'); > >- my ( $template2, $borrowernumber, $cookie ) = get_template_and_user( >- { >- template_name => "opac-sendbasket.tt", >- query => $query, >- type => "opac", >- authnotrequired => 0, >- } >+ # Since we are already logged in, no need to check credentials again >+ # We only need to add OPACBaseURL >+ my $template2 = C4::Templates::gettemplate( >+ 'opac-sendbasket.tt', 'opac', $query, > ); >+ $template2->param( OPACBaseURL => C4::Context->preference('OPACBaseURL') ); > > my @bibs = split( /\//, $bib_list ); > my @results; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17109
:
54309
|
54310
|
54325
|
54470
|
54471
|
54472
|
54503
|
54705
|
54706
|
54707
|
54708