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

[#52287] Consent always shown in Browser language despite user's language being set differently

Pavel Balashou33652f5fb0a7
diff --git a/app/controllers/concerns/accounts/authentication_stages.rb b/app/controllers/concerns/accounts/authentication_stages.rb
index 1ddb7bf5fbd..c2524f58e16 100644
--- a/app/controllers/concerns/accounts/authentication_stages.rb
+++ b/app/controllers/concerns/accounts/authentication_stages.rb
@@ -1,3 +1,31 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
module Accounts::AuthenticationStages
def successful_authentication(user, reset_stages: true, just_registered: false)
stages = authentication_stages after_activation: just_registered, reset: reset_stages
diff --git a/app/helpers/user_consent_helper.rb b/app/helpers/user_consent_helper.rb
index dbf945c51c1..0b4bdbdfe89 100644
--- a/app/helpers/user_consent_helper.rb
+++ b/app/helpers/user_consent_helper.rb
@@ -37,16 +37,14 @@ module ::UserConsentHelper
end
##
- # Gets consent instructions for the given user.
+ # Gets consent instructions.
#
- # @param user [User] The user to get instructions for.
# @param locale [String] ISO-639-1 code for the desired locale (e.g. de, en, fr).
# `I18n.locale` is set for each request individually depending
# among other things on the user's Accept-Language headers.
# @return [String] Instructions in the respective language.
- def user_consent_instructions(_user, locale: I18n.locale)
+ def user_consent_instructions(locale)
all = Setting.consent_info
-
all.fetch(locale.to_s) { all.values.first }
end
diff --git a/app/services/set_localization_service.rb b/app/services/set_localization_service.rb
index 9249a534264..013aeab942b 100644
--- a/app/services/set_localization_service.rb
+++ b/app/services/set_localization_service.rb
@@ -1,3 +1,31 @@
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) 2012-2024 the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
class SetLocalizationService
attr_reader :user, :http_accept_header
diff --git a/app/views/account/_user_consent_check.html.erb b/app/views/account/_user_consent_check.html.erb
index c5997800782..62ec2b7cf44 100644
--- a/app/views/account/_user_consent_check.html.erb
+++ b/app/views/account/_user_consent_check.html.erb
@@ -1,6 +1,6 @@
<section class="form--section op-user-consent-form">
<p>
- <%= format_text user_consent_instructions(consenting_user), { target: '_blank' } %>
+ <%= format_text(user_consent_instructions(consenting_user.language || ::I18n.locale), { target: '_blank' }) %>
</p>
<label class="form--label-with-check-box -required -no-ellipsis op-user-consent-form--agreement">