You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docuseal/app/controllers/mfa_force_controller.rb

21 lines
559 B

# frozen_string_literal: true
class MfaForceController < ApplicationController
before_action :load_account_config
authorize_resource :account_config
def create
@account_config.update!(value: !@account_config.value)
redirect_back fallback_location: settings_users_path,
notice: "Force 2FA has been #{@account_config.value ? 'enabled' : 'disabled'}."
end
private
def load_account_config
@account_config =
AccountConfig.find_or_initialize_by(account: current_account, key: AccountConfig::FORCE_MFA)
end
end