X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=server%2Fmodels%2FGame.js;h=39459176acfbe534c002dbca46e69a1de184c262;hb=70690ae8d661c5e0aae8db98e6557a0e7eb8a6be;hp=d72f51a18dc2458ed30bd3eca04e8516012c0e4a;hpb=23ecf00824691b5622b468e0409fc543c87d75dc;p=vchess.git diff --git a/server/models/Game.js b/server/models/Game.js index d72f51a1..39459176 100644 --- a/server/models/Game.js +++ b/server/models/Game.js @@ -197,17 +197,17 @@ const GameModel = return ( ( !obj.move || ( - obj.move.played.toString().match(/^[0-9]+$/) && - obj.move.idx.toString().match(/^[0-9]+$/) + !!(obj.move.played.toString().match(/^[0-9]+$/)) && + !!(obj.move.idx.toString().match(/^[0-9]+$/)) ) ) && ( - !obj.drawOffer || obj.drawOffer.match(/^[wbtn]$/) + !obj.drawOffer || !!(obj.drawOffer.match(/^[wbtn]$/)) ) && ( - !obj.fen || obj.fen.match(/^[a-zA-Z0-9, /-]*$/) + !obj.fen || !!(obj.fen.match(/^[a-zA-Z0-9, /-]*$/)) ) && ( - !obj.score || obj.score.match(/^[012?*\/-]+$/) + !obj.score || !!(obj.score.match(/^[012?*\/-]+$/)) ) && ( - !obj.scoreMsg || obj.scoreMsg.match(/^[a-zA-Z ]+$/) + !obj.scoreMsg || !!(obj.scoreMsg.match(/^[a-zA-Z ]+$/)) ) && ( !obj.chat || UserModel.checkNameEmail({name: obj.chat.name}) ) @@ -243,7 +243,7 @@ const GameModel = db.run(query); } // NOTE: move, chat and delchat are mutually exclusive - if (obj.move) + if (!!obj.move) { // Security: only update moves if index is right query =