Bugzilla – Attachment 183910 Details for
Bug 40336
Self-checkouts restart every second if invalid data in timeout sysprefs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40336: Validate timeout syspref for self-checks
Bug-40336-Validate-timeout-syspref-for-self-checks.patch (text/plain), 3.81 KB, created by
David Cook
on 2025-07-10 00:47:26 UTC
(
hide
)
Description:
Bug 40336: Validate timeout syspref for self-checks
Filename:
MIME Type:
Creator:
David Cook
Created:
2025-07-10 00:47:26 UTC
Size:
3.81 KB
patch
obsolete
>From 4bd5feef28653ae26482acf94cf31fe310f65960 Mon Sep 17 00:00:00 2001 >From: David Cook <dcook@prosentient.com.au> >Date: Thu, 10 Jul 2025 00:41:18 +0000 >Subject: [PATCH] Bug 40336: Validate timeout syspref for self-checks > >This patch validates the numbers passed to the self-check timeout >code, so that it must be a valid number >= 10 seconds. If it fails >this validation, it defaults to 120 seconds. > >Test plan: >0. Apply the patch >1. Enable the SelfCheckInModule and WebBasedSelfCheck syspref >2. Try out these modules using varying values in the SelfCheckInTimeout >and SelfCheckTimeout system preferences resepectives. For instance: > - A blank space (ie " ") > - A negative number (e.g. -7) > - An alphabetic string (e.g. aa) > - A positive number less than 10 (e.g. 5) > - A positive number greater than 10 (e.g. 60) >3. Check the "idle_timeout" value set in the timer objects using the >following in the browser console: > console.log(window.sci_login_timer); > console.log(window.sco_login_timer); >4. Note that all cases except positive numbers greater than or equal >to 10 get reset to 120 >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt | 2 +- > koha-tmpl/opac-tmpl/bootstrap/js/timeout.js | 7 +++++-- > 3 files changed, 7 insertions(+), 4 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt >index 1f9664fc3d..24198def8f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt >@@ -301,7 +301,7 @@ > function login_timeout(){ > //NOTE: There can only be 1 sci_login_timer at a time > if ( ! window.sci_login_timer ){ >- const idleTimeout = "[% Koha.Preference('SelfCheckInTimeOut') || 120 | html %]"; >+ const idleTimeout = "[% Koha.Preference('SelfCheckInTimeOut') | html %]"; > const home_href = "/cgi-bin/koha/sci/sci-main.pl"; > const sci_timer = new sc_timer({ > "idle_timeout": idleTimeout, >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >index 52227a6b42..899d65904f 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt >@@ -420,7 +420,7 @@ > function login_timeout(){ > //NOTE: There can only be 1 sco_login_timer at a time > if ( ! window.sco_login_timer ){ >- const idleTimeout = "[% Koha.Preference('SelfCheckTimeout') || 120 | html %]"; >+ const idleTimeout = "[% Koha.Preference('SelfCheckTimeout') | html %]"; > const home_href = "/cgi-bin/koha/sco/sco-main.pl?op=logout"; > const sco_timer = new sc_timer({ > "idle_timeout": idleTimeout, >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js b/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js >index 6c508d14c0..2e4ad8d389 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js >@@ -1,9 +1,12 @@ > class sc_timer { > constructor(args) { >- const idle_timeout = args["idle_timeout"]; >+ const idle_timeout = Number(args["idle_timeout"]); > const redirect_url = args["redirect_url"]; >- if (idle_timeout) { >+ const idle_timeout_minimum = 10; >+ if (idle_timeout && idle_timeout >= idle_timeout_minimum) { > this.idle_timeout = idle_timeout; >+ } else { >+ this.idle_timeout = 120; > } > if (redirect_url) { > this.redirect_url = redirect_url; >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 40336
: 183910