feature/require-mfa-by-admin - Change to config for

This commit is contained in:
Fredys Fonseca 2025-07-23 05:36:07 +00:00 committed by Fredys Fonseca Consuegra
parent 7a957b1f49
commit 673d875a95
2 changed files with 20 additions and 1 deletions

View File

@ -19,7 +19,7 @@ module MfaForceConcern
end end
def mfa_force_enabled? def mfa_force_enabled?
ENV['REQUIRE_MULTI_FACTOR_AUTH'] == 'true' mfa_config[:force_enabled]
end end
def mfa_setup_allowed_paths? def mfa_setup_allowed_paths?
@ -36,4 +36,8 @@ module MfaForceConcern
allowed_paths.any? { |path| request.path.start_with?(path) } allowed_paths.any? { |path| request.path.start_with?(path) }
end end
def mfa_config
@mfa_config ||= Rails.application.config_for(:mfa)
end
end end

15
config/mfa.yml Normal file
View File

@ -0,0 +1,15 @@
# Multi-Factor Authentication configuration
default: &default
force_enabled: false
development:
<<: *default
force_enabled: <%= ENV.fetch('REQUIRE_MULTI_FACTOR_AUTH', 'false') == 'true' %>
test:
<<: *default
force_enabled: false
production:
<<: *default
force_enabled: <%= ENV.fetch('REQUIRE_MULTI_FACTOR_AUTH', 'false') == 'true' %>