{"action":"created","issue":{"url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset/issues/18","repository_url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset","labels_url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset/issues/18/comments","events_url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset/issues/18/events","html_url":"https://github.com/eddyystop/feathers-service-verify-reset/issues/18","id":188468721,"number":18,"title":"allow users to signup/login with cell number/social media acount, making email not so special.","user":{"login":"beeplin","id":13058150,"avatar_url":"https://avatars.githubusercontent.com/u/13058150?v=3","gravatar_id":"","url":"https://api.github.com/users/beeplin","html_url":"https://github.com/beeplin","followers_url":"https://api.github.com/users/beeplin/followers","following_url":"https://api.github.com/users/beeplin/following{/other_user}","gists_url":"https://api.github.com/users/beeplin/gists{/gist_id}","starred_url":"https://api.github.com/users/beeplin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeplin/subscriptions","organizations_url":"https://api.github.com/users/beeplin/orgs","repos_url":"https://api.github.com/users/beeplin/repos","events_url":"https://api.github.com/users/beeplin/events{/privacy}","received_events_url":"https://api.github.com/users/beeplin/received_events","type":"User","site_admin":false},"labels":[{"id":465492430,"url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset/labels/discuss","name":"discuss","color":"f9d0c4","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-11-10T10:14:51Z","updated_at":"2016-11-16T03:14:34Z","closed_at":null,"body":"Currently 1.0.0 supports short verification token for SMS/social media, but *email* is still the essential way to identify a user. For example, [code here](https://github.com/eddyystop/feathers-service-verify-reset/blob/master/src/client.js$L82)\r\n\r\n```js\r\n  this.authenticate = (email, password, cb) => {\r\n    let cbCalled = false;\r\n\r\n    app.authenticate({ type: 'local', email, password })\r\n      .then((result) => {\r\n         ...\r\n      });\r\n  };\r\n```\r\n\r\nHere we still suppose `email` and `password` is the only way to login. And [code here](https://github.com/eddyystop/feathers-service-verify-reset/blob/master/src/client.js#L72):\r\n\r\n```js\r\n  this.emailChange = (password, email, user, cb) => {\r\n    verifyReset.create({\r\n      action: 'emailChange',\r\n      value: { password, email },\r\n    }, { user }, cb);\r\n  };\r\n```\r\nThe API only supports changing `email` and then sending a notification message to the old email.\r\n\r\nBut consider a project in which most users don't even have emails ... like my on-going project for teenagers and elders in China. Our survey shows most of our potential teenage customers were born at the era of cellphone and QQ and wechat (just whatsapp and facebook and snapchat for teenagers in the US), and most of our elder customers just missed the email era -- they don't know how to register an email account and how to check email, but all of them have smart phones and wechat accounts.\r\n\r\nSo perhaps we could just *treat `email` as just one of the multiple possible communication channels to make contact with our users, just like others like cellphone, snapchat etc.* I noticed now there is no more `emailer` but a new `userNotifier`, so likewise, I think `email` should be no more treated as a specialty in our API, either.\r\n\r\nMy current way is to add a `primaryCommunication` field in the `users`  table in database. It determines which way is the primary communication way to contact with the user, like `email` or `sms` or other channels. It is chosen by users when they sign up. Of course we could make `email` the default, but people have other options. They could choose to sign up with their cellphone number instead of email, and then every communication with them (verify, reset, notification of cellphone number/pasword change) should be sent through sms.\r\n\r\nAnd for `login` or `authenticate`, **it is unnecessary to force uses to login with `email/password`**. Many apps let people log in with a unique `username`. Or, if a user's `primaryCommuniation` is not `email` but `cellphone` or `sms`, he/she could log in with his/her cellphone number. \r\n\r\nThat's to say, when the user is logging in,  instead of the two params named `email` and `password`, an options map should be passed to `app.authenticate`. The developer can decide whether a username is required, or an email, or a cellphone number, or any of them works. So the API at [here](https://github.com/eddyystop/feathers-service-verify-reset/blob/master/src/client.js$L79) can be changed into this:\r\n\r\n```js\r\n  this.authenticate = (options, cb) => {\r\n    let cbCalled = false;\r\n    options.type = 'local'; // add type field to options\r\n    app.authenticate(options) // pass options directly to app.authenticate()\r\n      .then((result) => {\r\n         ...\r\n      });\r\n``` \r\n\r\nAnd it's up to developer which fields should be included in `options`.\r\n\r\nSimilarly, `this.emailChange` might be rename to `this.PrimaryCommunicationChange` or something alike. If the user's `primaryCommunication` is not 'email' but 'snapchat', this method would patch the new value to the 'snapchat' field, not the 'email' field, and then notify the user via snapchat instead of email.\r\n\r\nSome other methods like `sendResetPwd` and `passwordChange` also need to be changed a bit. \r\n\r\nSo to wrap up, my whole idea is to treat `email` equally with other possible communiation channels. People who aren't familiar with emails would appreciate that. This is not only about the long/short token when verify/reset, but also about the way for users to sign up, log in, etc.\r\n\r\nSorry I didn't bring this up before 1.0.0 is published. This idea just came up later than that. :) "},"comment":{"url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset/issues/comments/260842065","html_url":"https://github.com/eddyystop/feathers-service-verify-reset/issues/18#issuecomment-260842065","issue_url":"https://api.github.com/repos/eddyystop/feathers-service-verify-reset/issues/18","id":260842065,"user":{"login":"beeplin","id":13058150,"avatar_url":"https://avatars.githubusercontent.com/u/13058150?v=3","gravatar_id":"","url":"https://api.github.com/users/beeplin","html_url":"https://github.com/beeplin","followers_url":"https://api.github.com/users/beeplin/followers","following_url":"https://api.github.com/users/beeplin/following{/other_user}","gists_url":"https://api.github.com/users/beeplin/gists{/gist_id}","starred_url":"https://api.github.com/users/beeplin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeplin/subscriptions","organizations_url":"https://api.github.com/users/beeplin/orgs","repos_url":"https://api.github.com/users/beeplin/repos","events_url":"https://api.github.com/users/beeplin/events{/privacy}","received_events_url":"https://api.github.com/users/beeplin/received_events","type":"User","site_admin":false},"created_at":"2016-11-16T03:14:34Z","updated_at":"2016-11-16T03:14:34Z","body":"the new populate hook seems amazing~ I will read the doc and comment in issues of that repo. "}}
{"actor":{"display_login":"beeplin"}}