From 4f6e8d39287a7a3b96f1d3f323e44826ee3bddd4 Mon Sep 17 00:00:00 2001 From: Imani Thomas Date: Thu, 13 Feb 2025 16:59:42 +0000 Subject: [PATCH] Bug 39135: adding a OpacPasswordLabelTextContent system preference add a new system preference for password labels to test: 1. apply the patch 2. log into admin and go to the opac system preferences and change the OpacPasswordLabelTextContent system preference to Password/PIN 3. go to the public url and open the login and see the password field now says Password/PIN instead 4. Change the preference again and save and see your changes reflected --- .../data/mysql/atomicupdate/bug_39135.pl | 21 +++++++++++++++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + .../en/modules/admin/preferences/opac.pref | 9 ++++++++ .../bootstrap/en/includes/html_helpers.inc | 11 ++++++++++ .../bootstrap/en/includes/masthead.inc | 8 +++++-- .../bootstrap/en/modules/opac-auth.tt | 2 +- .../bootstrap/en/modules/opac-main.tt | 2 +- .../modules/opac-registration-confirmation.tt | 2 +- .../bootstrap/en/modules/sco/sco-main.tt | 4 +--- 9 files changed, 52 insertions(+), 8 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/bug_39135.pl diff --git a/installer/data/mysql/atomicupdate/bug_39135.pl b/installer/data/mysql/atomicupdate/bug_39135.pl new file mode 100755 index 0000000000..b60bd563ab --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_39135.pl @@ -0,0 +1,21 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_success say_info); + +return { + bug_number => "39135", + description => "Add system preference to determine label of password input on login form", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + # Do you stuffs here + $dbh->do( + q{INSERT IGNORE INTO systempreferences (variable,value) VALUES ('OPACPasswordLabelTextContent','password') } + ); + + # Print useful stuff here + + # sysprefs + say $out "Added new system preference 'OPACPasswordLabelTextContent'"; + }, +}; diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index 682b9fb950..818d61761d 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -530,6 +530,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACOpenURLItemTypes', '', NULL, 'Show the OpenURL link only for these item types', 'Free'), ('OPACOverDrive','0',NULL,'Enable OverDrive integration in the OPAC','YesNo'), ('OpacPasswordChange','1',NULL,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)','YesNo'), +('OPACPasswordLabelTextContent','password',NULL,NULL,NULL), ('OPACPatronDetails','1','','If OFF the patron details tab in the OPAC is disabled.','YesNo'), ('OPACpatronimages','0',NULL,'Enable patron images in the OPAC','YesNo'), ('OPACPlayMusicalInscripts','0','','If displayed musical inscripts, play midi conversion on the OPAC record details page.','YesNo'), diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 03739d28f8..314277dd2c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -191,6 +191,15 @@ OPAC: username: username cardnumberorusername: card number or username - "as the label of the userid input field on the OPAC login form." + - + - Use + - pref: OPACPasswordLabelTextContent + default: Password + choices: + password: Password + pin: PIN + passwordorpin: Password/PIN + - "as the label of the password input field on the OPAC login form." - - pref: OPACShowMusicalInscripts default: 0 diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc index 8f8cc44535..6c27eafbe3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/html_helpers.inc @@ -184,3 +184,14 @@ [%- END %] [% END %] + +[% BLOCK password_label %] + [%- SET preference_value = Koha.Preference('OPACPasswordLabelTextContent') %] + [%- SET label = t("Password") %] + [%- IF preference_value == "pin" %] + [%- SET label = t("PIN") %] + [%- ELSIF preference_value == "passwordorpin" %] + [%- SET label = t("Password/PIN") %] + [%- END %] + +[% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc index e624134bf5..3ddb993f07 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc @@ -495,8 +495,12 @@
- + [% PROCESS password_label for="password" %]
diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt index 476bc3c323..3ef36ba6f0 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -193,7 +193,7 @@