admin_two_factors_controller.rb 685 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2025 Zammad Foundation, https://zammad-foundation.org/
  2. class User::AdminTwoFactorsController < ApplicationController
  3. prepend_before_action :authenticate_and_authorize!
  4. def remove_authentication_method
  5. Service::User::TwoFactor::RemoveMethod
  6. .new(user: params_user, method_name: params[:method])
  7. .execute
  8. render json: {}
  9. end
  10. def remove_all_authentication_methods
  11. params_user.two_factor_destroy_all_authentication_methods
  12. render json: {}
  13. end
  14. def enabled_authentication_methods
  15. render json: params_user.two_factor_enabled_authentication_methods
  16. end
  17. private
  18. def params_user
  19. User.find(params[:id])
  20. end
  21. end