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

[50019] Fix untranslated 2fa strategies

Christophe Bliardf48435bd0d94
diff --git a/app/views/oauth/applications/show.html.erb b/app/views/oauth/applications/show.html.erb
index bbe6cbc429d..6d073aa93ed 100644
--- a/app/views/oauth/applications/show.html.erb
+++ b/app/views/oauth/applications/show.html.erb
@@ -91,7 +91,7 @@ See COPYRIGHT and LICENSE files for more details.
<% component.with_attribute(
key: @application.class.human_attribute_name(:redirect_uri),
- value: safe_join(@application.redirect_uri.split("\n"), '<br/>'.html_safe)
+ value: safe_join(@application.redirect_uri.split("\n"), tag(:br))
) %>
<% if [email protected]_credentials_user_id %>
diff --git a/modules/two_factor_authentication/app/views/two_factor_authentication/settings.html.erb b/modules/two_factor_authentication/app/views/two_factor_authentication/settings.html.erb
index 5be3c921bfa..91e5de1eee6 100644
--- a/modules/two_factor_authentication/app/views/two_factor_authentication/settings.html.erb
+++ b/modules/two_factor_authentication/app/views/two_factor_authentication/settings.html.erb
@@ -20,11 +20,12 @@
value: if configuration['active_strategies'].empty?
t(:label_none)
else
- configuration['active_strategies'].join(content_tag(:br)) do |key|
+ strategies = configuration['active_strategies'].map do |key|
content_tag(:span) do
t("two_factor_authentication.strategies.#{key}")
end
end
+ safe_join(strategies, tag(:br))
end)
component.with_attribute(key: t('two_factor_authentication.settings.label_enforced'),
diff --git a/spec/components/attribute_groups/attribute_key_value_component_spec.rb b/spec/components/attribute_groups/attribute_key_value_component_spec.rb
index 239cfec1c62..f4e58442576 100644
--- a/spec/components/attribute_groups/attribute_key_value_component_spec.rb
+++ b/spec/components/attribute_groups/attribute_key_value_component_spec.rb
@@ -38,6 +38,13 @@ RSpec.describe AttributeGroups::AttributeKeyValueComponent, type: :component do
have_css('.attributes-key-value--value.-text', text: 'Attribute Value')
end
+ it "preserve html in the value if it's a safe string" do
+ render_inline(described_class.new(key: 'Attribute Key', value: '<div>Some value</div>'.html_safe))
+
+ expect(page).not_to have_css('.attributes-key-value--value.-text', text: "<div>Some value</div>")
+ expect(page).to have_css('.attributes-key-value--value.-text', text: "Some value")
+ end
+
context 'with value and content' do
it 'renders the content' do
render_inline(described_class.new(key: 'Attribute Key', value: 'Attribute Value')) do