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

fix behavior that raises a 500 error when the stored device cannot be found

Klaus Zandersc1ed4756621f
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
index a2cb5a50380..d224bbbde88 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
@@ -106,7 +106,7 @@ module ::TwoFactorAuthentication
def remembered_device(user)
if session[:two_factor_authentication_device_id]
- user.otp_devices.find(session[:two_factor_authentication_device_id])
+ user.otp_devices.find_by(id: session[:two_factor_authentication_device_id])
end
end