2009-11-03 06:35:11 -05:00
|
|
|
require 'devise/rails/routes'
|
2010-02-16 08:57:10 -05:00
|
|
|
require 'devise/rails/warden_compat'
|
|
|
|
|
2010-05-15 18:38:40 -04:00
|
|
|
# Include UrlHelpers in ActionController and ActionView as soon as they are loaded.
|
|
|
|
ActiveSupport.on_load(:action_controller) { include Devise::Controllers::UrlHelpers }
|
|
|
|
ActiveSupport.on_load(:action_view) { include Devise::Controllers::UrlHelpers }
|
|
|
|
|
2010-02-16 08:57:10 -05:00
|
|
|
module Devise
|
|
|
|
class Engine < ::Rails::Engine
|
2010-03-30 05:08:16 -04:00
|
|
|
config.devise = Devise
|
|
|
|
|
2010-05-15 18:38:40 -04:00
|
|
|
config.app_middleware.use Warden::Manager do |config|
|
|
|
|
Devise.warden_config = config
|
2010-04-22 13:59:52 -04:00
|
|
|
end
|
|
|
|
|
2010-05-15 18:38:40 -04:00
|
|
|
# Force routes to be loaded if we are doing any eager load.
|
|
|
|
config.before_eager_load { |app| app.reload_routes! }
|
2010-04-03 07:11:45 -04:00
|
|
|
|
|
|
|
config.after_initialize do
|
|
|
|
flash = [:unauthenticated, :unconfirmed, :invalid, :invalid_token, :timeout, :inactive, :locked]
|
|
|
|
|
2010-05-15 18:38:40 -04:00
|
|
|
translations = begin
|
|
|
|
I18n.available_locales
|
|
|
|
I18n.backend.send(:translations)
|
|
|
|
rescue Exception => e # Do not care if something fails
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
|
|
|
|
translations.each do |locale, translations|
|
2010-04-03 07:11:45 -04:00
|
|
|
keys = flash & (translations[:devise][:sessions].keys) rescue []
|
|
|
|
|
|
|
|
if keys.any?
|
|
|
|
ActiveSupport::Deprecation.warn "The following I18n messages in 'devise.sessions' " <<
|
|
|
|
"for locale '#{locale}' are deprecated: #{keys.to_sentence}. Please move them to " <<
|
|
|
|
"'devise.failure' instead."
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2010-02-16 08:57:10 -05:00
|
|
|
end
|
|
|
|
end
|