vue-session icon indicating copy to clipboard operation
vue-session copied to clipboard

Session Timeout

Open sidnaik03 opened this issue 8 years ago • 6 comments

How to set session timeout parameter?

sidnaik03 avatar Oct 11 '17 05:10 sidnaik03

there is no builtin timeout option. we can work on it for future releases

victorsferreira avatar Oct 12 '17 03:10 victorsferreira

help me to know if this feature is available?

dniwemugisha avatar Oct 14 '18 19:10 dniwemugisha

No yet. I guess.

sidnaik03 avatar Oct 16 '18 05:10 sidnaik03

looks like still not available

kevin-netsrik avatar May 30 '19 07:05 kevin-netsrik

I ended up with alternate solution you guys might use this, this below code helped me lot.

Just place in main.js file where your router has began.

router.beforeEach((to, from, next) => {
	if (to.matched.some(record => record.meta.requiresAuth)) {
		const token = router.app.$session.exists('userProfile');
		let timeBefore = moment(router.app.$session.get('_timeout').date);
		let timeNow = moment(new Date());
		let timeDiff = moment.duration(timeNow.diff(timeBefore)).asMinutes();
		if (timeDiff > router.app.$session.get('_timeout').limit) {
			next({ path: '/login' });
		} else {
			next();
		}
	} else {
		next();
	}
});

piyushdolar avatar Jan 14 '20 03:01 piyushdolar

it was not fixed?

jae637 avatar May 18 '21 14:05 jae637