Enforce stricter validation on polls
This commit is contained in:
parent
41a538c655
commit
9dc82ad444
9 changed files with 231 additions and 11 deletions
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue