- if (!c.vid.match(/^[0-9]+$/))
- return "Wrong variant ID";
-
- if (!c.timeControl.match(/^[0-9dhms +]+$/))
- return "Wrong characters in time control";
-
- if (!c.fen.match(/^[a-zA-Z0-9, /-]+$/))
- return "Bad FEN string";
+ return (
+ c.vid.toString().match(/^[0-9]+$/) &&
+ c.cadence.match(/^[0-9dhms +]+$/) &&
+ c.fen.match(/^[a-zA-Z0-9, /-]*$/) &&
+ (!c.to || UserModel.checkNameEmail({name: c.to}))
+ );