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

[41719] Fix 2FA using form_authenticity_token without ruby 3 kwargs

Oliver Günthere116c5f3eb1f
diff --git a/app/cells/rails_cell.rb b/app/cells/rails_cell.rb
index ff5843a617a..7f9509218ca 100644
--- a/app/cells/rails_cell.rb
+++ b/app/cells/rails_cell.rb
@@ -65,8 +65,8 @@ class RailsCell < Cell::ViewModel
context[:action_view] || controller.view_context
end
- def form_authenticity_token(*args)
- controller.send(:form_authenticity_token, *args)
+ def form_authenticity_token(**args)
+ controller.send(:form_authenticity_token, **args)
end
def protect_against_forgery?
diff --git a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
index 7d5fcfb9b3d..3eb0f28ab04 100644
--- a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
@@ -135,4 +135,14 @@ describe 'My Account 2FA configuration', with_2fa_ee: true,
expect(page).to have_selector('.on-off-status.-disabled')
expect(user.otp_devices.count).to eq 0
end
+
+ context 'when a device has been registered already' do
+ let!(:device) { create :two_factor_authentication_device_totp, user: user }
+
+ it 'loads the page correctly (Regression #41719)' do
+ visit my_2fa_devices_path
+
+ expect(page).to have_content device.identifier
+ end
+ end
end