mirror of https://github.com/mastodon/mastodon
Add ability to require 2FA for specific roles (including Everybody) (#37701)
parent
3e1127d27b
commit
dfe44bcaef
@ -0,0 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Settings
|
||||
module TwoFactorAuthentication
|
||||
class BaseController < ::Settings::BaseController
|
||||
layout -> { truthy_param?(:oauth) ? 'modal' : 'admin' }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -1,9 +1,12 @@
|
||||
- content_for :page_title do
|
||||
= t('settings.two_factor_authentication')
|
||||
|
||||
- if current_user.role.require_2fa?
|
||||
.flash-message= t('two_factor_authentication.role_requirement', domain: site_hostname)
|
||||
|
||||
.simple_form
|
||||
%p.hint= t('otp_authentication.description_html')
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
= link_to t('otp_authentication.setup'), settings_otp_authentication_path, data: { method: :post }, class: 'button button--block'
|
||||
= link_to t('otp_authentication.setup'), settings_otp_authentication_path(params.permit(:oauth)), data: { method: :post }, class: 'button button--block'
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class AddRequire2FaToUserRoles < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :user_roles, :require_2fa, :boolean, null: false, default: false
|
||||
end
|
||||
end
|
||||
Loading…
Reference in New Issue