From b035a37d1dd1431c15f0016c1675da31e3902494 Mon Sep 17 00:00:00 2001 From: unaibrrgn <75972112+unaibrrgn@users.noreply.github.com> Date: Fri, 23 Jun 2023 09:11:21 +0200 Subject: [PATCH] #258 Changed the AFK timer time --- .../src/main/webapp/jsp/dynamicJs/common.jsp | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/sources/Re3gistry2/src/main/webapp/jsp/dynamicJs/common.jsp b/sources/Re3gistry2/src/main/webapp/jsp/dynamicJs/common.jsp index 4b1c1243..8b5f85eb 100644 --- a/sources/Re3gistry2/src/main/webapp/jsp/dynamicJs/common.jsp +++ b/sources/Re3gistry2/src/main/webapp/jsp/dynamicJs/common.jsp @@ -39,7 +39,8 @@ var config={ baseurl:".", reloadDelay:5000, sessionCheckInterval:30000, - sessionCheckWarningTreshold:600000 + sessionCheckWarningTreshold:600000, + afkTimer:600000 }; // Variable to handle the unsaved data alert @@ -92,21 +93,21 @@ $(document).ready(function(){ }); //Session expiration message - setInterval(function(){ <% - HttpSession sessionCheck = request.getSession(); - Date expiry = new Date(session.getLastAccessedTime() + session.getMaxInactiveInterval()*1000); + Date expiry = new Date(session.getLastAccessedTime()); %> var sessionExpiration = <%= expiry.getTime() %> - var now = new Date(); - var nowTime = now.getTime() - - if((sessionExpiration - now) < config.sessionCheckWarningTreshold){ - $('#expirationWarning').modal('show'); - } - //console.log(sessionExpiration - now); + + // AFK timer function + setInterval(function(){ + var now = new Date(); + if((now - sessionExpiration) > config.afkTimer){ + $('#expirationWarning').modal('show'); + sessionExpiration = sessionExpiration + config.afkTimer; + } + //console.log(sessionExpiration - now); - }, config.sessionCheckInterval); + }, config.sessionCheckInterval, sessionExpiration); });