2020-10-08 15:38:36 +02:00
|
|
|
<template>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
|
|
|
export default {
|
|
|
|
name: 'Kicker',
|
|
|
|
|
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
events: ['click', 'mousedown', 'scroll', 'keypress', 'load'],
|
|
|
|
logoutTimer: null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
mounted() {
|
|
|
|
|
|
|
|
this.events.forEach(function (event) {
|
|
|
|
window.addEventListener(event, this.resetTimer)
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
this.setTimer()
|
|
|
|
},
|
|
|
|
|
|
|
|
destroyed() {
|
|
|
|
|
|
|
|
this.events.forEach(function (event) {
|
|
|
|
window.removeEventListener(event, this.resetTimer)
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
clearTimeout(this.logoutTimer)
|
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
|
|
|
|
setTimer: function() {
|
|
|
|
|
|
|
|
this.logoutTimer = setTimeout(this.logoutUser, this.$root.appSettings.kickUserAfter * 60 * 1000)
|
|
|
|
},
|
|
|
|
|
|
|
|
logoutUser: function() {
|
|
|
|
|
|
|
|
clearTimeout(this.logoutTimer)
|
|
|
|
|
2022-07-13 14:56:25 +02:00
|
|
|
this.$router.push({ name: 'autolock' })
|
2020-10-08 15:38:36 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
resetTimer: function() {
|
|
|
|
|
|
|
|
clearTimeout(this.logoutTimer)
|
|
|
|
|
|
|
|
this.setTimer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|