diff --git a/app/assets/javascripts/timeoutPopup.js b/app/assets/javascripts/timeoutPopup.js index c331cb0f7..c52d4d462 100644 --- a/app/assets/javascripts/timeoutPopup.js +++ b/app/assets/javascripts/timeoutPopup.js @@ -1,6 +1,5 @@ (function(global) { "use strict"; - //hideTimerButtons(); const sessionTimer = document.getElementById("sessionTimer"); @@ -11,17 +10,19 @@ var difference = timeTillSessionEnd - now; var minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60)); var seconds = Math.floor((difference % (1000 * 60)) / 1000); - document.getElementById("timerWarning").innerHTML = "Your session will " + + document.getElementById("timerWarning").innerHTML = "You have been inactive " + + "for too long. Please choose to stay signed in or sign out. Your session will " + "expire in " + minutes + "m " + seconds + "s "; - showTimerButtons(); + showTimer(); document.getElementById("logOutTimer").addEventListener("click", logoutByUser); document.getElementById("extendSessionTimer").addEventListener("click", extendSession); - if (difference === 0) { + if (difference < 0) { clearInterval(x); + closeTimer(); redirectToSignin(); } }, 1000); - }, 1 * 60 * 1000); + }, 60 * 1000); function redirectToSignin() { window.location.href = '/sign-in'; @@ -35,14 +36,12 @@ window.location.reload(); } - function hideTimerButtons() { - document.getElementById("logOutTimer").style.display = 'none'; - document.getElementById("extendSessionTimer").style.display = 'none'; + function showTimer() { + sessionTimer.showModal(); } - function showTimerButtons() { - sessionTimer.showModal(); - document.getElementById("extendSessionTimer").style.display = 'block'; + function closeTimer() { + sessionTimer.close(); } })(window); diff --git a/app/templates/admin_template.html b/app/templates/admin_template.html index 483115985..b3c6eb36b 100644 --- a/app/templates/admin_template.html +++ b/app/templates/admin_template.html @@ -11,50 +11,47 @@ {% endblock %} {% block head %} - {% if current_user.is_authenticated %} - {% block sessionUserWarning %} -
- You’ve been inactive for too long. Please choose to stay signed in - or sign out. Otherwise, you’ll be signed out automatically in 5 - minutes. -
-