X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fdata%2FuserCheck.js;h=d6fa7c134a9b44358753919d70bc1a0bd05f1f75;hb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;hp=dac8ef6f0c17c8596fdffda31381571b855ac24e;hpb=6808d7a16ec1e761c6a2dffec2281c96953e4d89;p=vchess.git diff --git a/client/src/data/userCheck.js b/client/src/data/userCheck.js index dac8ef6f..d6fa7c13 100644 --- a/client/src/data/userCheck.js +++ b/client/src/data/userCheck.js @@ -1,11 +1,14 @@ export function checkNameEmail(o) { if (typeof o.name === "string") { - if (o.name.length == 0) return "Empty name"; - if (!o.name.match(/^[\w]+$/)) return "Bad characters in name"; + if (o.name.length == 0) return "Missing name"; + if (!o.name.match(/^[\w-]+$/)) + return "Name: alphanumerics, hyphen and underscore"; } + if (typeof o.email === "string") { - if (o.email.length == 0) return "Empty email"; - if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) return "Bad characters in email"; + if (o.email.length == 0) return "Missing email"; + if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) return "Invalid email"; } + return ""; }