two_factor_required.rb 630 B

123456789101112
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class Auth::Error::TwoFactorRequired < Auth::Error::Base
  3. attr_reader :default_two_factor_authentication_method, :available_two_factor_authentication_methods, :recovery_codes_available
  4. def initialize(auth_user)
  5. @default_two_factor_authentication_method = auth_user.two_factor.user_default_authentication_method.method_name
  6. @available_two_factor_authentication_methods = auth_user.two_factor.user_authentication_methods.map(&:method_name)
  7. @recovery_codes_available = auth_user.two_factor.user_recovery_codes_exists?
  8. super()
  9. end
  10. end