Skip to content

Instantly share code, notes, and snippets.

Created August 14, 2011 15:29
Show Gist options
  • Save anonymous/1144983 to your computer and use it in GitHub Desktop.
Save anonymous/1144983 to your computer and use it in GitHub Desktop.
exports.auth = function(update){
return function(req, res, next) {
isLogged(req, function(logged, key){
if (!logged){
if (!update) return next(errors.fire(403));
next();
} else {
if (update) {
redis.setex(key, 1000, req.session.id, function(){
next();
});
} else next();
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment