Enforce stricter validation on polls

This commit is contained in:
Calvin Montgomery 2017-03-20 21:37:32 -07:00
parent 41a538c655
commit 9dc82ad444
9 changed files with 231 additions and 11 deletions

View file

@ -133,14 +133,14 @@ function ipLimitReached(sock) {
function addTypecheckedFunctions(sock) {
sock.typecheckedOn = function (msg, template, cb) {
sock.on(msg, function (data) {
sock.on(msg, function (data, ack) {
typecheck(data, template, function (err, data) {
if (err) {
sock.emit("errorMsg", {
msg: "Unexpected error for message " + msg + ": " + err.message
});
} else {
cb(data);
cb(data, ack);
}
});
});