Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#258 Changed the AFK timer time #299

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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