Commit | Line | Data |
---|---|---|
9d58ef95 | 1 | export function checkNameEmail(o) |
8a477a7e | 2 | { |
c018b304 | 3 | if (typeof o.name === "string") |
8a477a7e BA |
4 | { |
5 | if (o.name.length == 0) | |
6 | return "Empty name"; | |
7 | if (!o.name.match(/^[\w]+$/)) | |
8 | return "Bad characters in name"; | |
9 | } | |
c018b304 | 10 | if (typeof o.email === "string") |
8a477a7e BA |
11 | { |
12 | if (o.email.length == 0) | |
13 | return "Empty email"; | |
14 | if (!o.email.match(/^[\w.+-]+@[\w.+-]+$/)) | |
15 | return "Bad characters in email"; | |
16 | } | |
17 | } |