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

Also make webauthn the default in the self-registration

Klaus Zanders366186562e93
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb
index f5506c3ab0d..7ffaccafaaf 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb
@@ -34,12 +34,12 @@ module ::TwoFactorAuthentication
@device_type = params[:key].to_sym
@device = new_device_type! @device_type
- success_target_action = :confirm
+ needs_confirmation = true
if @device_type == :webauthn
if verify_webauthn_credential
@device.attributes = new_webauthn_device_params
- success_target_action = :index
+ needs_confirmation = false
end
else
@device.attributes = new_device_params
@@ -47,7 +47,14 @@ module ::TwoFactorAuthentication
if @device.save
Rails.logger.info "User ##{current_user.id} registered a new (unconfirmed) device #{@device_type}."
- redirect_to action: success_target_action, device_id: @device.id
+
+ if needs_confirmation
+ redirect_to action: :confirm, device_id: @device.id
+ else
+ flash[:notice] = t('two_factor_authentication.devices.registration_complete')
+ @device.confirm_registration_and_save
+ redirect_to registration_success_path
+ end
else
Rails.logger.warn { "User ##{current_user.id} failed to register a device #{@device_type}." }
render 'two_factor_authentication/two_factor_devices/new'