1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Deprecate cookie_verifier_secret in favor of config.cookie_secret allowing signed cookies to work again.

This commit is contained in:
José Valim 2010-03-31 12:59:10 +02:00
parent c10958fbdd
commit 62151dd272
4 changed files with 16 additions and 5 deletions

View file

@ -66,6 +66,18 @@ module ActionController
Rails.application.config.action_dispatch.ip_spoofing_check
end
def cookie_verifier_secret=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret= is deprecated. " <<
"Please configure it on your application with config.cookie_secret=", caller
ActionController::Base.config.secret = value
end
def cookie_verifier_secret
ActiveSupport::Deprecation.warn "ActionController::Base.cookie_verifier_secret is deprecated. " <<
"Please use ActionController::Base.config.secret instead.", caller
ActionController::Base.config.secret
end
def trusted_proxies=(value)
ActiveSupport::Deprecation.warn "ActionController::Base.trusted_proxies= is deprecated. " <<
"Please configure it on your application with config.action_dispatch.trusted_proxies=", caller

View file

@ -6,7 +6,6 @@ module ActionController #:nodoc:
included do
helper_method :cookies
cattr_accessor :cookie_verifier_secret
end
private

View file

@ -168,12 +168,12 @@ module ActionDispatch
class SignedCookieJar < CookieJar #:nodoc:
def initialize(parent_jar)
unless ActionController::Base.cookie_verifier_secret
raise "You must set ActionController::Base.cookie_verifier_secret to use signed cookies"
unless ActionController::Base.config.secret
raise "You must set ActionController::Base.config.secret"
end
@parent_jar = parent_jar
@verifier = ActiveSupport::MessageVerifier.new(ActionController::Base.cookie_verifier_secret)
@verifier = ActiveSupport::MessageVerifier.new(ActionController::Base.config.secret)
end
def [](name)

View file

@ -1,6 +1,6 @@
require 'abstract_unit'
ActionController::Base.cookie_verifier_secret = "thisISverySECRET123"
ActionController::Base.config.secret = "thisISverySECRET123"
class CookieTest < ActionController::TestCase
class TestController < ActionController::Base