Commit 7e723055b806449ae12c63afb03ff5a53b466938

Authored by Victor Costa
2 parents 7d89cae4 a1e9a849
Exists in production

Merge branch 'staging' into production

Conflicts:
	app/models/session.rb
app/models/session.rb
1 1 class Session < ActiveRecord::SessionStore::Session
2 2  
3 3 def self.find_by_session_id(session_id)
4   - connection.clear_query_cache
5 4 where(session_id: session_id).first
6 5 end
7 6  
... ...
lib/authenticated_system.rb
... ... @@ -23,6 +23,17 @@ module AuthenticatedSystem
23 23 def current_user
24 24 @current_user ||= begin
25 25 id = session[:user]
  26 +
  27 + session_id = cookies[:_noosfero_session]
  28 + if id.blank? && session_id.present?
  29 + Session.connection.clear_query_cache
  30 + session_obj = Session.where(session_id: session_id).first
  31 + if session_obj.present?
  32 + session = session_obj.data
  33 + id = session_obj.user_id
  34 + end
  35 + end
  36 +
26 37 user = User.where(id: id).first if id
27 38 user.session = session if user
28 39 User.current = user
... ...