Bugzilla – Attachment 175239 Details for
Bug 36586
Self-checkouts will get CSRF errors if left inactive for 8 hours
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36586: WIP
Bug-36586-WIP.patch (text/plain), 3.85 KB, created by
Nick Clemens (kidclamp)
on 2024-12-05 12:34:11 UTC
(
hide
)
Description:
Bug 36586: WIP
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2024-12-05 12:34:11 UTC
Size:
3.85 KB
patch
obsolete
>From 215c5ee843be5dd31b2c6cdd002f4b92050adf90 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 4 Dec 2024 21:10:55 +0000 >Subject: [PATCH] Bug 36586: WIP > >This patch moves the refresh code into a js include and sets a few variables in the page. >It also moves the fetch of the pref into the template. > >We need to copy this over for the sco - and probably add a new pref. > >Lastly, the code here only refreshes during an active session, probably we could have a single pref >SelfCheckRefresh >that would trigger on the main page, default to 3 or 4 hours? >--- > .../bootstrap/en/modules/sci/sci-main.tt | 28 ++++--------------- > koha-tmpl/opac-tmpl/bootstrap/js/timeout.js | 22 +++++++++++++++ > opac/sci/sci-main.pl | 4 --- > 3 files changed, 27 insertions(+), 27 deletions(-) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/js/timeout.js > >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 8308303626a..7d9326c34c3 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 >@@ -202,6 +202,7 @@ > > [% INCLUDE 'opac-bottom.inc' %] > [% BLOCK jsinclude %] >+[% Asset.js('js/timeout.js') | $raw %] > <script> > > function mungeHistory() { >@@ -273,29 +274,10 @@ > }); > > >- var idleTime = 0; >- $(document).ready(function () { >- //Increment the idle time counter every second >- var idleInterval = setInterval(timerIncrement, 1000); >- >- //Zero the idle timer on mouse movement. >- $(this).mousemove(function (e) { >- idleTime = 0; >- }); >- $(this).keypress(function (e) { >- idleTime = 0; >- }); >- }); >- >- function timerIncrement() { >- if ( $("#sci_finish_button").is(":visible") || $("#sci_refresh_button").is(":visible") ) { >- idleTime = idleTime + 1; >- idleTimeout = [% refresh_timeout | html %]; >- if (idleTime >= idleTimeout ) { >- location.href = '/cgi-bin/koha/sci/sci-main.pl'; >- } >- } >- } >+ let idleTimeout = [% Koha.Preference('SelfCheckInTimeOut') || 120 %]; >+ let refresh_button = $("#sci_refresh_button"); >+ let finish_button = $("#sci_finish_button"); >+ let home_href = "/cgi-bin/koha/sci/sci-main.pl"; > > > function checkBarcodeInput() { >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js b/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js >new file mode 100644 >index 00000000000..40097dca926 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js >@@ -0,0 +1,22 @@ >+var idleTime = 0; >+$(document).ready(function () { >+ //Increment the idle time counter every second >+ var idleInterval = setInterval(timerIncrement, 1000); >+ >+ //Zero the idle timer on mouse movement. >+ $(this).mousemove(function (e) { >+ idleTime = 0; >+ }); >+ $(this).keypress(function (e) { >+ idleTime = 0; >+ }); >+}); >+ >+function timerIncrement() { >+ if ( finish_button.is(":visible") || refresh_button.is(":visible") ) { >+ idleTime = idleTime + 1; >+ if (idleTime >= idleTimeout ) { >+ location.href = home_href; >+ } >+ } >+} >diff --git a/opac/sci/sci-main.pl b/opac/sci/sci-main.pl >index d2fdca9e103..8c8c04965e6 100755 >--- a/opac/sci/sci-main.pl >+++ b/opac/sci/sci-main.pl >@@ -105,8 +105,4 @@ if ( $op eq 'cud-check_in' ) { > $template->param( success => \@success, errors => \@errors, checkins => 1 ); > } > >-# Make sure timeout has a reasonable value >-my $timeout = C4::Context->preference('SelfCheckInTimeout') || 120; >-$template->param( refresh_timeout => $timeout ); >- > output_html_with_http_headers $cgi, $cookie, $template->output, undef, { force_no_caching => 1 }; >-- >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 36586
:
175210
| 175239 |
175919