Browse Source

fix: clean up user_id from session on logout

main
Inhji Y. 8 months ago
parent
commit
6b4a62a6a9
  1. 4
      lib/mirage_web/controllers/user_auth.ex

4
lib/mirage_web/controllers/user_auth.ex

@ -91,10 +91,10 @@ defmodule MirageWeb.UserAuth do
def fetch_current_user(conn, _opts) do
{user_token, conn} = ensure_user_token(conn)
user = user_token && Accounts.get_user_by_session_token(user_token)
conn
|> assign(:current_user, user)
|> put_session(:user_id, user.id)
|> put_session(:user_id, user && user.id)
end
defp ensure_user_token(conn) do

Loading…
Cancel
Save