Create Settings::BaseController (#9507)
Define `Settings::BaseController#set_body_classes` so that sub classes inherit `Settings::BaseController` don't need to define `#set_body_classes` agein.
This commit is contained in:
parent
9983d21d35
commit
b048926e67
14 changed files with 24 additions and 82 deletions
|
@ -2,12 +2,11 @@
|
|||
|
||||
module Settings
|
||||
module TwoFactorAuthentication
|
||||
class ConfirmationsController < ApplicationController
|
||||
class ConfirmationsController < BaseController
|
||||
layout 'admin'
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :ensure_otp_secret
|
||||
before_action :set_body_classes
|
||||
|
||||
def new
|
||||
prepare_two_factor_form
|
||||
|
@ -44,10 +43,6 @@ module Settings
|
|||
def ensure_otp_secret
|
||||
redirect_to settings_two_factor_authentication_path unless current_user.otp_secret
|
||||
end
|
||||
|
||||
def set_body_classes
|
||||
@body_classes = 'admin'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
|
||||
module Settings
|
||||
module TwoFactorAuthentication
|
||||
class RecoveryCodesController < ApplicationController
|
||||
class RecoveryCodesController < BaseController
|
||||
layout 'admin'
|
||||
|
||||
before_action :authenticate_user!
|
||||
before_action :set_body_classes
|
||||
|
||||
def create
|
||||
@recovery_codes = current_user.generate_otp_backup_codes!
|
||||
|
@ -14,12 +13,6 @@ module Settings
|
|||
flash[:notice] = I18n.t('two_factor_authentication.recovery_codes_regenerated')
|
||||
render :index
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_body_classes
|
||||
@body_classes = 'admin'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue