Fix IP Bans

This commit is contained in:
calzoneman 2014-03-02 22:00:24 -06:00
parent f75b6b754d
commit db5b407635
3 changed files with 9 additions and 5 deletions

View file

@ -430,12 +430,12 @@ Channel.prototype.getIPRank = function (ip, callback) {
return; return;
} }
var rank = res.reduce(function (a, b) { var globalRank = res.reduce(function (a, b) {
return Math.max(a, b); return Math.max(a, b);
}, 0); }, 0);
if (!self.registered) { if (!self.registered) {
callback(null, rank); callback(null, globalRank);
return; return;
} }
@ -452,7 +452,7 @@ Channel.prototype.getIPRank = function (ip, callback) {
var rank = res.reduce(function (a, b) { var rank = res.reduce(function (a, b) {
return Math.max(a, b); return Math.max(a, b);
}, rank); }, globalRank);
callback(null, rank); callback(null, rank);
}); });

View file

@ -350,7 +350,7 @@ module.exports = {
return; return;
} }
callback(null, rows); callback(null, rows.map(function (r) { return r.rank; }));
}); });
}, },

View file

@ -42,7 +42,11 @@ function handleLogin(req, res) {
}); });
} else { } else {
var auth = user.name + ":" + user.hash; var auth = user.name + ":" + user.hash;
console.log(Config.get("http.root-domain-dotted")); res.cookie("auth", auth, {
expires: new Date(Date.now() + 7*24*60*60*1000),
httpOnly: true
});
res.cookie("auth", auth, { res.cookie("auth", auth, {
domain: Config.get("http.root-domain-dotted"), domain: Config.get("http.root-domain-dotted"),
expires: new Date(Date.now() + 7*24*60*60*1000), expires: new Date(Date.now() + 7*24*60*60*1000),