Fix Omega promotions
[vchess.git] / client / src / data / userCheck.js
CommitLineData
6808d7a1
BA
1export function checkNameEmail(o) {
2 if (typeof o.name === "string") {
f0c68a04 3 if (o.name.length == 0) return "Missing name";
2c5d7b20
BA
4 if (!o.name.match(/^[\w-]+$/))
5 return "Name: alphanumerics, hyphen and underscore";
dac39588 6 }
910d631b 7
6808d7a1 8 if (typeof o.email === "string") {
f0c68a04 9 if (o.email.length == 0) return "Missing email";
866842c3 10 if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) return "Invalid email";
dac39588 11 }
910d631b 12
6808d7a1 13 return "";
8a477a7e 14}