{"action":"created","issue":{"url":"https://api.github.com/repos/meanjs/mean/issues/343","labels_url":"https://api.github.com/repos/meanjs/mean/issues/343/labels{/name}","comments_url":"https://api.github.com/repos/meanjs/mean/issues/343/comments","events_url":"https://api.github.com/repos/meanjs/mean/issues/343/events","html_url":"https://github.com/meanjs/mean/pull/343","id":53286866,"number":343,"title":"Refactor user","user":{"login":"sielay","id":133139,"avatar_url":"https://avatars.githubusercontent.com/u/133139?v=3","gravatar_id":"","url":"https://api.github.com/users/sielay","html_url":"https://github.com/sielay","followers_url":"https://api.github.com/users/sielay/followers","following_url":"https://api.github.com/users/sielay/following{/other_user}","gists_url":"https://api.github.com/users/sielay/gists{/gist_id}","starred_url":"https://api.github.com/users/sielay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sielay/subscriptions","organizations_url":"https://api.github.com/users/sielay/orgs","repos_url":"https://api.github.com/users/sielay/repos","events_url":"https://api.github.com/users/sielay/events{/privacy}","received_events_url":"https://api.github.com/users/sielay/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/meanjs/mean/labels/discuss","name":"discuss","color":"5319e7"},{"url":"https://api.github.com/repos/meanjs/mean/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-01-02T23:55:31Z","updated_at":"2015-01-30T23:23:46Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/meanjs/mean/pulls/343","html_url":"https://github.com/meanjs/mean/pull/343","diff_url":"https://github.com/meanjs/mean/pull/343.diff","patch_url":"https://github.com/meanjs/mean/pull/343.patch"},"body":"- This is proof of concept for #337.\r\n- It contain fix for #288\r\n- It partially address #288\r\n- It allows multiple emails and usernames\r\n- It keeps back compatibility\r\n\r\nIt moves all identities to collection in user object. It keeps password and salt shared.\r\n\r\nTested against Facebook and GitHub, unit tests added. Documentation required.\r\n\r\nCurrent user structure\r\n```\r\n{\r\n     _id : ObjectID\r\n     displayName : \"My name\",\r\n     salt: \"<SALT>\",\r\n     password: \"<HASHED_PASSWORD>\",\r\n     identities : [ {\r\n          provider : UserModel.EMAIL,\r\n          id: \"test@test.com\"\r\n     }, {\r\n          provider : UserModel.USERNAME,\r\n          id : \"Tony Stark\"\r\n     }, {\r\n          provider : \"github\",\r\n          id : \"<ID>\",\r\n          accessToken : \"<ACCESS_TOKEN>\",\r\n          refreshToken: \"<REFRESH_TOKEN>\",\r\n          providerData : Object\r\n     } ]\r\n}\r\n```\r\n\r\nUseful methods:\r\n```\r\nuser.getIdentity('slack');\r\nOR\r\nuser.getIdentity('facebook', '<SECOND_ID>');\r\n```\r\nPreviously you needed multiple lines to find if that was `user.providerData` or `user.additionalProviderData[provider]`.\r\n\r\nHope you like it."},"comment":{"url":"https://api.github.com/repos/meanjs/mean/issues/comments/72288376","html_url":"https://github.com/meanjs/mean/pull/343#issuecomment-72288376","issue_url":"https://api.github.com/repos/meanjs/mean/issues/343","id":72288376,"user":{"login":"sielay","id":133139,"avatar_url":"https://avatars.githubusercontent.com/u/133139?v=3","gravatar_id":"","url":"https://api.github.com/users/sielay","html_url":"https://github.com/sielay","followers_url":"https://api.github.com/users/sielay/followers","following_url":"https://api.github.com/users/sielay/following{/other_user}","gists_url":"https://api.github.com/users/sielay/gists{/gist_id}","starred_url":"https://api.github.com/users/sielay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sielay/subscriptions","organizations_url":"https://api.github.com/users/sielay/orgs","repos_url":"https://api.github.com/users/sielay/repos","events_url":"https://api.github.com/users/sielay/events{/privacy}","received_events_url":"https://api.github.com/users/sielay/received_events","type":"User","site_admin":false},"created_at":"2015-01-30T23:23:46Z","updated_at":"2015-01-30T23:23:46Z","body":"Anyhow I added support for multiple emails to settings page. I leave it at the moment to review, need to go to project which I base on this PR (second, first http://pulzair.com is kind of live ;)). Feel free to discuss."}}