I'm not sure if this is a bug, a feature request, or simply a bad idea but I've noticed that the user object is stored in the Phoenix session once on login and then never updated.
I solved it for my particular case by making a refresh_user helper and calling it in the appropriate controller functions:
defp refresh_user(conn) do
stale_user = Addict.Helper.current_user conn
{:ok, user} = Addict.Interactors.GetUserById.call stale_user.id
{:ok, conn} = Addict.Interactors.CreateSession.call conn, user
conn
end
I reused some nice helper functions from Addict, not sure the Interactors were supposed to be used this way. Is this an approach that you'd support? Would it be useful to add this to Addict.Helper maybe? If so, I'll happily make a PR.
Or did I totally not understand something and shouldn't I be wanting to refresh the user hash in the session?
Hey there!
I'm not sure if this is a bug, a feature request, or simply a bad idea but I've noticed that the user object is stored in the Phoenix session once on login and then never updated.
I solved it for my particular case by making a
refresh_user
helper and calling it in the appropriate controller functions:I reused some nice helper functions from Addict, not sure the Interactors were supposed to be used this way. Is this an approach that you'd support? Would it be useful to add this to Addict.Helper maybe? If so, I'll happily make a PR.
Or did I totally not understand something and shouldn't I be wanting to refresh the user hash in the session?