{"action":"created","issue":{"url":"https://api.github.com/repos/danschultzer/pow/issues/32","repository_url":"https://api.github.com/repos/danschultzer/pow","labels_url":"https://api.github.com/repos/danschultzer/pow/issues/32/labels{/name}","comments_url":"https://api.github.com/repos/danschultzer/pow/issues/32/comments","events_url":"https://api.github.com/repos/danschultzer/pow/issues/32/events","html_url":"https://github.com/danschultzer/pow/issues/32","id":362044977,"node_id":"MDU6SXNzdWUzNjIwNDQ5Nzc=","number":32,"title":"A detail guide of Controller callbacks.","user":{"login":"jung-hunsoo","id":6870447,"node_id":"MDQ6VXNlcjY4NzA0NDc=","avatar_url":"https://avatars0.githubusercontent.com/u/6870447?v=4","gravatar_id":"","url":"https://api.github.com/users/jung-hunsoo","html_url":"https://github.com/jung-hunsoo","followers_url":"https://api.github.com/users/jung-hunsoo/followers","following_url":"https://api.github.com/users/jung-hunsoo/following{/other_user}","gists_url":"https://api.github.com/users/jung-hunsoo/gists{/gist_id}","starred_url":"https://api.github.com/users/jung-hunsoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jung-hunsoo/subscriptions","organizations_url":"https://api.github.com/users/jung-hunsoo/orgs","repos_url":"https://api.github.com/users/jung-hunsoo/repos","events_url":"https://api.github.com/users/jung-hunsoo/events{/privacy}","received_events_url":"https://api.github.com/users/jung-hunsoo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-09-20T07:02:42Z","updated_at":"2018-09-20T07:15:22Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"My user registration process is `register -> confirm email -> Create Userinfo record when confirmed`.\r\n\r\nTo implement `Creating Userinfo record when confirmed` three approaches were made.\r\n\r\nFirst I tried modifying `Ecto changeset`.  But it didn't work since `id` is available yet,  `prepare_changes` can't access User's id field.\r\n\r\nNext I tried using `Callback routes`.\r\n```elixir\r\ndef after_registration_path(conn) do\r\n  # This returns nil\r\n  current_user = Pow.Plug.current_user(conn)\r\n  # This didn't work.\r\n  Myapp.Generals.create_userinfo(%{user_id: current_user.id})\r\n  Routes.page_path(conn, :index)\r\nend\r\n```\r\nIt didn't work. Simply because `conn` doesn't have `:current_user` as it's not `email confirmed` yet.\r\n\r\nLast, I'm trying `ControllerCallbacks` now. Since I can access `user` there, it seems to be working there. But I can't figure out where and how to configure callbacks. So can you explain more in the readme?\r\n\r\nAt present `controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks` is set in config. But it won't touch my custom callbacks. I can't sure that it can be replaced with my custom callbacks."},"comment":{"url":"https://api.github.com/repos/danschultzer/pow/issues/comments/423067661","html_url":"https://github.com/danschultzer/pow/issues/32#issuecomment-423067661","issue_url":"https://api.github.com/repos/danschultzer/pow/issues/32","id":423067661,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMzA2NzY2MQ==","user":{"login":"danschultzer","id":1254724,"node_id":"MDQ6VXNlcjEyNTQ3MjQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1254724?v=4","gravatar_id":"","url":"https://api.github.com/users/danschultzer","html_url":"https://github.com/danschultzer","followers_url":"https://api.github.com/users/danschultzer/followers","following_url":"https://api.github.com/users/danschultzer/following{/other_user}","gists_url":"https://api.github.com/users/danschultzer/gists{/gist_id}","starred_url":"https://api.github.com/users/danschultzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danschultzer/subscriptions","organizations_url":"https://api.github.com/users/danschultzer/orgs","repos_url":"https://api.github.com/users/danschultzer/repos","events_url":"https://api.github.com/users/danschultzer/events{/privacy}","received_events_url":"https://api.github.com/users/danschultzer/received_events","type":"User","site_admin":false},"created_at":"2018-09-20T07:15:22Z","updated_at":"2018-09-20T07:15:22Z","author_association":"OWNER","body":"Oh, the hex docs on `cast_assoc/3`: https://hexdocs.pm/ecto/Ecto.Changeset.html#cast_assoc/3"}}
{"actor":{"display_login":"danschultzer"}}