Skip to content

Commit

Permalink
Merge pull request #299 from ec-jrc/258-session-expire-warning
Browse files Browse the repository at this point in the history
#258 Changed the AFK timer time
  • Loading branch information
arantzaetxebarria authored Jun 23, 2023
2 parents 50dd64f + b035a37 commit 2315ae6
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions sources/Re3gistry2/src/main/webapp/jsp/dynamicJs/common.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ var config={
baseurl:".",
reloadDelay:5000,
sessionCheckInterval:30000,
sessionCheckWarningTreshold:600000
sessionCheckWarningTreshold:600000,
afkTimer:600000
};

// Variable to handle the unsaved data alert
Expand Down Expand Up @@ -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);

});

Expand Down

0 comments on commit 2315ae6

Please sign in to comment.