diff --git a/app/controllers/devise/two_factor_authentication_controller.rb b/app/controllers/devise/two_factor_authentication_controller.rb index eb3f50f..681825e 100644 --- a/app/controllers/devise/two_factor_authentication_controller.rb +++ b/app/controllers/devise/two_factor_authentication_controller.rb @@ -1,6 +1,11 @@ class Devise::TwoFactorAuthenticationController < DeviseController - prepend_before_filter :authenticate_scope! - before_filter :prepare_and_validate, :handle_two_factor_authentication + if Rails::VERSION::MAJOR >= 4 + prepend_before_action :authenticate_scope! + before_action :prepare_and_validate, :handle_two_factor_authentication + else + prepend_before_filter :authenticate_scope! + before_filter :prepare_and_validate, :handle_two_factor_authentication + end def show end diff --git a/lib/two_factor_authentication/controllers/helpers.rb b/lib/two_factor_authentication/controllers/helpers.rb index 505ca01..74c03ad 100644 --- a/lib/two_factor_authentication/controllers/helpers.rb +++ b/lib/two_factor_authentication/controllers/helpers.rb @@ -4,7 +4,11 @@ module TwoFactorAuthentication extend ActiveSupport::Concern included do - before_filter :handle_two_factor_authentication + if Rails::VERSION::MAJOR >= 4 + before_action :handle_two_factor_authentication + else + before_filter :handle_two_factor_authentication + end end private diff --git a/spec/rails_app/app/controllers/home_controller.rb b/spec/rails_app/app/controllers/home_controller.rb index d970a3a..6d31586 100644 --- a/spec/rails_app/app/controllers/home_controller.rb +++ b/spec/rails_app/app/controllers/home_controller.rb @@ -1,5 +1,9 @@ class HomeController < ApplicationController - before_filter :authenticate_user!, only: :dashboard + if Rails::VERSION::MAJOR >= 4 + before_action :authenticate_user!, only: :dashboard + else + before_filter :authenticate_user!, only: :dashboard + end def index end