diff --git a/app/controllers/concerns/login_helper.rb b/app/controllers/concerns/login_helper.rb index cf0c8e1e3..ec4656e3b 100644 --- a/app/controllers/concerns/login_helper.rb +++ b/app/controllers/concerns/login_helper.rb @@ -29,7 +29,7 @@ module LoginHelper Rails.logger.info("id: #{user&.id} Successful authentication start: '#{user.login}' from #{request.remote_ip} at #{Time.now.utc}") # Valid user self.logged_user = user - + session[:"#{default_yun_session}"] = user.id # generate a key and set cookie if autologin set_autologin_cookie(user) diff --git a/app/controllers/oauth/base_controller.rb b/app/controllers/oauth/base_controller.rb index 327f21845..6236ff02b 100644 --- a/app/controllers/oauth/base_controller.rb +++ b/app/controllers/oauth/base_controller.rb @@ -5,6 +5,10 @@ class Oauth::BaseController < ActionController::Base skip_before_action :verify_authenticity_token + included do + helper_method :default_yun_session + end + def auth_failure render_error(params[:message]) end @@ -24,4 +28,9 @@ class Oauth::BaseController < ActionController::Base Rails.logger.info("[OAuth2] omniauth.auth -> #{request.env['omniauth.auth'].inspect}") request.env['omniauth.auth'] end + + def default_yun_session + @_default_yun_session = "#{request.subdomain.split('.').first}_user_id" + # @_default_yun_session = "#{current_laboratory.try(:identifier).split('.').first}_user_id" + end end \ No newline at end of file