From b7e86b6e34a3ad314ecded2185fc49c6e946725f Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Tue, 8 Mar 2016 22:04:32 +0000 Subject: [PATCH] Bug 12663 - SCOUserCSS and SCOUserJS ignored on selfcheck login page Currently if not logged in when browsing to http://YOURCATALOG/cgi-bin/koha/sco/sco-main.pl You are redirected to opac-auth.tt and SCOUserCSS and SCOUserJS are not loaded. This page passes through a parameter to the template to indicate this is an SCO login and appropriate CSS and JS should be loaded. Additionally this patch ensure that when loggin in using the form you are redirected to the sco-main.pl instead of the patron account page for the user. To test: 1 - Verify that normal login works on both staff and opac 2 - Verify that SCO link goes to login page if AutoSelfCheckAllowed is not allowed 3 - Enter changes into SCOUserJS and SCOUserCSS and observe these are present on SOC log in page 4 - Verify that a logged in opac user without permissions cannot access the self-checkout module 5 - Verify that AutoSelfCheckAllowed and associated system preferences function as expected 6 - Verify the AutoSelfCheck user is logged out if they attempt to visit another page --- C4/Auth.pm | 1 + .../bootstrap/en/includes/doc-head-close.inc | 9 +++++++- .../bootstrap/en/includes/opac-bottom.inc | 24 +++++++++++++++------- .../opac-tmpl/bootstrap/en/modules/opac-auth.tt | 7 +++++-- opac/sco/sco-main.pl | 2 +- 5 files changed, 32 insertions(+), 11 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 332b8c6..7941ed5 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -1248,6 +1248,7 @@ sub checkauth { opac_css_override => $ENV{'OPAC_CSS_OVERRIDE'}, ); + $template->param( SCO_login => 1 ) if ( $query->param('koha_login_context') eq 'sco' ); $template->param( OpacPublic => C4::Context->preference("OpacPublic") ); $template->param( loginprompt => 1 ) unless $info{'nopermission'}; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc index e346689..47918a4 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc @@ -37,7 +37,14 @@ [% IF ( bidi ) %] [% END %] -[% IF ( OPACUserCSS ) %][% END %] +[% IF SCO_login %] + [% SET SCOUserCSS = Koha.Preference('SCOUserCSS') %] + [% IF SCOUserCSS %] + + [% END %] +[% ELSE %] + [% IF ( OPACUserCSS ) %][% END %] +[% END %] [% PROCESS cssinclude %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index 63c562f..aae5c24 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -266,13 +266,23 @@ $(document).ready(function() { }); [% PROCESS jsinclude %] - -[% IF ( OPACUserJS ) %] - +[% IF SCO_login %] + [% SET SCOUserJS = Koha.Preference('SCOUserJS') %] + [% IF ( SCOUserJS ) %] + + [% END %] +[% ELSE %] + [% IF ( OPACUserJS ) %] + + [% END %] [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt index c5cd351..98565c0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt @@ -137,8 +137,11 @@ [% END %] [% END # / IF casAuthentication %] - -
+ [% IF SCO_login %] + + [% ELSE %] + + [% END %]
[% FOREACH INPUT IN INPUTS %] diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 5584dae..013d035 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -62,8 +62,8 @@ if (C4::Context->preference('AutoSelfCheckAllowed')) my $AutoSelfCheckPass = C4::Context->preference('AutoSelfCheckPass'); $query->param(-name=>'userid',-values=>[$AutoSelfCheckID]); $query->param(-name=>'password',-values=>[$AutoSelfCheckPass]); - $query->param(-name=>'koha_login_context',-values=>['sco']); } +$query->param(-name=>'koha_login_context',-values=>['sco']); my ($template, $loggedinuser, $cookie) = get_template_and_user({ template_name => "sco/sco-main.tt", authnotrequired => 0, -- 2.1.4