Session fix
This commit is contained in:
parent
7daea8832d
commit
cf0491465b
|
@ -32,11 +32,12 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def session_key
|
||||
unless request.cookies['_beathaven_session'].nil?
|
||||
rails_key = request.cookies['_beathaven_session'][0..31]
|
||||
else
|
||||
rails_key = Digest::SHA512.hexdigest(Beathaven::Application.config.secret_token+Time.now.to_f.to_s+Random.rand().to_s)
|
||||
if cookies[:beathaven_sid].nil?
|
||||
cookies[:beathaven_sid] = {
|
||||
:value => Digest::SHA1.hexdigest(Beathaven::Application.config.secret_token+Time.now.to_f.to_s+Random.rand().to_s),
|
||||
:expire => 42.years.from_now.utc
|
||||
}
|
||||
end
|
||||
Digest::SHA512.hexdigest(rails_key)
|
||||
cookies[:beathaven_sid]
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
Beathaven::Application.config.session_store :cookie_store, key: '_beathaven_session'
|
||||
Beathaven::Application.config.session_store :cookie_store, key: 'beathaven_sid_v'
|
||||
|
||||
# Use the database for sessions instead of the cookie-based default,
|
||||
# which shouldn't be used to store highly confidential information
|
||||
|
|
Loading…
Reference in New Issue