View | Details | Raw Unified | Return to bug 40224
Collapse All | Expand All

(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sci/sci-main.tt (-2 / +7 lines)
Lines 198-203 Link Here
198
    </div> <!-- /.modal-dialog -->
198
    </div> <!-- /.modal-dialog -->
199
</div> <!-- /#helpModal -->
199
</div> <!-- /#helpModal -->
200
200
201
<form action="/cgi-bin/koha/sco/sco-main.pl" id="logout_post_form" method="post">
202
    [% INCLUDE 'csrf-token.inc' %]
203
    <input type="hidden" name="op" value="cud-logout" />
204
</form>
205
201
</body>
206
</body>
202
207
203
[% INCLUDE 'opac-bottom.inc' %]
208
[% INCLUDE 'opac-bottom.inc' %]
Lines 286-293 Link Here
286
                    const home_href = "/cgi-bin/koha/sci/sci-main.pl";
291
                    const home_href = "/cgi-bin/koha/sci/sci-main.pl";
287
                    const sci_timer = new sc_timer({
292
                    const sci_timer = new sc_timer({
288
                        "idle_timeout": idleTimeout,
293
                        "idle_timeout": idleTimeout,
289
                        "redirect_url": home_href
294
                        "form_id": "logout_post_form",
290
            });
295
                    });
291
                    window.sci_login_timer = sci_timer;
296
                    window.sci_login_timer = sci_timer;
292
                    sci_timer.start_timer();
297
                    sci_timer.start_timer();
293
                }
298
                }
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt (-6 / +12 lines)
Lines 526-533 Link Here
526
            </div> <!-- / .row -->
526
            </div> <!-- / .row -->
527
        </div> <!-- / .container-fluid -->
527
        </div> <!-- / .container-fluid -->
528
    </div> <!-- / .main -->
528
    </div> <!-- / .main -->
529
529
    <span id="audio-alert"></span>
530
    <span id="audio-alert"></span>
530
531
532
    <form action="/cgi-bin/koha/sco/sco-main.pl" id="logout_post_form" method="post">
533
        [% INCLUDE 'csrf-token.inc' %]
534
        <input type="hidden" name="op" value="cud-logout" />
535
    </form>
536
531
    [% INCLUDE 'opac-bottom.inc' %]
537
    [% INCLUDE 'opac-bottom.inc' %]
532
    [% BLOCK jsinclude %]
538
    [% BLOCK jsinclude %]
533
        [% INCLUDE 'datatables.inc' %]
539
        [% INCLUDE 'datatables.inc' %]
Lines 547-556 Link Here
547
                //NOTE: There can only be 1 sco_login_timer at a time
553
                //NOTE: There can only be 1 sco_login_timer at a time
548
                if ( ! window.sco_login_timer ){
554
                if ( ! window.sco_login_timer ){
549
                    const idleTimeout = "[% Koha.Preference('SelfCheckTimeout') || 120 | html %]";
555
                    const idleTimeout = "[% Koha.Preference('SelfCheckTimeout') || 120 | html %]";
550
                    const home_href = "/cgi-bin/koha/sco/sco-main.pl?op=logout";
556
                    const home_href = "/cgi-bin/koha/sco/sco-main.pl";
551
                    const sco_timer = new sc_timer({
557
                    const sco_timer = new sc_timer({
552
                        "idle_timeout": idleTimeout,
558
                        "idle_timeout": idleTimeout,
553
                        "redirect_url": home_href
559
                        "form_id": "logout_post_form",
554
                    });
560
                    });
555
                    window.sco_login_timer = sco_timer;
561
                    window.sco_login_timer = sco_timer;
556
                    sco_timer.start_timer();
562
                    sco_timer.start_timer();
Lines 571-577 Link Here
571
            // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
577
            // alert("checkout_confirm('" + patronid + "') called for barcode '" + barcode + "'");
572
            if (! barcode) { dofocus(); return false; }    // no barcode
578
            if (! barcode) { dofocus(); return false; }    // no barcode
573
            if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode
579
            if (barcode == "__KOHA_NEW_CIRC__") {   // magic barcode
574
                window.location.href='/cgi-bin/koha/sco/sco-main.pl?op=logout';
580
                $("#logout_post_form").submit();
575
                return false;
581
                return false;
576
            }
582
            }
577
            return true;
583
            return true;
Lines 645-657 Link Here
645
                    confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) {
651
                    confirmModal("", _("Would you like to print a receipt?"), _("Print receipt and end session"), _("End session"), function(result) {
646
                        if ( result && (Date.now() - confirmStart) < [% Koha.Preference('SelfCheckTimeout') | html %] ) {
652
                        if ( result && (Date.now() - confirmStart) < [% Koha.Preference('SelfCheckTimeout') | html %] ) {
647
                            var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip");
653
                            var win = window.open("/cgi-bin/koha/sco/printslip.pl?print=qslip");
648
                            location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
654
                            $("#logout_post_form").submit();
649
                        } else {
655
                        } else {
650
                            location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
656
                            $("#logout_post_form").submit();
651
                        }
657
                        }
652
                    })
658
                    })
653
                [% ELSE %]
659
                [% ELSE %]
654
                    location.href = '/cgi-bin/koha/sco/sco-main.pl?op=logout';
660
                    $("#logout_post_form").submit();
655
                [% END %]
661
                [% END %]
656
662
657
                return true;
663
                return true;
(-)a/koha-tmpl/opac-tmpl/bootstrap/js/timeout.js (-8 / +6 lines)
Lines 1-13 Link Here
1
class sc_timer {
1
class sc_timer {
2
    constructor(args) {
2
    constructor(args) {
3
        const idle_timeout = args["idle_timeout"];
3
        const idle_timeout = args["idle_timeout"];
4
        const redirect_url = args["redirect_url"];
4
        const form_id = args["form_id"];
5
        if (idle_timeout) {
5
6
            this.idle_timeout = idle_timeout;
6
        this.idle_timeout = idle_timeout;
7
        }
7
        this.form_id = form_id;
8
        if (redirect_url) {
8
9
            this.redirect_url = redirect_url;
10
        }
11
        this.idle_time = 0;
9
        this.idle_time = 0;
12
    }
10
    }
13
11
Lines 33-39 class sc_timer { Link Here
33
    _timer_increment() {
31
    _timer_increment() {
34
        this.idle_time++;
32
        this.idle_time++;
35
        if (this.idle_time >= this.idle_timeout) {
33
        if (this.idle_time >= this.idle_timeout) {
36
            location.href = this.redirect_url;
34
            $("#" + this.form_id).submit();
37
        }
35
        }
38
    }
36
    }
39
}
37
}
(-)a/opac/sco/sco-main.pl (-3 / +1 lines)
Lines 93-100 my ( $op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues, $load_ch Link Here
93
93
94
my $jwt = $query->cookie('JWT');
94
my $jwt = $query->cookie('JWT');
95
95
96
#FIXME: This needs to be changed to a POSTed logout...
96
if ( $op eq "cud-logout" ) {
97
if ( $op eq "logout" ) {
98
    $template->param( loggedout => 1 );
97
    $template->param( loggedout => 1 );
99
    $query->param( patronlogin => undef, patronpw => undef );
98
    $query->param( patronlogin => undef, patronpw => undef );
100
    undef $jwt;
99
    undef $jwt;
101
- 

Return to bug 40224