ueberauth / guardian

Elixir Authentication
MIT License
3.44k stars 381 forks source link

sign_out clears all messages added by put_flash #412

Closed vjorjo closed 7 years ago

vjorjo commented 7 years ago

I have this code:

@logout_msg "Signed out successfully!"

def delete(conn, _params) do
   conn
   |> Guardian.Plug.sign_out()
   |> put_flash(:info, @logout_msg)
   |> redirect(to: page_path(conn, :index))
end

the problem is that sign_out drops the entire session and consequently it deletes flash messages. However a previous version I had used in another project didn't have this side effect.

Is there any solution for this?

doomspork commented 7 years ago

Sounds like a bug in 1.0, thanks for the report! It looks like we drop the entire session here: https://github.com/ueberauth/guardian/blob/master/lib/guardian/plug.ex#L254