diff options
author | Markus Koller <markus-koller@gmx.ch> | 2017-03-07 21:48:57 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-04-06 11:01:13 +0300 |
commit | 8e665140565a8c022bf1cad1589e244a543419fa (patch) | |
tree | d8bcdf4939b9fdcd1cc68ef98c1579575d0185a9 | |
parent | 7140e09e39895d747bca7238a5c9f5a4d4637a85 (diff) |
Rename check_2fa_requirement to check_two_factor_requirement
4 files changed, 8 insertions, 8 deletions
diff --git a/app/controllers/concerns/enforces_two_factor_authentication.rb b/app/controllers/concerns/enforces_two_factor_authentication.rb index b490f0058c7..05d427f83a0 100644 --- a/app/controllers/concerns/enforces_two_factor_authentication.rb +++ b/app/controllers/concerns/enforces_two_factor_authentication.rb @@ -2,18 +2,18 @@ # # Controller concern to enforce two-factor authentication requirements # -# Upon inclusion, adds `check_2fa_requirement` as a before_action, and -# makes `two_factor_grace_period_expired?` and `two_factor_skippable?` +# Upon inclusion, adds `check_two_factor_requirement` as a before_action, +# and makes `two_factor_grace_period_expired?` and `two_factor_skippable?` # available as view helpers. module EnforcesTwoFactorAuthentication extend ActiveSupport::Concern included do - before_action :check_2fa_requirement + before_action :check_two_factor_requirement helper_method :two_factor_grace_period_expired?, :two_factor_skippable? end - def check_2fa_requirement + def check_two_factor_requirement if two_factor_authentication_required? && current_user && !current_user.two_factor_enabled? && !skip_two_factor? redirect_to profile_two_factor_auth_path end diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb index 26e7e93533e..5e54fdfcf44 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/profiles/two_factor_auths_controller.rb @@ -1,5 +1,5 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController - skip_before_action :check_2fa_requirement + skip_before_action :check_two_factor_requirement def show unless current_user.otp_secret diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index d8561871098..d3091a4f8e9 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -3,7 +3,7 @@ class SessionsController < Devise::SessionsController include Devise::Controllers::Rememberable include Recaptcha::ClientHelper - skip_before_action :check_2fa_requirement, only: [:destroy] + skip_before_action :check_two_factor_requirement, only: [:destroy] prepend_before_action :check_initial_setup, only: [:new] prepend_before_action :authenticate_with_two_factor, diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 64cfb87da5d..004cbba3398 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -117,8 +117,8 @@ describe ApplicationController do context 'two-factor authentication' do let(:controller) { ApplicationController.new } - describe '#check_2fa_requirement' do - subject { controller.send :check_2fa_requirement } + describe '#check_two_factor_requirement' do + subject { controller.send :check_two_factor_requirement } it 'does not redirect if 2FA is not required' do allow(controller).to receive(:two_factor_authentication_required?).and_return(false) |