1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00
heartcombo--devise/lib/devise/omniauth.rb

28 lines
989 B
Ruby
Raw Normal View History

2010-10-14 14:04:02 -04:00
begin
require "omniauth/core"
rescue LoadError => e
warn "Could not load 'omniauth/core'. Please ensure you have the oa-core gem installed and listed in your Gemfile."
raise
end
unless OmniAuth.config.respond_to? :test_mode
2011-02-24 16:12:54 -05:00
raise "You are using an old OmniAuth version, please ensure you have 0.2.0.beta version or later installed."
2010-10-14 14:04:02 -04:00
end
2010-10-14 15:16:20 -04:00
# Clean up the default path_prefix. It will be automatically set by Devise.
OmniAuth.config.path_prefix = nil
OmniAuth.config.on_failure = Proc.new do |env|
env['devise.mapping'] = Devise::Mapping.find_by_path!(env['PATH_INFO'], :path)
2011-04-16 07:30:15 -04:00
controller_name = ActiveSupport::Inflector.camelize(env['devise.mapping'].controllers[:omniauth_callbacks])
controller_klass = ActiveSupport::Inflector.constantize("#{controller_name}Controller")
controller_klass.action(:failure).call(env)
2010-10-14 19:15:17 -04:00
end
2010-10-14 14:04:02 -04:00
module Devise
module OmniAuth
autoload :Config, "devise/omniauth/config"
autoload :UrlHelpers, "devise/omniauth/url_helpers"
end
2010-11-03 19:16:55 -04:00
end