{"action":"created","issue":{"url":"https://api.github.com/repos/hoodiehq/hoodie-account-server/issues/5","labels_url":"https://api.github.com/repos/hoodiehq/hoodie-account-server/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/hoodiehq/hoodie-account-server/issues/5/comments","events_url":"https://api.github.com/repos/hoodiehq/hoodie-account-server/issues/5/events","html_url":"https://github.com/hoodiehq/hoodie-account-server/issues/5","id":93800793,"number":5,"title":"Provide isEmailValid function","user":{"login":"mikehedman","id":1550290,"avatar_url":"https://avatars.githubusercontent.com/u/1550290?v=3","gravatar_id":"","url":"https://api.github.com/users/mikehedman","html_url":"https://github.com/mikehedman","followers_url":"https://api.github.com/users/mikehedman/followers","following_url":"https://api.github.com/users/mikehedman/following{/other_user}","gists_url":"https://api.github.com/users/mikehedman/gists{/gist_id}","starred_url":"https://api.github.com/users/mikehedman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikehedman/subscriptions","organizations_url":"https://api.github.com/users/mikehedman/orgs","repos_url":"https://api.github.com/users/mikehedman/repos","events_url":"https://api.github.com/users/mikehedman/events{/privacy}","received_events_url":"https://api.github.com/users/mikehedman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-08T14:19:37Z","updated_at":"2015-07-08T17:02:19Z","closed_at":null,"body":"Since many of the new methods are dependent on email, it'll be important that we get a good email address from the user.  Since all apps will need to ask the user for an email address, I think it would be good to provide a default email input validation function.  \r\n\r\nHere's a function I use:\r\n\r\n```js\r\nfunction(email) {\r\n  //this regex pulled from http://www.regular-expressions.info/email.html\r\n  if (!/[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?/.test(email)) {\r\n    return 'Invalid email address.';\r\n  }\r\n}\r\n```\r\n\r\nOne could argue that this could/should be done \"isomorphically\", that is, available on the client side, but also enforced on the server side."},"comment":{"url":"https://api.github.com/repos/hoodiehq/hoodie-account-server/issues/comments/119663122","html_url":"https://github.com/hoodiehq/hoodie-account-server/issues/5#issuecomment-119663122","issue_url":"https://api.github.com/repos/hoodiehq/hoodie-account-server/issues/5","id":119663122,"user":{"login":"gr2m","id":39992,"avatar_url":"https://avatars.githubusercontent.com/u/39992?v=3","gravatar_id":"","url":"https://api.github.com/users/gr2m","html_url":"https://github.com/gr2m","followers_url":"https://api.github.com/users/gr2m/followers","following_url":"https://api.github.com/users/gr2m/following{/other_user}","gists_url":"https://api.github.com/users/gr2m/gists{/gist_id}","starred_url":"https://api.github.com/users/gr2m/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gr2m/subscriptions","organizations_url":"https://api.github.com/users/gr2m/orgs","repos_url":"https://api.github.com/users/gr2m/repos","events_url":"https://api.github.com/users/gr2m/events{/privacy}","received_events_url":"https://api.github.com/users/gr2m/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T17:02:19Z","updated_at":"2015-07-08T17:02:19Z","body":"What I'd suggest is to use the plugin (or here: hoodie-account-server) configuration for this: https://github.com/hoodiehq/hoodie-account-server/tree/api#configuring-the-server\r\n\r\nIn`options.schema`, you could set `\"format\":\"email\"` for username, or require a separate `\"email\"` property, that has `\"type\":\"string\", \"format\": \"email\"`.\r\n\r\nIdeally the schema configurations would be bundled into the front-end API, so when you try to sign up with an invalid email, but ``\"format\":\"email\"`` is set on username, it'd fail directly without even sending a request to the server.\r\n\r\nWould that work for this use case?"}}