check_admin_password_auth.rb 634 B

12345678910111213141516
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module Service::Auth::Concerns::CheckAdminPasswordAuth
  3. extend ActiveSupport::Concern
  4. included do
  5. def admin_password_auth!
  6. password_login = Service::CheckFeatureEnabled.new(name: 'user_show_password_login', exception: false).execute
  7. thirdparty_auth = Setting.where('name LIKE ? AND frontend = true', "#{SqlHelper.quote_like('auth_')}%")
  8. .map { |provider| provider.state_current['value'] }
  9. .any?(true)
  10. raise Service::CheckFeatureEnabled::FeatureDisabledError if password_login || !thirdparty_auth
  11. end
  12. end
  13. end