Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Render direct login button only when not logged in

Oliver Güntherc3aefec8a404
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