Bug 18506: (QA follow-up) Indentation and more conditionals
authorNick Clemens <nick@bywatersolutions.com>
Wed, 3 Feb 2021 15:48:29 +0000 (15:48 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 9 Feb 2021 08:48:35 +0000 (09:48 +0100)
Indentation fixes for readability

Cleaned up a few places where the ability to login otherwise was leakign through

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
JD amended patch: Remove trailing spaces

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/intranet-tmpl/prog/en/modules/auth.tt
koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt

index 8d4cf0c..0baa814 100644 (file)
@@ -7,7 +7,7 @@
 [% USE Registers %]
 [% SET footerjs = 1 %]
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; 
+<title>Koha &rsaquo;
     [% IF ( nopermission ) %]Access denied[% END %]
     [% IF ( timed_out ) %]Session timed out[% END %]
     [% IF ( different_ip ) %]IP address change[% END %]
 <p>If you have a shibboleth account, please <a href="[% shibbolethLoginUrl | $raw %]">click here</a> to login.</p>
 [% END %]
 
-<!-- login prompt time-->
-<form action="[% script_name | html %]" method="post" name="loginform" id="loginform">
-    <input type="hidden" name="koha_login_context" value="intranet" />
-[% FOREACH INPUT IN INPUTS %]
-    <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
-[% END %]
-<p><label for="userid">Username:</label>
-<input type="text" name="userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" />
-</p>
-<p><label for="password">Password:</label>
-<input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" />
-</p>
-
-[% UNLESS IndependentBranches %]
-    <p>
-        <label for="branch">Library:</label>
-        <select name="branch" id="branch" class="input" tabindex="3">
-            <option value="">My library</option>
-            [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
-                <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
-            [% END %]
-        </select>
+[% UNLESS Koha.Preference('staffShibOnly') %]
+    <!-- login prompt time-->
+    <form action="[% script_name | html %]" method="post" name="loginform" id="loginform">
+        <input type="hidden" name="koha_login_context" value="intranet" />
+    [% FOREACH INPUT IN INPUTS %]
+        <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
+    [% END %]
+    <p><label for="userid">Username:</label>
+    <input type="text" name="userid" id="userid" class="input focus" value="[% userid | html %]" size="20" tabindex="1" />
     </p>
+    <p><label for="password">Password:</label>
+    <input type="password" name="password" id="password" class="input" value="" size="20" tabindex="2" />
+    </p>
+
+    [% UNLESS IndependentBranches %]
+        <p>
+            <label for="branch">Library:</label>
+            <select name="branch" id="branch" class="input" tabindex="3">
+                <option value="">My library</option>
+                [% FOREACH l IN Branches.all( unfiltered => 1 ) %]
+                    <option value="[% l.branchcode | html %]">[% l.branchname | html %]</option>
+                 [% END %]
+            </select>
+        </p>
 
-    [% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
+        [% IF Koha.Preference('UseCirculationDesks') && Desks.all %]
         <p>
             <label for="desk">Desk:</label>
             <select name="desk_id" id="desk_id" class="input" tabindex="3">
                     [% END %]
             </select>
         </p>
-    [% END %]
+        [% END %]
+
+        [% IF Koha.Preference('UseCashRegisters') && Registers.all().size %]
+        <p>
+            <label for="register_id">Cash register:</label>
+            <select name="register_id" id="register_id" class="input" tabindex="4">
+                <option id="noregister" value="" selected="selected">Library default</option>
+                [% PROCESS options_for_registers registers => Registers.all() %]
+            </select>
+        </p>
+        [% END %]
 
-    [% IF Koha.Preference('UseCashRegisters') && Registers.all().size %]
-    <p>
-        <label for="register_id">Cash register:</label>
-        <select name="register_id" id="register_id" class="input" tabindex="4">
-            <option id="noregister" value="" selected="selected">Library default</option>
-            [% PROCESS options_for_registers registers => Registers.all() %]
-        </select>
-    </p>
     [% END %]
 
-</fieldset>
-[% END %]
+    <!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
 
-<!-- <p><label><input name="rememberme" type="checkbox" id="rememberme" value="forever" tabindex="3" />Remember me</label></p> -->
+    <p class="submit"><input id="submit-button" type="submit" value="Login" tabindex="4" /></p>
+    </form>
 
-<p class="submit"><input id="submit-button" type="submit" value="Login" tabindex="4" /></p>
-</form>
-[% IF ( casAuthentication ) %]
-<h4>Cas login</h4>
+    [% IF ( casAuthentication ) %]
+        <h4>Cas login</h4>
 
-[% IF ( invalidCasLogin ) %]
-<!-- This is what is displayed if cas login has failed -->
-<p>Sorry, the CAS login failed.</p>
-[% END %]
+        [% IF ( invalidCasLogin ) %]
+        <!-- This is what is displayed if cas login has failed -->
+        <p>Sorry, the CAS login failed.</p>
+        [% END %]
 
-[% IF ( casServerUrl ) %]
-    <p><a href="[% casServerUrl | $raw %]">If you have a CAS account, please click here to login</a>.<p>
-[% END %]
+        [% IF ( casServerUrl ) %]
+            <p><a href="[% casServerUrl | $raw %]">If you have a CAS account, please click here to login</a>.<p>
+        [% END %]
 
-[% IF ( casServersLoop ) %]
-    <p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
-<ul>
-    [% FOREACH casServer IN casServersLoop %]
-        <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
+        [% IF ( casServersLoop ) %]
+            <p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
+        <ul>
+            [% FOREACH casServer IN casServersLoop %]
+                <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
+            [% END %]
+        [% END %]
     [% END %]
 [% END %]
-[% END %]
 
 [% IF ( nopermission ) %]
     <p><a href="javascript:window.history.back()">[Previous page]</a>
index c2e6f76..5e973e8 100644 (file)
                             [% ELSE %]
                                 <h3>Shibboleth login</h3>
                                 <p><a href="[% shibbolethLoginUrl | $raw %]">Log in using a Shibboleth account</a>.</p>
-                                <h3>Local Login</h3>
+                                [% UNLESS Koha.Preference('opacShibOnly') %]
+                                    <h3>Local Login</h3>
+                                [% END %]
                             [% END %]
                         [% END %]
-                        <input type="hidden" name="koha_login_context" value="opac" />
-                        <fieldset class="brief">
-                            <label for="muserid">Login:</label><input type="text" id="muserid" name="userid" />
-                            <label for="mpassword">Password:</label><input type="password" id="mpassword" name="password" />
-                            [% IF Koha.Preference( 'OpacLoginInstructions' ) %]
-                                <div id="nologininstructions-modal" class="nologininstructions">
-                                    [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
-                                </div>
-                            [% END %]
-                            [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
-                                <div id="forgotpassword-modal" class="forgotpassword">
-                                    <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
-                                </div>
-                            [% END %]
-                            [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
-                                <div id="patronregistration-modal" class="patronregistration">
-                                    <p>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></p>
-                                </div>
-                            [% END %]
-                        </fieldset>
-                    </div>
-                    <div class="modal-footer">
-                        <input type="submit" class="btn btn-primary" value="Log in" />
+                        [% UNLESS Koha.Preference('opacShibOnly') %]
+                            <input type="hidden" name="koha_login_context" value="opac" />
+                            <fieldset class="brief">
+                                <label for="muserid">Login:</label><input type="text" id="muserid" name="userid" />
+                                <label for="mpassword">Password:</label><input type="password" id="mpassword" name="password" />
+                                [% IF Koha.Preference( 'OpacLoginInstructions' ) %]
+                                    <div id="nologininstructions-modal" class="nologininstructions">
+                                        [% Koha.Preference( 'OpacLoginInstructions' ) | $raw %]
+                                    </div>
+                                [% END %]
+                                [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
+                                    <div id="forgotpassword-modal" class="forgotpassword">
+                                        <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
+                                    </div>
+                                [% END %]
+                                [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
+                                    <div id="patronregistration-modal" class="patronregistration">
+                                        <p>Don't have an account? <a href="/cgi-bin/koha/opac-memberentry.pl">Register here.</a></p>
+                                    </div>
+                                [% END %]
+                            </fieldset>
+                        [% END %]
                     </div>
+                    [% UNLESS Koha.Preference('opacShibOnly') %]
+                        <div class="modal-footer">
+                            <input type="submit" class="btn btn-primary" value="Log in" />
+                        </div>
+                    [% END %]
                 </form> <!-- /#auth -->
             </div> <!-- /.modal-content -->
         </div> <!-- /.modal-dialog -->
index 1413f24..d5f142c 100644 (file)
                                     <div class="alert alert-info">
                                         <p>Sorry, your Shibboleth identity does not match a valid library identity.</p>
                                         [% UNLESS ( Koha.Preference('OPACShibOnly') ) %]
-                                        [% IF ( casAuthentication ) %]
-                                            [% IF ( invalidCasLogin ) %]
-                                                <!-- This is what is displayed if cas login has failed -->
-                                                <p>Sorry, the CAS login also failed. If you have a local login you may use that below.</p>
+                                            [% IF ( casAuthentication ) %]
+                                                [% IF ( invalidCasLogin ) %]
+                                                    <!-- This is what is displayed if cas login has failed -->
+                                                    <p>Sorry, the CAS login also failed. If you have a local login you may use that below.</p>
+                                                [% ELSE %]
+                                                    <p>If you have a CAS account, you may use that below.</p>
+                                                [% END %]
                                             [% ELSE %]
-                                                <p>If you have a CAS account, you may use that below.</p>
+                                                <p>If you have a local account, you may use that below.</p>
                                             [% END %]
-                                        [% ELSE %]
-                                            <p>If you have a local account, you may use that below.</p>
-                                        [% END %]
                                         [% END %]
                                     </div>
                                 [% ELSE %]
                                     <p><a href="[% shibbolethLoginUrl | $raw %]">Log in using a Shibboleth account.</a></p>
                                 [% END # /IF invalidShibLogin %]
                                 [% UNLESS ( Koha.Preference('OPACShibOnly') ) %]
-                                [% IF ( casAuthentication ) %]
-                                    <h3>CAS login</h3>
-                                    <p>If you do not have a Shibboleth account, but you do have a CAS account, you can use CAS.</p>
-                                [% ELSE %]
-                                    <h3>Local login</h3>
-                                    <p>If you do not have a Shibboleth account, but you do have a local login, then you may login below.</p>
-                                [% END %]
+                                    [% IF ( casAuthentication ) %]
+                                        <h3>CAS login</h3>
+                                        <p>If you do not have a Shibboleth account, but you do have a CAS account, you can use CAS.</p>
+                                    [% ELSE %]
+                                        <h3>Local login</h3>
+                                        <p>If you do not have a Shibboleth account, but you do have a local login, then you may login below.</p>
+                                    [% END %]
                                 [% END %]
                             [% END # /IF shibbolethAuthentication %]
 
                         [% UNLESS ( Koha.Preference('OPACShibOnly') ) %]
-                        [% IF ( casAuthentication ) %]
-                            [% IF ( shibbolethAuthentication ) %]
-                                [% IF ( casServerUrl ) %]
-                                    <p><a href="[% casServerUrl | $raw %]">Log in.</a><p>
-                                [% END %]
+                            [% IF ( casAuthentication ) %]
+                                [% IF ( shibbolethAuthentication ) %]
+                                    [% IF ( casServerUrl ) %]
+                                        <p><a href="[% casServerUrl | $raw %]">Log in.</a><p>
+                                    [% END %]
+
+                                    [% IF ( casServersLoop ) %]
+                                        <p>Please choose against which one you would like to authenticate: </p>
+                                        <ul>
+                                            [% FOREACH casServer IN casServersLoop %]
+                                                <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
+                                            [% END %]
+                                        </ul>
+                                    [% END %]
+                                [% ELSE %]
+                                    <h3>CAS login</h3>
 
-                                [% IF ( casServersLoop ) %]
-                                    <p>Please choose against which one you would like to authenticate: </p>
-                                    <ul>
-                                        [% FOREACH casServer IN casServersLoop %]
-                                            <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
-                                        [% END %]
-                                    </ul>
-                                [% END %]
-                            [% ELSE %]
-                                <h3>CAS login</h3>
+                                    [% IF ( invalidCasLogin ) %]
+                                        <!-- This is what is displayed if cas login has failed -->
+                                        <p>Sorry, the CAS login failed.</p>
+                                    [% END %]
 
-                                [% IF ( invalidCasLogin ) %]
-                                    <!-- This is what is displayed if cas login has failed -->
-                                    <p>Sorry, the CAS login failed.</p>
-                                [% END %]
+                                    [% IF ( casServerUrl ) %]
+                                       <p><a href="[% casServerUrl | $raw %]">Log in using a CAS account.</a><p>
+                                    [% END %]
 
-                                [% IF ( casServerUrl ) %]
-                                   <p><a href="[% casServerUrl | $raw %]">Log in using a CAS account.</a><p>
-                                [% END %]
+                                    [% IF ( casServersLoop ) %]
+                                        <p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
+                                        <ul>
+                                            [% FOREACH casServer IN casServersLoop %]
+                                            <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
+                                            [% END %]
+                                        </ul>
+                                    [% END %]
+                                [% END # /IF shibbolethAuthentication %]
 
-                                [% IF ( casServersLoop ) %]
-                                    <p>If you have a CAS account, please choose against which one you would like to authenticate:</p>
-                                    <ul>
-                                        [% FOREACH casServer IN casServersLoop %]
-                                        <li><a href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
-                                        [% END %]
-                                    </ul>
+                                [% IF ( shibbolethAuthentication ) %]
+                                    <p>Nothing</p>
+                                [% ELSE %]
+                                    <h3>Local login</h3>
+                                    <p>If you do not have a CAS account, but do have a local account, you can still log in: </p>
                                 [% END %]
-                            [% END # /IF shibbolethAuthentication %]
 
-                            [% IF ( shibbolethAuthentication ) %]
-                                <p>Nothing</p>
-                            [% ELSE %]
-                                <h3>Local login</h3>
-                                <p>If you do not have a CAS account, but do have a local account, you can still log in: </p>
-                            [% END %]
+                            [% END # / IF casAuthentication %]
 
-                        [% END # / IF casAuthentication %]
-
-                        [% IF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %]
-                            [% IF ( invalidGoogleOpenIDConnectLogin ) %]
-                                <h3>Google login</h3>
-                                <p>Sorry, your Google login failed. <span class="error">[% invalidGoogleOpenIDConnectLogin | html %]</span></p>
-                                <p>Please note that the Google login will only work if you are using the e-mail address registered with this library.</p>
-                                <p>If you want to, you can try to <a href="/cgi-bin/koha/svc/auth/googleopenidconnect?reauthenticate=select_account">log in using a different account</a>
-                            [% END %]
-                            <a href="/cgi-bin/koha/svc/auth/googleopenidconnect" class="btn btn-primary" id="openid_connect">Log in with Google</a>
-                            <p>If you do not have a Google account, but do have a local account, you can still log in: </p>
-                        [% END # /IF GoogleOpenIDConnect %]
+                            [% IF ( Koha.Preference('GoogleOpenIDConnect') == 1 ) %]
+                                [% IF ( invalidGoogleOpenIDConnectLogin ) %]
+                                    <h3>Google login</h3>
+                                    <p>Sorry, your Google login failed. <span class="error">[% invalidGoogleOpenIDConnectLogin | html %]</span></p>
+                                    <p>Please note that the Google login will only work if you are using the e-mail address registered with this library.</p>
+                                    <p>If you want to, you can try to <a href="/cgi-bin/koha/svc/auth/googleopenidconnect?reauthenticate=select_account">log in using a different account</a>
+                                [% END %]
+                                <a href="/cgi-bin/koha/svc/auth/googleopenidconnect" class="btn btn-primary" id="openid_connect">Log in with Google</a>
+                                <p>If you do not have a Google account, but do have a local account, you can still log in: </p>
+                            [% END # /IF GoogleOpenIDConnect %]
                         [% END # /UNLESS OPACShibOnly %]
 
                         [% IF !Koha.Preference('OPACShibOnly') or SCO_login or SCI_login %]
-                        [% IF SCO_login %]
-                            <form action="/cgi-bin/koha/sco/sco-main.pl" name="auth" id="auth" method="post" autocomplete="off">
-                        [% ELSIF SCI_login %]
-                            <form action="/cgi-bin/koha/sci/sci-main.pl" name="auth" id="auth" method="post" autocomplete="off">
-                        [% ELSE %]
-                            <form action="[% script_name | html %]" name="auth" id="auth" method="post" autocomplete="off">
-                        [% END %]
-                            <input type="hidden" name="koha_login_context" value="opac" />
-
-                            <fieldset class="brief">
-                                [% FOREACH INPUT IN INPUTS %]
-                                    [% NEXT IF INPUT.name == 'logout.x' %]
-                                    <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
-                                [% END %]
-                                <div class="form-group">
-                                    <label for="userid">Login</label>
-                                    <input class="form-control" type="text"  size="25" id="userid"  name="userid" />
-                                </div>
-                                <div class="form-group">
-                                    <label for="password">Password</label>
-                                    <input class="form-control" type="password"  size="25" id="password"  name="password" />
-                                </div>
-                                <fieldset class="action">
-                                    <input type="submit" value="Log in" class="btn btn-primary" />
+                            [% IF SCO_login %]
+                                <form action="/cgi-bin/koha/sco/sco-main.pl" name="auth" id="auth" method="post" autocomplete="off">
+                            [% ELSIF SCI_login %]
+                                <form action="/cgi-bin/koha/sci/sci-main.pl" name="auth" id="auth" method="post" autocomplete="off">
+                            [% ELSE %]
+                                <form action="[% script_name | html %]" name="auth" id="auth" method="post" autocomplete="off">
+                            [% END %]
+                                <input type="hidden" name="koha_login_context" value="opac" />
+
+                                <fieldset class="brief">
+                                    [% FOREACH INPUT IN INPUTS %]
+                                        [% NEXT IF INPUT.name == 'logout.x' %]
+                                        <input type="hidden" name="[% INPUT.name | html %]" value="[% INPUT.value | html %]" />
+                                    [% END %]
+                                    <div class="form-group">
+                                        <label for="userid">Login</label>
+                                        <input class="form-control" type="text"  size="25" id="userid"  name="userid" />
+                                    </div>
+                                    <div class="form-group">
+                                        <label for="password">Password</label>
+                                        <input class="form-control" type="password"  size="25" id="password"  name="password" />
+                                    </div>
+                                    <fieldset class="action">
+                                        <input type="submit" value="Log in" class="btn btn-primary" />
+                                    </fieldset>
                                 </fieldset>
-                            </fieldset>
 
-                            [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
-                                <div id="forgotpassword">
-                                    <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
-                                </div>
-                            [% END %]
-                            <div id="nologininstructions">
-                                [% IF Koha.Preference('OpacLoginInstructions') %]
-                                    [% Koha.Preference('OpacLoginInstructions') | $raw %]
-                                [% ELSE %]
-                                    <h3>Don't have a password yet?</h3>
-                                    <p>If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.</p>
-                                    <h3>Don't have a library card?</h3>
-                                    <p>If you don't have a library card, stop by your local library to sign up.</p>
-                                [% END # / IF Koha.Preference('OpacLoginInstructions') %]
-
-                                [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
-                                    <span id="registrationinstructions">
-                                        <a href="/cgi-bin/koha/opac-memberentry.pl">You may register here.</a>
-                                    </span>
+                                [% IF Koha.Preference('OpacPasswordChange') && Categories.can_any_reset_password %]
+                                    <div id="forgotpassword">
+                                        <a href="/cgi-bin/koha/opac-password-recovery.pl">Forgot your password?</a>
+                                    </div>
                                 [% END %]
-                            </div>
-                        </form>
+                                <div id="nologininstructions">
+                                    [% IF Koha.Preference('OpacLoginInstructions') %]
+                                        [% Koha.Preference('OpacLoginInstructions') | $raw %]
+                                    [% ELSE %]
+                                        <h3>Don't have a password yet?</h3>
+                                        <p>If you don't have a password yet, stop by the circulation desk the next time you're in the library. We'll happily set one up for you.</p>
+                                        <h3>Don't have a library card?</h3>
+                                        <p>If you don't have a library card, stop by your local library to sign up.</p>
+                                    [% END # / IF Koha.Preference('OpacLoginInstructions') %]
+
+                                    [% IF PatronSelfRegistration && PatronSelfRegistrationDefaultCategory %]
+                                        <span id="registrationinstructions">
+                                            <a href="/cgi-bin/koha/opac-memberentry.pl">You may register here.</a>
+                                        </span>
+                                    [% END %]
+                                </div>
+                            </form>
                         [% END # / IF !OPACShibOnly or SCO_login or SCI_login %]
                     [% END # / IF loginprompt %]
 
index f2ccf82..181fb9a 100644 (file)
             <div class="col-12 col-lg-3 order-md-2">
                 [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]
                     [% UNLESS ( loggedinusername ) %]
-                        [% UNLESS ( casAuthentication || shibbolethAuthentication ) %]
+                        [% UNLESS ( casAuthentication || shibbolethAuthentication || Koha.Preference('opacShibOnly') ) %]
                             <div id="login">
                                 <form action="/cgi-bin/koha/opac-user.pl" method="post" name="auth" id="auth" autocomplete="off">
                                     <input type="hidden" name="koha_login_context" value="opac" />