{"action":"created","issue":{"url":"https://api.github.com/repos/ga-wdi-boston/portfolio-capstone-project/issues/18","labels_url":"https://api.github.com/repos/ga-wdi-boston/portfolio-capstone-project/issues/18/labels{/name}","comments_url":"https://api.github.com/repos/ga-wdi-boston/portfolio-capstone-project/issues/18/comments","events_url":"https://api.github.com/repos/ga-wdi-boston/portfolio-capstone-project/issues/18/events","html_url":"https://github.com/ga-wdi-boston/portfolio-capstone-project/issues/18","id":122279877,"number":18,"title":"Register, Login, and create profile, all in one go.","user":{"login":"TeoPaolucci","id":14809450,"avatar_url":"https://avatars.githubusercontent.com/u/14809450?v=3","gravatar_id":"","url":"https://api.github.com/users/TeoPaolucci","html_url":"https://github.com/TeoPaolucci","followers_url":"https://api.github.com/users/TeoPaolucci/followers","following_url":"https://api.github.com/users/TeoPaolucci/following{/other_user}","gists_url":"https://api.github.com/users/TeoPaolucci/gists{/gist_id}","starred_url":"https://api.github.com/users/TeoPaolucci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TeoPaolucci/subscriptions","organizations_url":"https://api.github.com/users/TeoPaolucci/orgs","repos_url":"https://api.github.com/users/TeoPaolucci/repos","events_url":"https://api.github.com/users/TeoPaolucci/events{/privacy}","received_events_url":"https://api.github.com/users/TeoPaolucci/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-15T14:06:45Z","updated_at":"2015-12-15T14:28:53Z","closed_at":"2015-12-15T14:28:53Z","body":"I plan on having profiles set up in my express application, and I would like it if I could add to my register/signup controller to also log the user in and/or create a blank profile associated with that user so that I can remove a lot of specific error handling elsewhere in my code regarding interacting with a nonexistent profile.\r\nI know _where_ the code needs to be added to the register function in the controller...\r\n```javascript\r\nsignup : {\r\n        post : function(req, res, next) {\r\n            /* SNIP */\r\n            pUser.then(function (user) {\r\n                return user.setPassword(req.body.password);\r\n            }).then(function() {\r\n                // CODE GOES HERE!\r\n                res.sendStatus(200);\r\n            }).catch(function(err) {\r\n                next(err);\r\n            });\r\n        }\r\n    }\r\n```\r\n...but I'm not sure what I need to add there. I know that I can't use req.user immediately to create a profile because the user isn't logged in after they register, so that would be a bonus. Is this something I would handle in the front end by just making multiple ajax requests after registering or is there something I can do in the back end?"},"comment":{"url":"https://api.github.com/repos/ga-wdi-boston/portfolio-capstone-project/issues/comments/164780459","html_url":"https://github.com/ga-wdi-boston/portfolio-capstone-project/issues/18#issuecomment-164780459","issue_url":"https://api.github.com/repos/ga-wdi-boston/portfolio-capstone-project/issues/18","id":164780459,"user":{"login":"TeoPaolucci","id":14809450,"avatar_url":"https://avatars.githubusercontent.com/u/14809450?v=3","gravatar_id":"","url":"https://api.github.com/users/TeoPaolucci","html_url":"https://github.com/TeoPaolucci","followers_url":"https://api.github.com/users/TeoPaolucci/followers","following_url":"https://api.github.com/users/TeoPaolucci/following{/other_user}","gists_url":"https://api.github.com/users/TeoPaolucci/gists{/gist_id}","starred_url":"https://api.github.com/users/TeoPaolucci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TeoPaolucci/subscriptions","organizations_url":"https://api.github.com/users/TeoPaolucci/orgs","repos_url":"https://api.github.com/users/TeoPaolucci/repos","events_url":"https://api.github.com/users/TeoPaolucci/events{/privacy}","received_events_url":"https://api.github.com/users/TeoPaolucci/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T14:28:53Z","updated_at":"2015-12-15T14:28:53Z","body":"Okay. So front-end ajax then. Makes sense. Thanks."}}