Bug 12663 - SCOUserCSS and SCOUserJS ignored on selfcheck login page
authorNick Clemens <nick@bywatersolutions.com>
Tue, 8 Mar 2016 22:04:32 +0000 (22:04 +0000)
committerBrendan Gallagher <bredan@bywatersolutions.com>
Fri, 22 Apr 2016 00:57:44 +0000 (00:57 +0000)
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
set to "Don't allow"
3 - Enter changes into SCOUserJS and SCOUserCSS and observe these are
present on SCO log in page with AutoSelfCheck disabled
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

Followed test plan.
If I go to http://YOURCATALOG/cgi-bin/koha/sco/sco-main.pl, CSS and JS trigger already on
the login form, I suppose that is intended.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan Gallagher <bredan@bywatersolutions.com>
C4/Auth.pm
koha-tmpl/opac-tmpl/bootstrap/en/includes/doc-head-close.inc
koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
opac/sco/sco-main.pl

index e3aecec..9c07333 100644 (file)
@@ -1249,6 +1249,7 @@ sub checkauth {
         opac_css_override                     => $ENV{'OPAC_CSS_OVERRIDE'},
     );
 
+    $template->param( SCO_login => 1 ) if ( $query->param('sco_user_login') );
     $template->param( OpacPublic => C4::Context->preference("OpacPublic") );
     $template->param( loginprompt => 1 ) unless $info{'nopermission'};
 
index e346689..47918a4 100644 (file)
 [% IF ( bidi ) %]
     <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/right-to-left.css" />
 [% END %]
-[% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
+[% IF SCO_login %]
+    [% SET SCOUserCSS = Koha.Preference('SCOUserCSS') %]
+    [% IF SCOUserCSS %]
+        <style type="text/css">[% SCOUserCSS %]</style>
+    [% END %]
+[% ELSE %]
+    [% IF ( OPACUserCSS ) %]<style type="text/css">[% OPACUserCSS %]</style>[% END %]
+[% END %]
 <link rel="unapi-server" type="application/xml" title="unAPI" href="[% OPACBaseURL %]/cgi-bin/koha/unapi" />
 [% PROCESS cssinclude %]
 <!-- Respond.js brings responsive layout behavior to IE < v.9 -->
index 63c562f..aae5c24 100644 (file)
@@ -266,13 +266,23 @@ $(document).ready(function() {
 });
 </script>
 [% PROCESS jsinclude %]
-
-[% IF ( OPACUserJS ) %]
-    <script type="text/javascript">
-        //<![CDATA[
-        [% OPACUserJS %]
-        //]]>
-    </script>
+[% IF SCO_login %]
+    [% SET SCOUserJS = Koha.Preference('SCOUserJS') %]
+    [% IF ( SCOUserJS ) %]
+        <script type="text/javascript">
+            //<![CDATA[
+            [% SCOUserJS %]
+            //]]>
+        </script>
+    [% END %]
+[% ELSE %]
+    [% IF ( OPACUserJS ) %]
+        <script type="text/javascript">
+            //<![CDATA[
+            [% OPACUserJS %]
+            //]]>
+        </script>
+    [% END %]
 [% END %]
 </body>
 </html>
index a20490e..64ea0f8 100644 (file)
@@ -29,6 +29,9 @@
                             <div class="alert">
                                 <h3>Access denied</h3>
                                 <p>Sorry, the system doesn't think you have permission to access this page. </p>
+                                [% IF SCO_login %]
+                                    <p><a href="/cgi-bin/koha/sco/sco-main.pl?logout.x=1">Logout</a> and try again with a different user</p>
+                                [% END %]
                             </div>
                         [% END %]
 
                               <p>If you do not have a Google account, but do have a local account, you can still log in: </p>
                                 [% END %]
 
-                            <form action="/cgi-bin/koha/opac-user.pl" name="auth" id="auth" method="post">
+                            [% IF SCO_login %]
+                                <form action="/cgi-bin/koha/sco/sco-main.pl" name="auth" id="auth" method="post">
+                            [% ELSE %]
+                                <form action="/cgi-bin/koha/opac-user.pl" name="auth" id="auth" method="post">
+                            [% END %]
                                 <input type="hidden" name="koha_login_context" value="opac" />
                                 <fieldset class="brief">
                                     [% FOREACH INPUT IN INPUTS %]
index 5584dae..0e2a1b9 100755 (executable)
@@ -64,6 +64,7 @@ if (C4::Context->preference('AutoSelfCheckAllowed'))
     $query->param(-name=>'password',-values=>[$AutoSelfCheckPass]);
     $query->param(-name=>'koha_login_context',-values=>['sco']);
 }
+$query->param(-name=>'sco_user_login',-values=>[1]);
 my ($template, $loggedinuser, $cookie) = get_template_and_user({
     template_name   => "sco/sco-main.tt",
     authnotrequired => 0,