Add ability to require 2FA for specific roles (including Everybody) (#37701)
This commit is contained in:
1 parent
3e1127d27b
commit
dfe44bcaef
23 files changed
+184
-15
No files matched your search
@@ -25,6 +25,11 @@
|
||||
= form.input :highlighted,
|
||||
wrapper: :with_label
|
||||
|
||||
- if current_user.role.administrator? || current_user.role != form.object
|
||||
.fields-group
|
||||
= form.input :require_2fa,
|
||||
wrapper: :with_label
|
||||
|
||||
%hr.spacer/
|
||||
|
||||
- unless current_user.role == form.object
|
||||
|
||||
@@ -21,9 +21,13 @@
|
||||
.announcements-list__item__meta
|
||||
- if role.everyone?
|
||||
= t('admin.roles.everyone_full_description_html')
|
||||
= t('admin.roles.requires_2fa') if role.require_2fa?
|
||||
- else
|
||||
= link_to t('admin.roles.assigned_users', count: role.users.count), admin_accounts_path(role_ids: role.id)
|
||||
·
|
||||
%abbr{ title: role.permissions_as_keys.map { |privilege| I18n.t("admin.roles.privileges.#{privilege}") }.join(', ') }= t('admin.roles.permissions_count', count: role.permissions_as_keys.size)
|
||||
- if role.require_2fa?
|
||||
·
|
||||
= t('admin.roles.requires_2fa')
|
||||
.announcements-list__item__actions
|
||||
= table_link_to 'edit', t('admin.accounts.edit'), edit_admin_role_path(role) if can?(:update, role)
|
||||
@@ -12,6 +12,8 @@
|
||||
%samp.qr-alternative__code= @new_otp_secret.scan(/.{4}/).join(' ')
|
||||
|
||||
.fields-group
|
||||
= hidden_field_tag :oauth, params[:oauth]
|
||||
|
||||
= f.input :otp_attempt,
|
||||
hint: t('otp_authentication.code_hint'),
|
||||
input_html: { autocomplete: 'off' },
|
||||
|
||||
@@ -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'
|
||||
@@ -7,3 +7,9 @@
|
||||
- @recovery_codes.each do |code|
|
||||
%li<
|
||||
%samp= code
|
||||
|
||||
- if params[:oauth]
|
||||
%hr.spacer/
|
||||
|
||||
.simple_form
|
||||
= link_to t('two_factor_authentication.resume_app_authorization'), return_to_app_url, class: 'button button--block'
|
||||
@@ -2,7 +2,10 @@
|
||||
= t('settings.two_factor_authentication')
|
||||
|
||||
- content_for :heading_actions do
|
||||
= link_to t('two_factor_authentication.disable'), disable_settings_two_factor_authentication_methods_path, class: 'button button--destructive', method: :post
|
||||
= link_to t('two_factor_authentication.disable'), disable_settings_two_factor_authentication_methods_path, class: 'button button--destructive', method: :post unless current_user.role.require_2fa?
|
||||
|
||||
- if current_user.role.require_2fa?
|
||||
.flash-message= t('two_factor_authentication.role_requirement', domain: site_hostname)
|
||||
|
||||
%p.hint
|
||||
%span.positive-hint
|
||||
|
||||
Reference in new issue
Block a user