From 2e67673b373c72dce75312d05810e52be1a5350c Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 1 Feb 2023 21:23:43 -1000 Subject: [PATCH] Bug 20632: Alert when SCO or SCI user in OPAC login page Special patrons for self check-out/check-in are not allowed to login into OPAC. This patch adds an alter message in OPAC login page when authentification is tried with SCO/SCI user. Test plan : 1) SCO 1.1) Use koha-testing-docker that is configured with patron 'self_checkout' 1.2) Go to OPAC main page, not logged-in 1.3) Try to login with login 'self_checkout' and password 'self_checkout' => You see an alert 'You can not loggin with self check-out user' 2) SCI 2.1) Create a new patron with login 'self_checkin', password 'self_checkin' 2.2) Define on him the permission 'self_checkin_module' 2.3) Go to OPAC main page, not logged-in 2.4) Try to login with login 'self_checkin' and password 'self_checkin' => You see an alert 'You can not loggin with self check-in user' --- C4/Auth.pm | 5 +++-- .../opac-tmpl/bootstrap/en/modules/opac-auth.tt | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 8e5b5f6e54..908f725029 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -229,7 +229,7 @@ sub get_template_and_user { ) ) { - $kick_out = 1; + $kick_out = 'sco_user'; } elsif ( # If the user logged in is the SCI user and they try to go out of the SCI module, @@ -245,7 +245,7 @@ sub get_template_and_user { && $flags && $flags->{superlibrarian} != 1 ) { - $kick_out = 1; + $kick_out = 'sci_user'; } if ($kick_out) { @@ -265,6 +265,7 @@ sub get_template_and_user { loginprompt => 1, script_name => get_script_name(), auth_error => $auth_error, + $kick_out => 1, ); print $in->{query}->header( 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 999e6aaa7e..ff46083fe3 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-auth.tt @@ -84,6 +84,18 @@ [% END %] + [% IF sco_user %] +
+

You can not loggin with self check-out user

+
+ [% END %] + + [% IF sci_user %] +
+

You can not loggin with self check-in user

+
+ [% END %] + [% IF ( shibbolethAuthentication ) %] [% IF ( invalidShibLogin ) %] -- 2.39.0