Browse Source

fix "The InstanceMethods module inside ActiveSupport::Concern will be no longer included automatically."

for_activeadmin
Carlos Vilhena 13 years ago
parent
commit
2a0f37dc62
  1. 32
      lib/two_factor_authentication/controllers/helpers.rb

32
lib/two_factor_authentication/controllers/helpers.rb

@ -7,28 +7,26 @@ module TwoFactorAuthentication
before_filter :handle_two_factor_authentication before_filter :handle_two_factor_authentication
end end
module InstanceMethods private
private
def handle_two_factor_authentication def handle_two_factor_authentication
if not request.format.nil? and request.format.html? and not devise_controller? if not request.format.nil? and request.format.html? and not devise_controller?
Devise.mappings.keys.flatten.any? do |scope| Devise.mappings.keys.flatten.any? do |scope|
if signed_in?(scope) and warden.session(scope)[:need_two_factor_authentication] if signed_in?(scope) and warden.session(scope)[:need_two_factor_authentication]
session["#{scope}_return_tor"] = request.path if request.get? session["#{scope}_return_tor"] = request.path if request.get?
redirect_to two_factor_authentication_path_for(scope) redirect_to two_factor_authentication_path_for(scope)
return return
end
end
end end
end end
end
end
def two_factor_authentication_path_for(resource_or_scope = nil) def two_factor_authentication_path_for(resource_or_scope = nil)
scope = Devise::Mapping.find_scope!(resource_or_scope) scope = Devise::Mapping.find_scope!(resource_or_scope)
change_path = "#{scope}_two_factor_authentication_path" change_path = "#{scope}_two_factor_authentication_path"
send(change_path) send(change_path)
end
end end
end end
end end
end end

Loading…
Cancel
Save