X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=client%2Fsrc%2Fdata%2FuserCheck.js;h=745d6d6ec788de4db1d2617de2b1958deaa0cf67;hb=910d631b73cad5ffef1b4461157b704e7e7057d8;hp=65ed1db8a12e848edb04b57dd62b562d3c4dcf93;hpb=8d61fc4ab7373b4a576f3f9108cdf7768ae27096;p=vchess.git diff --git a/client/src/data/userCheck.js b/client/src/data/userCheck.js index 65ed1db8..745d6d6e 100644 --- a/client/src/data/userCheck.js +++ b/client/src/data/userCheck.js @@ -1,19 +1,13 @@ -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 (typeof o.email === "string") - { - if (o.email.length == 0) - return "Empty email"; - if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) - return "Bad characters in email"; - } -} +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 (typeof o.email === "string") { + if (o.email.length == 0) return "Empty email"; + if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) return "Bad characters in email"; + } -try { module.exports = checkNameEmail; } catch(e) { } //for server + return ""; +}