diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 1bc2bad7d..32714bf87 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -292,9 +292,11 @@ class ApplicationController < ActionController::Base # and starts a session if needed def find_current_user uid_logger("user setup start: session[:user_id] is #{session[:user_id]}") - if session[:user_id] + + Rails.logger.info("find current_user: subdomain is #{request.subdomain} and user session is #{session[:user_id]} -- #{session[:"#{request.subdomain}_user_id"]}") + if session[:"#{request.subdomain}_user_id"] # existing session - (User.active.find(session[:user_id]) rescue nil) + (User.active.find(session[:"#{request.subdomain}_user_id"]) rescue nil) elsif autologin_user = try_to_autologin autologin_user elsif params[:format] == 'atom' && params[:key] && request.get? && accept_rss_auth? diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index e94cf8a21..a95723690 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -62,7 +62,17 @@ module LoginHelper end def start_user_session(user) - session[:user_id] = user.id + session[:"#{request.subdomain}_user_id"] = user.id + Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") + Rails.logger.info("user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}") + + # if current_laboratory.main_site? + # session[:user_id] = user.id + # else + # session[:"#{request.subdomain}_user_id"] = user.id + # end + + # session[:user_id] = user.id session[:ctime] = Time.now.utc.to_i session[:atime] = Time.now.utc.to_i end