- // Basic alphanumeric check for players names
- let playerCount = 0;
- for (const pname of c.to)
- {
- if (pname.length > 0)
- {
- // TODO: slightly redundant (see data/userCheck.js)
- if (!pname.match(/^[\w]+$/))
- return "Wrong characters in players names";
- playerCount++;
- }
- }
-
- if (playerCount > 0 && playerCount != c.nbPlayers-1)
- return "None, or all of the opponent names must be filled"
+ // Basic alphanumeric check for opponent name
+ if (!!c.to)
+ {
+ // TODO: slightly redundant (see data/userCheck.js)
+ if (!c.to.match(/^[\w]+$/))
+ return "Wrong characters in opponent name";
+ }