- <.link navigate={~p"/"}>
-

-
+ <.menu id="apps-menu" position="bottom-right" md_position="bottom-left">
+ <:toggle>
+
+
+ <.menu_item :if={Livebook.Config.logout_enabled?() and @current_user.email != nil}>
+
+
+
<.link navigate={~p"/apps-dashboard"} class="flex items-center text-blue-600">
diff --git a/lib/livebook_web/live/hooks/app_auth_hook.ex b/lib/livebook_web/live/hooks/app_auth_hook.ex
index 75fbce188..b825f17cd 100644
--- a/lib/livebook_web/live/hooks/app_auth_hook.ex
+++ b/lib/livebook_web/live/hooks/app_auth_hook.ex
@@ -78,7 +78,14 @@ defmodule LivebookWeb.AppAuthHook do
# Skip auth for non-app-specific routes
def on_mount(:default, %{}, _session, socket) do
- {:cont, socket}
+ if connected?(socket) do
+ LivebookWeb.SessionHelpers.subscribe_to_logout()
+ end
+
+ {:cont,
+ socket
+ |> attach_hook(:logout, :handle_info, &handle_info/2)
+ |> attach_hook(:logout, :handle_event, &handle_event/3)}
end
defp livebook_authorized?(session, socket) do