From c3aefec8a40443ecf014ed82bf52b2e1104d1656 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20G=C3=BCnther?= Date: Wed, 13 Aug 2025 10:04:43 +0200 Subject: [PATCH] Render direct login button only when not logged in --- lib/redmine/menu_manager/top_menu/user_menu.rb | 2 +- spec/features/auth/omniauth_spec.rb | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/redmine/menu_manager/top_menu/user_menu.rb b/lib/redmine/menu_manager/top_menu/user_menu.rb index bf2af167dc8..9f54edc189a 100644 --- a/lib/redmine/menu_manager/top_menu/user_menu.rb +++ b/lib/redmine/menu_manager/top_menu/user_menu.rb @@ -30,7 +30,7 @@ module Redmine::MenuManager::TopMenu::UserMenu def render_user_top_menu_node(items = first_level_menu_items_for(:account_menu)) - if omniauth_direct_login? + if omniauth_direct_login? && !User.current.logged? render_direct_login else render_user_drop_down items diff --git a/spec/features/auth/omniauth_spec.rb b/spec/features/auth/omniauth_spec.rb index 04305c91c61..80a3c2e2b75 100644 --- a/spec/features/auth/omniauth_spec.rb +++ b/spec/features/auth/omniauth_spec.rb @@ -108,6 +108,9 @@ RSpec.describe "Omniauth authentication" do click_link_or_button "Sign In" expect(current_path).to eql my_account_path + + # Expect the dropdown menu to be the logged in one + expect(page).to have_test_selector "op-app-header--user-menu-button" end end end