diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb index 97eeeee9f..f98808b6e 100644 --- a/app/controllers/concerns/authentication.rb +++ b/app/controllers/concerns/authentication.rb @@ -86,13 +86,12 @@ module Authentication def link_identity(user) token_value = cookies.signed[:identity_token] - token_identity = Identity.find_signed(token_value["id"]) if token_value.present? - identity = user.set_identity(token_identity) + identity = Identity.find_signed(token_value["id"]) if token_value.present? + identity = user.set_identity(identity) cookies.signed.permanent[:identity_token] = { value: { "id" => identity.signed_id, "updated_at" => identity.updated_at }, httponly: true, same_site: :lax } end def set_current_identity_token - link_identity(Current.user) if cookies.signed[:identity_token].nil? && Current.user.present? Current.identity_token = Identity::Mock.new(**cookies.signed[:identity_token]) end diff --git a/app/views/my/menus/_places.html.erb b/app/views/my/menus/_places.html.erb index 8b7be5b73..428504dba 100644 --- a/app/views/my/menus/_places.html.erb +++ b/app/views/my/menus/_places.html.erb @@ -5,6 +5,12 @@ <%= filter_place_menu_item notifications_path, "Notifications", "bell" %> <%= filter_place_menu_item notifications_settings_path, "Notification Settings", "settings" %> + <% cache [ Current.user, Current.identity_token ] do %> + <% Current.user.identity.memberships.where.not(user_tenant: Current.user.tenant).each do |membership| %> + <%= filter_place_menu_item root_url(script_name: "/#{membership.user_tenant}"), "#{membership.account_name}", "logo-color", new_window: true %> + <% end %> + <% end %> + <%= tag.li class: "popup__item", data: { filter_target: "item", navigable_list_target: "item" } do %> <%= icon_tag "logout", class: "popup__icon" %> <%= button_to session_path, method: :delete, class: "popup__btn btn", data: { turbo: false } do %> diff --git a/app/views/sessions/login_menu.html.erb b/app/views/sessions/login_menu.html.erb index 56f1e1373..88d6e0be6 100644 --- a/app/views/sessions/login_menu.html.erb +++ b/app/views/sessions/login_menu.html.erb @@ -3,6 +3,7 @@
You don't have any existing BOXCAR accounts.
<% end %> -