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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Remove confirm method of admin users controller
Oliver Günthere3e559ce3c6b
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rbindex c9838af2664..6da675c35c1 100644--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb@@ -55,36 +55,6 @@ module ::TwoFactorAuthenticationredirect_to index_pathend- ##- # Send a confirmation and request a OTP entry from the user to activate the device- def confirm- if request.get?- request_device_confirmation_token- else- return unless ensure_token_parameter-- validate_device_token- end- end-- ##- # Validate the token input- def validate_device_token- service = token_service(@device)- result = service.verify(params[:otp])-- if result.success? && @device.confirm_registration_and_save- flash[:notice] = t('two_factor_authentication.devices.registration_complete')- return redirect_to action: :index- elsif !result.success?- flash[:error] = t('two_factor_authentication.devices.registration_failed_token_invalid')- else- flash[:error] = t('two_factor_authentication.devices.registration_failed_update')- end-- redirect_to confirm_two_factor_device_path(@device)- end-### Destroy the given device if its not the defaultdef destroy@@ -118,6 +88,10 @@ module ::TwoFactorAuthenticationedit_user_path(@user, tab: :two_factor_authentication)end+ def registration_success_path+ index_path+ end+def find_user@user = User.find(params[:id])rescue ActiveRecord::RecordNotFounddiff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rbindex 4956363ceaf..34a16090c7e 100644--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb@@ -122,6 +122,16 @@ describe TwoFactorAuthentication::Users::TwoFactorDevicesController doendend+ describe '#confirm' do+ it 'fails on GET' do+ expect { get :confirm }.to raise_error(ActionController::UrlGenerationError)+ end++ it 'fails on POST' do+ expect { post :confirm }.to raise_error(ActionController::UrlGenerationError)+ end+ end+describe '#destroy' doit 'croaks on missing id' dodelete :destroy, params: { id: user.id, device_id: '1234' }