I have problem with auto logout when the user is inactive. I have a logout button and a redirect homepage "/"
app.js
app.get('/logout',userContro.user_logout);
userController.js
user_logout = function(req,res){
res.clearCookie("userId"); //clear cookie
res.redirect('/');
};
What I need is to redirect to the homepage when the user is inactive for 5 minutes.
I can try using setInterval
when the user logIn
and counter and then return true
if timeout, but I don't know how to add the function to redirect to the homepage.
I found Session auto logout after inactivity but it is still not working for me.
Thanks, everyone so much!