use encrypted cookies on new installations
This commit is contained in:
parent
7841245795
commit
ab514d7eb6
4 changed files with 8 additions and 4 deletions
|
|
@ -70,7 +70,7 @@ namespace :deploy do
|
|||
require 'securerandom'
|
||||
on roles(:app), in: :groups do
|
||||
secret = SecureRandom.hex(64)
|
||||
text = "Foodsoft::Application.config.secret_token = \"#{secret}\""
|
||||
text = "Foodsoft::Application.config.secret_key_base = \"#{secret}\""
|
||||
execute :mkdir, '-p', shared_path.join("config/initializers")
|
||||
upload! StringIO.new(text), shared_path.join("config/initializers/secret_token.rb")
|
||||
end
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ def setup_secret_token
|
|||
puts yellow "Generating secret_token and writing to #{file}..."
|
||||
Rake::Task["secret"].reenable
|
||||
secret = capture_stdout { Rake::Task["secret"].invoke }
|
||||
%x( touch #{Rails.root.join("#{file}")}; echo 'Foodsoft::Application.config.secret_token = "#{secret.chomp}"' > #{Rails.root.join("#{file}")} )
|
||||
%x( touch #{Rails.root.join("#{file}")}; echo 'Foodsoft::Application.config.secret_key_base = "#{secret.chomp}"' > #{Rails.root.join("#{file}")} )
|
||||
end
|
||||
|
||||
def start_mailcatcher
|
||||
|
|
|
|||
|
|
@ -31,7 +31,8 @@ class TokenVerifier < ActiveSupport::MessageVerifier
|
|||
protected
|
||||
|
||||
def self.secret
|
||||
Foodsoft::Application.config.secret_token
|
||||
# secret_key_base for Rails 4, but Rails 3 initializer may still be used
|
||||
Foodsoft::Application.config.secret_key_base or Foodsoft::Application.config.secret_token
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue