Jump to content
  • 0

Timeout redirection to login page


SteveMott
 Share

Question

3 answers to this question

Recommended Posts

  • 0

Hi Steve,

You could add the next script in the header or footer of your DataPages:
 

<script>
const delayMinutes = 15;

const events = ['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart'];
const intervalHolder = {
interval: null
}
const reload = () => {
window.location.reload()
}
const setTimer = (time) => {
intervalHolder.interval = window.setTimeout(reload, time)
}
const resetTimer = () => {
window.clearInterval(intervalHolder.interval)
setTimer(delayMinutes*60000)
}
const addListeners = (eventsArray) => {
eventsArray.forEach(event => {document.addEventListener(event, resetTimer, true)})
}

const main = () => {
addListeners(events)
setTimer(delayMinutes*60000)
}

main()
</script>

You can customize the number of minutes of allowed inactivity in delayMinutes variables. It is set to 15 now.
So what this script does is next: it sets a timer every time any activity on the page stops.Timer resets each time when activity resumes. When timer runs out, it forces page refresh which In combination with aforementioned authentication settings ensures that one will be redirected to login page again

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...