Some more cleaning + fixes
[vchess.git] / client / src / data / userCheck.js
CommitLineData
6808d7a1
BA
1export function checkNameEmail(o) {
2 if (typeof o.name === "string") {
3 if (o.name.length == 0) return "Empty name";
4 if (!o.name.match(/^[\w]+$/)) return "Bad characters in name";
dac39588 5 }
910d631b 6
6808d7a1
BA
7 if (typeof o.email === "string") {
8 if (o.email.length == 0) return "Empty email";
9 if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) return "Bad characters in email";
dac39588 10 }
910d631b 11
6808d7a1 12 return "";
8a477a7e 13}