From 9708f6f750b2c0c4c8e5492b23ece831fe90ea60 Mon Sep 17 00:00:00 2001 From: John Cleveland Date: Mon, 21 Mar 2016 18:07:53 -0400 Subject: [PATCH 1/2] Fix logging out before dialog counter has reached 0 (fixes issue #18) Fix displaying 'NaN' in the dialog --- changelog | 4 ++++ jquery-idleTimeout-for-testing.js | 11 ++++++----- jquery-idleTimeout-iframes.js | 11 ++++++----- jquery-idleTimeout.js | 11 ++++++----- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/changelog b/changelog index 47f61b1..ccfaf82 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,9 @@ Changelog - JillElaine/jquery-idleTimeout.js -------------------------------------------- +v.1.0.11 ++ Fix logging out before dialog counter has reached 0 (fixes issue #18) ++ Fix displaying 'NaN' in the dialog + v.1.0.10 + Fix 'Time Remaining' dialog timeout bug. Closes issue #17 diff --git a/jquery-idleTimeout-for-testing.js b/jquery-idleTimeout-for-testing.js index 5456c8a..62d6697 100644 --- a/jquery-idleTimeout-for-testing.js +++ b/jquery-idleTimeout-for-testing.js @@ -13,7 +13,7 @@ * Dependencies: JQuery v1.7+, JQuery UI, store.js from https://github.com/marcuswestin/store.js - v1.3.4+ * * Commented and console logged for debugging with Firefox & Firebug or similar - * version 1.0.10 + * version 1.0.11 **/ /*global jQuery: false, document: false, store: false, clearInterval: false, setInterval: false, setTimeout: false, clearTimeout: false, window: false, alert: false, console: false*/ @@ -72,7 +72,7 @@ activityDetector, startKeepSessionAlive, stopKeepSessionAlive, keepSession, keepAlivePing, // session keep alive idleTimer, remainingTimer, checkIdleTimeout, checkIdleTimeoutLoop, startIdleTimer, stopIdleTimer, // idle timer - openWarningDialog, dialogTimer, checkDialogTimeout, startDialogTimer, stopDialogTimer, isDialogOpen, destroyWarningDialog, countdownDisplay, // warning dialog + openWarningDialog, dialogTimer, checkDialogTimeout, startDialogTimer, stopDialogTimer, isDialogOpen, destroyWarningDialog, countdownDisplay, dialogDisplaySeconds, // warning dialog logoutUser, checkForIframes, includeIframes, attachEventIframe; // iframes @@ -231,7 +231,7 @@ checkDialogTimeout = function () { var timeDialogTimeout = (store.get('idleTimerLastActivity') + (currentConfig.idleTimeLimit * 1000) + (currentConfig.dialogDisplayLimit * 1000)); - if (($.now() > timeDialogTimeout) || (store.get('idleTimerLoggedOut') === true)) { + if ((($.now() > timeDialogTimeout) && (dialogDisplaySeconds <= 0)) || (store.get('idleTimerLoggedOut') === true)) { console.log('warning dialog is open and user has remained inactive for the dialogDisplayLimit. Time to log out user.'); logoutUser(); } else { @@ -271,7 +271,8 @@ // display remaining time on warning dialog countdownDisplay = function () { - var dialogDisplaySeconds = currentConfig.dialogDisplayLimit, mins, secs; + dialogDisplaySeconds = currentConfig.dialogDisplayLimit; + var mins, secs; remainingTimer = setInterval(function () { mins = Math.floor(dialogDisplaySeconds / 60); // minutes @@ -279,7 +280,7 @@ secs = dialogDisplaySeconds - (mins * 60); // seconds if (secs < 10) { secs = '0' + secs; } $('#countdownDisplay').html(mins + ':' + secs); - dialogDisplaySeconds -= 1; + if (dialogDisplaySeconds) { dialogDisplaySeconds -= 1; } }, 1000); }; diff --git a/jquery-idleTimeout-iframes.js b/jquery-idleTimeout-iframes.js index 19e74fa..1e087c5 100644 --- a/jquery-idleTimeout-iframes.js +++ b/jquery-idleTimeout-iframes.js @@ -12,7 +12,7 @@ * * Dependencies: JQuery v1.7+, JQuery UI, store.js from https://github.com/marcuswestin/store.js - v1.3.4+ * - * version 1.0.10 + * version 1.0.11 **/ /*global jQuery: false, document: false, store: false, clearInterval: false, setInterval: false, setTimeout: false, clearTimeout: false, window: false, alert: false*/ @@ -69,7 +69,7 @@ activityDetector, startKeepSessionAlive, stopKeepSessionAlive, keepSession, keepAlivePing, // session keep alive idleTimer, remainingTimer, checkIdleTimeout, checkIdleTimeoutLoop, startIdleTimer, stopIdleTimer, // idle timer - openWarningDialog, dialogTimer, checkDialogTimeout, startDialogTimer, stopDialogTimer, isDialogOpen, destroyWarningDialog, countdownDisplay, // warning dialog + openWarningDialog, dialogTimer, checkDialogTimeout, startDialogTimer, stopDialogTimer, isDialogOpen, destroyWarningDialog, countdownDisplay, dialogDisplaySeconds, // warning dialog logoutUser, checkForIframes, includeIframes, attachEventIframe; // iframes @@ -203,7 +203,7 @@ checkDialogTimeout = function () { var timeDialogTimeout = (store.get('idleTimerLastActivity') + (currentConfig.idleTimeLimit * 1000) + (currentConfig.dialogDisplayLimit * 1000)); - if (($.now() > timeDialogTimeout) || (store.get('idleTimerLoggedOut') === true)) { + if ((($.now() > timeDialogTimeout) && (dialogDisplaySeconds <= 0)) || (store.get('idleTimerLoggedOut') === true)) { logoutUser(); } }; @@ -236,7 +236,8 @@ }; countdownDisplay = function () { - var dialogDisplaySeconds = currentConfig.dialogDisplayLimit, mins, secs; + dialogDisplaySeconds = currentConfig.dialogDisplayLimit; + var mins, secs; remainingTimer = setInterval(function () { mins = Math.floor(dialogDisplaySeconds / 60); // minutes @@ -244,7 +245,7 @@ secs = dialogDisplaySeconds - (mins * 60); // seconds if (secs < 10) { secs = '0' + secs; } $('#countdownDisplay').html(mins + ':' + secs); - dialogDisplaySeconds -= 1; + if (dialogDisplaySeconds) { dialogDisplaySeconds -= 1; } }, 1000); }; diff --git a/jquery-idleTimeout.js b/jquery-idleTimeout.js index 0fe2404..440ffa2 100644 --- a/jquery-idleTimeout.js +++ b/jquery-idleTimeout.js @@ -12,7 +12,7 @@ * * Dependencies: JQuery v1.7+, JQuery UI, store.js from https://github.com/marcuswestin/store.js - v1.3.4+ * - * version 1.0.10 + * version 1.0.11 **/ /*global jQuery: false, document: false, store: false, clearInterval: false, setInterval: false, setTimeout: false, clearTimeout: false, window: false, alert: false*/ @@ -68,7 +68,7 @@ activityDetector, startKeepSessionAlive, stopKeepSessionAlive, keepSession, keepAlivePing, // session keep alive idleTimer, remainingTimer, checkIdleTimeout, checkIdleTimeoutLoop, startIdleTimer, stopIdleTimer, // idle timer - openWarningDialog, dialogTimer, checkDialogTimeout, startDialogTimer, stopDialogTimer, isDialogOpen, destroyWarningDialog, countdownDisplay, // warning dialog + openWarningDialog, dialogTimer, checkDialogTimeout, startDialogTimer, stopDialogTimer, isDialogOpen, destroyWarningDialog, countdownDisplay, dialogDisplaySeconds, // warning dialog logoutUser; //############################## @@ -190,7 +190,7 @@ checkDialogTimeout = function () { var timeDialogTimeout = (store.get('idleTimerLastActivity') + (currentConfig.idleTimeLimit * 1000) + (currentConfig.dialogDisplayLimit * 1000)); - if (($.now() > timeDialogTimeout) || (store.get('idleTimerLoggedOut') === true)) { + if ((($.now() > timeDialogTimeout) && (dialogDisplaySeconds <= 0)) || (store.get('idleTimerLoggedOut') === true)) { logoutUser(); } }; @@ -223,7 +223,8 @@ }; countdownDisplay = function () { - var dialogDisplaySeconds = currentConfig.dialogDisplayLimit, mins, secs; + dialogDisplaySeconds = currentConfig.dialogDisplayLimit; + var mins, secs; remainingTimer = setInterval(function () { mins = Math.floor(dialogDisplaySeconds / 60); // minutes @@ -231,7 +232,7 @@ secs = dialogDisplaySeconds - (mins * 60); // seconds if (secs < 10) { secs = '0' + secs; } $('#countdownDisplay').html(mins + ':' + secs); - dialogDisplaySeconds -= 1; + if (dialogDisplaySeconds) { dialogDisplaySeconds -= 1; } }, 1000); }; From e0881692eca51bc80407215e7302b065c5fa64bd Mon Sep 17 00:00:00 2001 From: John Cleveland Date: Fri, 25 Mar 2016 11:48:08 -0400 Subject: [PATCH 2/2] Allow original author to determine versioning --- changelog | 4 ---- jquery-idleTimeout-for-testing.js | 2 +- jquery-idleTimeout-iframes.js | 2 +- jquery-idleTimeout.js | 2 +- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/changelog b/changelog index ccfaf82..47f61b1 100644 --- a/changelog +++ b/changelog @@ -1,9 +1,5 @@ Changelog - JillElaine/jquery-idleTimeout.js -------------------------------------------- -v.1.0.11 -+ Fix logging out before dialog counter has reached 0 (fixes issue #18) -+ Fix displaying 'NaN' in the dialog - v.1.0.10 + Fix 'Time Remaining' dialog timeout bug. Closes issue #17 diff --git a/jquery-idleTimeout-for-testing.js b/jquery-idleTimeout-for-testing.js index 62d6697..696fa9e 100644 --- a/jquery-idleTimeout-for-testing.js +++ b/jquery-idleTimeout-for-testing.js @@ -13,7 +13,7 @@ * Dependencies: JQuery v1.7+, JQuery UI, store.js from https://github.com/marcuswestin/store.js - v1.3.4+ * * Commented and console logged for debugging with Firefox & Firebug or similar - * version 1.0.11 + * version 1.0.10 **/ /*global jQuery: false, document: false, store: false, clearInterval: false, setInterval: false, setTimeout: false, clearTimeout: false, window: false, alert: false, console: false*/ diff --git a/jquery-idleTimeout-iframes.js b/jquery-idleTimeout-iframes.js index 1e087c5..c4e8fa2 100644 --- a/jquery-idleTimeout-iframes.js +++ b/jquery-idleTimeout-iframes.js @@ -12,7 +12,7 @@ * * Dependencies: JQuery v1.7+, JQuery UI, store.js from https://github.com/marcuswestin/store.js - v1.3.4+ * - * version 1.0.11 + * version 1.0.10 **/ /*global jQuery: false, document: false, store: false, clearInterval: false, setInterval: false, setTimeout: false, clearTimeout: false, window: false, alert: false*/ diff --git a/jquery-idleTimeout.js b/jquery-idleTimeout.js index 440ffa2..6b725ed 100644 --- a/jquery-idleTimeout.js +++ b/jquery-idleTimeout.js @@ -12,7 +12,7 @@ * * Dependencies: JQuery v1.7+, JQuery UI, store.js from https://github.com/marcuswestin/store.js - v1.3.4+ * - * version 1.0.11 + * version 1.0.10 **/ /*global jQuery: false, document: false, store: false, clearInterval: false, setInterval: false, setTimeout: false, clearTimeout: false, window: false, alert: false*/