if user is banned log them out on header render
v1.18.x
barisusakli 10 years ago
parent b23373c265
commit b5fe2c7b91

@ -363,7 +363,7 @@ middleware.renderHeader = function(req, res, callback) {
},
user: function(next) {
if (uid) {
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status'], next);
user.getUserFields(uid, ['username', 'userslug', 'picture', 'status', 'banned'], next);
} else {
next();
}
@ -373,6 +373,12 @@ middleware.renderHeader = function(req, res, callback) {
return callback(err);
}
if (results.user && parseInt(results.user.banned, 10) === 1) {
req.logout();
res.redirect('/');
return;
}
templateValues.browserTitle = results.title;
templateValues.isAdmin = results.isAdmin || false;
templateValues.user = results.user;

Loading…
Cancel
Save