From 51f5429ea333b5e833fb063d337d1c8fd2c8ba7a Mon Sep 17 00:00:00 2001
From: Fridolin Somers <fridolin.somers@biblibre.com>
Date: Wed, 21 Feb 2024 10:09:30 +0100
Subject: [PATCH] Bug 36141 - Add classes to CAS text on OPAC login page

This enhancement makes it easier for libraries to change the CAS-related messages on the OPAC login page.

It moved the invalid CAS login message above the CAS loging heading,
like for Shibboleth login.

Test plan :
1) Enable system preference 'casAuthentication'
2) Restart all caches (restart_all in koha-testing-docker)
3) Go to OPAC, logged out
4) Click on 'Log in to your account'
5) In the staff interface, edit the OPACUserJS system preference. Add the following JS and Save:
   $(".cas_invalid").text("Test changing the invalid CAS login message.");
   $(".cas_title").text("Test changing the CAS login heading.");
   $(".cas_url").text("Test changing the CAS account link text.");
   $(".cas_url").after(' <i class="fa fa-globe" aria-hidden="true"></i>');
6) Refresh the OPAC and confirm the text changes to reflect your JS.
---
 .../bootstrap/en/modules/opac-auth.tt         | 22 ++++++++++---------
 1 file changed, 12 insertions(+), 10 deletions(-)

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 f76ded9c5f..bb15dc1849 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt
@@ -88,7 +88,7 @@
                                             [% 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>
+                                                    <p class="cas_invalid">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 %]
@@ -103,7 +103,7 @@
                                 [% END # /IF invalidShibLogin %]
                                 [% UNLESS ( Koha.Preference('OPACShibOnly') ) %]
                                     [% IF ( casAuthentication ) %]
-                                        <h2>CAS login</h2>
+                                        <h2 class="cas_title">CAS login</h2>
                                         <p>If you do not have a Shibboleth account, but you do have a CAS account, you can use CAS.</p>
                                     [% ELSE %]
                                         <h2 class="shib_local_title">Local login</h2>
@@ -116,34 +116,36 @@
                             [% IF ( casAuthentication ) %]
                                 [% IF ( shibbolethAuthentication ) %]
                                     [% IF ( casServerUrl ) %]
-                                        <p><a href="[% casServerUrl | $raw %]">Log in.</a><p>
+                                        <p><a class="cas_url" 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>
+                                                <li><a class="cas_url" href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
                                             [% END %]
                                         </ul>
                                     [% END %]
                                 [% ELSE %]
-                                    <h2>CAS login</h2>
-
                                     [% IF ( invalidCasLogin ) %]
-                                        <!-- This is what is displayed if cas login has failed -->
-                                        <p>Sorry, the CAS login failed.</p>
+                                        <div class="alert alert-info">
+                                            <!-- This is what is displayed if cas login has failed -->
+                                            <p class="cas_invalid">Sorry, the CAS login failed.</p>
+                                        </div>
                                     [% END %]
 
+                                    <h2 class="cas_title">CAS login</h2>
+
                                     [% IF ( casServerUrl ) %]
-                                       <p><a href="[% casServerUrl | $raw %]">Log in using a CAS account.</a><p>
+                                       <p><a class="cas_url" 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>
+                                            <li><a class="cas_url" href="[% casServer.value | $raw %]">[% casServer.name | html %]</a></li>
                                             [% END %]
                                         </ul>
                                     [% END %]
-- 
2.43.1