Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
Raphael 2010-09-27 16:54:18 -07:00
commit 591347a77a
6 changed files with 33 additions and 11 deletions

1
.gitignore vendored
View file

@ -17,3 +17,4 @@ public/uploads/*
config/app_config.yml
bin/*
nbproject
config/initializers/secret_token.rb

View file

@ -291,10 +291,4 @@ class User
OpenSSL::PKey::RSA.new( serialized_private_key )
end
def encryption_key= new_key
raise TypeError unless new_key.class == OpenSSL::PKey::RSA
serialized_private_key = new_key.export
end
end

View file

@ -0,0 +1,5 @@
unless File.exists?( File.join(Rails.root, 'config', 'initializers', 'secret_token.rb'))
`rake generate:secret_token`
require File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
end

View file

@ -8,4 +8,4 @@
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Rails.application.config.secret_token = 'ea08916110cae7f10fe9e1f7c7cb8c1fee13c3c3bee35180ac3061c370bd9ad985f28fcf2eb5f5684d0d618855efdeb862918628e994ed3e7fc806777428ef40'
Rails.application.config.secret_token = '3484b78b0f9d88f40cd44a20cf647140e5900632d0c9b85e1fd91dc539811d243f2f0756f791019c'

View file

@ -0,0 +1,26 @@
namespace :generate do
desc 'Generates a Session Secret Token'
task :secret_token do
path = File.join(Rails.root, 'config', 'initializers', 'secret_token.rb')
secret = ActiveSupport::SecureRandom.hex(40)
File.open(path, 'w') do |f|
f.write <<"EOF"
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3. See
# the COPYRIGHT file.
# Be sure to restart your server when you modify this file.
# Your secret key for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!
# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
Rails.application.config.secret_token = '#{secret}'
EOF
puts "YAY!!"
end
end
end

View file

@ -25,10 +25,6 @@ Factory.define :album do |p|
p.person { |a| Factory.create(:person) }
end
Factory.define :person_with_private_key, :parent => :person do |p|
p.serialized_key OpenSSL::PKey::RSA.generate(1024).export
end
Factory.define :user do |u|
u.sequence(:username) {|n| "bob#{n}"}
u.sequence(:email) {|n| "bob#{n}@pivotallabs.com"}