mirror of
https://github.com/Bubka/2FAuth.git
synced 2024-11-23 16:53:26 +01:00
a2c4348364
(completes #73 fix)
58 lines
1.2 KiB
Vue
58 lines
1.2 KiB
Vue
<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)
|
|
|
|
this.$router.push({ name: 'autolock' })
|
|
},
|
|
|
|
resetTimer: function() {
|
|
|
|
clearTimeout(this.logoutTimer)
|
|
|
|
this.setTimer()
|
|
}
|
|
}
|
|
}
|
|
|
|
</script> |