Skip to content

Commit

Permalink
only extend 5mins if less than 5mins left
Browse files Browse the repository at this point in the history
  • Loading branch information
barisusakli committed Aug 5, 2016
1 parent a53f7f6 commit 2103880
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/middleware/middleware.js
Expand Up @@ -206,7 +206,11 @@ middleware.isAdmin = function(req, res, next) {

var loginTime = req.session.meta ? req.session.meta.datetime : 0;
if (loginTime && parseInt(loginTime, 10) > Date.now() - 3600000) {
req.session.meta.datetime += 300000;
var timeLeft = parseInt(loginTime, 10) - (Date.now() - 3600000);
if (timeLeft < 300000) {
req.session.meta.datetime += 300000;
}

return next();
}

Expand Down

0 comments on commit 2103880

Please sign in to comment.