From 147c59581723ad4350c0b02d8b2ea8a7cb776eb0 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 14 Mar 2016 14:46:30 -0400 Subject: [PATCH] JBAS-1132 success page; activity timeout On success hide the registration form for privacy and provide link to docs on what forms of identification will be necessary. Support inacitivty timeout during registration and for automatic redirect after successfull registration. Signed-off-by: Bill Erickson --- KCLS/openils/var/templates_kcls/opac/register.tt2 | 44 +++++++++-------------- Open-ILS/web/js/ui/default/opac/register.js | 29 ++++++++++++++- 2 files changed, 45 insertions(+), 28 deletions(-) diff --git a/KCLS/openils/var/templates_kcls/opac/register.tt2 b/KCLS/openils/var/templates_kcls/opac/register.tt2 index ce8e746f68..8123e73637 100644 --- a/KCLS/openils/var/templates_kcls/opac/register.tt2 +++ b/KCLS/openils/var/templates_kcls/opac/register.tt2 @@ -6,7 +6,7 @@ # for privacy, reload the page after (default) 5 minutes refresh_time = ctx.register.settings.refresh_timeout || 300; -ctx.refresh = refresh_time _ '; ' _ ctx.opac_root _ '/home'; +ctx.refresh = refresh_time _ '; ' _ 'https://www.kcls.org'; # some useful variables and MACROs for display, # field validation, and added info display @@ -115,35 +115,24 @@ END; # input_field() [% IF ctx.register.success %]

[% l('Registration successful!') %]

-

[% l('Please see library staff to complete your registration.') %]

+

+ To fully activate your card you will need to visit a KCLS library + with proof of address and photo ID that shows your date of + birth. Parents/guardians can assist with proof of address for full + activation for applicants under 18. Find a list of the documents + you may use to provide proof of address on our + + downloadable application. + +

+
- + You will be automatically redirected to + www.kcls.org...

- [% END %] - - + + [% ELSE %]
    @@ -454,6 +443,7 @@ END; # input_field()
+ [% END # IF ctx.success %] diff --git a/Open-ILS/web/js/ui/default/opac/register.js b/Open-ILS/web/js/ui/default/opac/register.js index 3f521747f0..6dd4e0f408 100644 --- a/Open-ILS/web/js/ui/default/opac/register.js +++ b/Open-ILS/web/js/ui/default/opac/register.js @@ -15,10 +15,14 @@ var required_fields = [ 'stgba.post_code', ]; -var copy_addr_fields = ['street1','street2','city','state','post_code']; +var last_activity = new Date(); +var activity_timeout = 30000; // 30 seconds +var post_success_timeout = 15000; // 15 seconds +var timeout_redirect = 'https://www.kcls.org'; /* show/hide card options depending on the selected type. */ function show_card_types(type) { + last_activity = new Date(); var wal = document.getElementById('wallet-cards'); var key = document.getElementById('keychain-cards'); if (type == 'wallet') { @@ -52,6 +56,7 @@ function show_hide_mailing(hide) { } function validate(dom_id) { + last_activity = new Date(); var element = document.getElementById(dom_id); var value = element ? element.value : ''; var valid = true; @@ -207,4 +212,26 @@ function onsub() { return true; } +function activity_checker_thread() { + var start = last_activity.getTime(); + var end = new Date().getTime(); + var diff = end - start; + + var timeout = + document.getElementById('register-success') ? + post_success_timeout : activity_timeout; + + console.debug('checking activity timeout=' + + timeout + ' : time range (ms) = ' + diff); + + if (diff > timeout) { + location.href = timeout_redirect; + return; + } + + setTimeout(activity_checker_thread, 2000); +} + + +activity_checker_thread(); -- 2.11.0