{"action":"created","issue":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/352","repository_url":"https://api.github.com/repos/feathersjs/feathers","labels_url":"https://api.github.com/repos/feathersjs/feathers/issues/352/labels{/name}","comments_url":"https://api.github.com/repos/feathersjs/feathers/issues/352/comments","events_url":"https://api.github.com/repos/feathersjs/feathers/issues/352/events","html_url":"https://github.com/feathersjs/feathers/issues/352","id":159462365,"number":352,"title":"How to change a user's password?","user":{"login":"UlyssesAlves","id":2872102,"avatar_url":"https://avatars.githubusercontent.com/u/2872102?v=3","gravatar_id":"","url":"https://api.github.com/users/UlyssesAlves","html_url":"https://github.com/UlyssesAlves","followers_url":"https://api.github.com/users/UlyssesAlves/followers","following_url":"https://api.github.com/users/UlyssesAlves/following{/other_user}","gists_url":"https://api.github.com/users/UlyssesAlves/gists{/gist_id}","starred_url":"https://api.github.com/users/UlyssesAlves/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UlyssesAlves/subscriptions","organizations_url":"https://api.github.com/users/UlyssesAlves/orgs","repos_url":"https://api.github.com/users/UlyssesAlves/repos","events_url":"https://api.github.com/users/UlyssesAlves/events{/privacy}","received_events_url":"https://api.github.com/users/UlyssesAlves/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-09T17:19:07Z","updated_at":"2016-06-09T17:28:07Z","closed_at":null,"body":"I changed a user's password with the update method of the \"users\" service, but I think this is not the right way to change passwords, because the password was not automatically encrypted the same way as it is when the user are first created.\r\n\r\n```\r\nvar userService = app.service(\"users\");\r\n\r\nuserService.update(userId, \r\n\t        \t\t\t{ \r\n\t        \t\t\t\t$set: {\r\n\t        \t\t\t\t\tpassword: \"newpassword\"\r\n\t        \t\t\t\t} \r\n\t        \t\t\t}\r\n\t        \t\t)\r\n\t        \t\t.then(updatedUser => {\r\n                                        // this will print \"newpassword\", instead of something like this: $2a$10$VAu.u509vo7YAffGeyLrUu0zqi.COdGHSKOqo/V9aHBYWsMekiAUS\r\n\t        \t\t\tconsole.log(updatedUser.password);\r\n\t        \t\t})\r\n```\r\n\r\nI searched the source code but I didn't find where is the password being encrypted when the user is created. How can I update the password field and keep it in the same pattern as the passwords are stored when the user is created?"},"comment":{"url":"https://api.github.com/repos/feathersjs/feathers/issues/comments/224967303","html_url":"https://github.com/feathersjs/feathers/issues/352#issuecomment-224967303","issue_url":"https://api.github.com/repos/feathersjs/feathers/issues/352","id":224967303,"user":{"login":"daffl","id":338316,"avatar_url":"https://avatars.githubusercontent.com/u/338316?v=3","gravatar_id":"","url":"https://api.github.com/users/daffl","html_url":"https://github.com/daffl","followers_url":"https://api.github.com/users/daffl/followers","following_url":"https://api.github.com/users/daffl/following{/other_user}","gists_url":"https://api.github.com/users/daffl/gists{/gist_id}","starred_url":"https://api.github.com/users/daffl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/daffl/subscriptions","organizations_url":"https://api.github.com/users/daffl/orgs","repos_url":"https://api.github.com/users/daffl/repos","events_url":"https://api.github.com/users/daffl/events{/privacy}","received_events_url":"https://api.github.com/users/daffl/received_events","type":"User","site_admin":false},"created_at":"2016-06-09T17:28:07Z","updated_at":"2016-06-09T17:28:07Z","body":"Add the [auth.hashPassword](http://docs.feathersjs.com/authorization/bundled-hooks.html#hashpassword) hook and use `patch` instead of `update` with `$set`:\r\n\r\n```js\r\napp.service('users').before({\r\n  patch: auth.hasPassword()\r\n});\r\n```\r\n"}}
{"actor":{"display_login":"daffl"}}