Search now always returns 6 answers hopefully

This commit is contained in:
Kasper Rynning-Tønnesen
2015-04-15 20:52:16 +02:00
parent e60c1e2795
commit eaaec7e93c
4 changed files with 37 additions and 7 deletions

View File

@@ -163,6 +163,20 @@ io.on('connection', function(socket){
}
});
socket.on('password', function(pw)
{
db.collection(coll).find({views:{$exists:true}}, function(err, docs){
if(docs[0]["adminpass"] == "" || docs[0]["adminpass"] == hash_pass(pw))
{
db.collection(coll).update({views:{$exists:true}}, {$set:{adminpass:hash_pass(pw)}}, function(err, docs)
{
socket.emit("pw", pw);
})
}
});
});
socket.on('skip', function(list)
{
db.collection(coll).find({skip: false}, function(err, docs){