aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-03-31 12:59:10 +0200
committerJosé Valim <jose.valim@gmail.com>2010-03-31 12:59:41 +0200
commit62151dd272fa59f19d8e0df7e21600b06d865539 (patch)
tree9ac3d4fa4e57ba4b96094f8a117627f582a4f31f
parentc10958fbddb22052e7cbe5fe6b825cda3cb26e48 (diff)
downloadrails-62151dd272fa59f19d8e0df7e21600b06d865539.tar.gz
rails-62151dd272fa59f19d8e0df7e21600b06d865539.tar.bz2
rails-62151dd272fa59f19d8e0df7e21600b06d865539.zip
Deprecate cookie_verifier_secret in favor of config.cookie_secret allowing signed cookies to work again.
-rw-r--r--actionpack/lib/action_controller/deprecated/base.rb12
-rw-r--r--actionpack/lib/action_controller/metal/cookies.rb1
-rw-r--r--actionpack/lib/action_dispatch/middleware/cookies.rb6
-rw-r--r--actionpack/test/controller/cookie_test.rb2
4 files changed, 16 insertions, 5 deletions
diff --git a/actionpack/lib/action_controller/deprecated/base.rb b/actionpack/lib/action_controller/deprecated/base.rb
index bbde570ca9..2fd60aacc7 100644
--- a/actionpack/lib/action_controller/deprecated/base.rb
+++ b/actionpack/lib/action_controller/deprecated/base.rb
@@ -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
diff --git a/actionpack/lib/action_controller/metal/cookies.rb b/actionpack/lib/action_controller/metal/cookies.rb
index 7aa687b52c..75e5d40a63 100644
--- a/actionpack/lib/action_controller/metal/cookies.rb
+++ b/actionpack/lib/action_controller/metal/cookies.rb
@@ -6,7 +6,6 @@ module ActionController #:nodoc:
included do
helper_method :cookies
- cattr_accessor :cookie_verifier_secret
end
private
diff --git a/actionpack/lib/action_dispatch/middleware/cookies.rb b/actionpack/lib/action_dispatch/middleware/cookies.rb
index ab7130ab08..cb0d12cab1 100644
--- a/actionpack/lib/action_dispatch/middleware/cookies.rb
+++ b/actionpack/lib/action_dispatch/middleware/cookies.rb
@@ -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)
diff --git a/actionpack/test/controller/cookie_test.rb b/actionpack/test/controller/cookie_test.rb
index 36498d13a9..278cae1415 100644
--- a/actionpack/test/controller/cookie_test.rb
+++ b/actionpack/test/controller/cookie_test.rb
@@ -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