Browse Source

Merge pull request #86 from monfresh/fix-before-filter-logic

Drop support for Rails 3.2
master
Moncef Belyamani 9 years ago committed by GitHub
parent
commit
ba8cfdeffe
  1. 1
      .travis.yml
  2. 9
      app/controllers/devise/two_factor_authentication_controller.rb
  3. 6
      lib/two_factor_authentication/controllers/helpers.rb
  4. 6
      spec/rails_app/app/controllers/home_controller.rb

1
.travis.yml

@ -1,7 +1,6 @@
language: ruby language: ruby
env: env:
- "RAILS_VERSION=3.2"
- "RAILS_VERSION=4.0" - "RAILS_VERSION=4.0"
- "RAILS_VERSION=4.1" - "RAILS_VERSION=4.1"
- "RAILS_VERSION=4.2" - "RAILS_VERSION=4.2"

9
app/controllers/devise/two_factor_authentication_controller.rb

@ -1,11 +1,6 @@
class Devise::TwoFactorAuthenticationController < DeviseController class Devise::TwoFactorAuthenticationController < DeviseController
if Rails::VERSION::MAJOR >= 4 prepend_before_action :authenticate_scope!
prepend_before_action :authenticate_scope! before_action :prepare_and_validate, :handle_two_factor_authentication
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 def show
end end

6
lib/two_factor_authentication/controllers/helpers.rb

@ -4,11 +4,7 @@ module TwoFactorAuthentication
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
if Rails::VERSION::MAJOR >= 4 before_action :handle_two_factor_authentication
before_action :handle_two_factor_authentication
else
before_filter :handle_two_factor_authentication
end
end end
private private

6
spec/rails_app/app/controllers/home_controller.rb

@ -1,9 +1,5 @@
class HomeController < ApplicationController class HomeController < ApplicationController
if Rails::VERSION::MAJOR >= 4 before_action :authenticate_user!, only: :dashboard
before_action :authenticate_user!, only: :dashboard
else
before_filter :authenticate_user!, only: :dashboard
end
def index def index
end end

Loading…
Cancel
Save