forked from External/greenlight
Complete refactor of Gemfile and upgraded gems (#2553)
This commit is contained in:
@ -29,13 +29,11 @@ class ApplicationController < ActionController::Base
|
||||
def current_user
|
||||
@current_user ||= User.includes(:role, :main_room).find_by(id: session[:user_id])
|
||||
|
||||
if Rails.configuration.loadbalanced_configuration
|
||||
if @current_user && !@current_user.has_role?(:super_admin) &&
|
||||
@current_user.provider != @user_domain
|
||||
if Rails.configuration.loadbalanced_configuration && (@current_user && !@current_user.has_role?(:super_admin) &&
|
||||
@current_user.provider != @user_domain)
|
||||
@current_user = nil
|
||||
session.clear
|
||||
end
|
||||
end
|
||||
|
||||
@current_user
|
||||
end
|
||||
@ -86,8 +84,8 @@ class ApplicationController < ActionController::Base
|
||||
end
|
||||
|
||||
maintenance_string = @settings.get_value("Maintenance Banner").presence || Rails.configuration.maintenance_window
|
||||
if maintenance_string.present?
|
||||
flash.now[:maintenance] = maintenance_string unless cookies[:maintenance_window] == maintenance_string
|
||||
if maintenance_string.present? && cookies[:maintenance_window] != maintenance_string
|
||||
flash.now[:maintenance] = maintenance_string
|
||||
end
|
||||
end
|
||||
|
||||
@ -268,17 +266,18 @@ class ApplicationController < ActionController::Base
|
||||
rescue => e
|
||||
logger.error "Error in retrieve provider info: #{e}"
|
||||
@hide_signin = true
|
||||
if e.message.eql? "No user with that id exists"
|
||||
case e.message
|
||||
when "No user with that id exists"
|
||||
set_default_settings
|
||||
|
||||
render "errors/greenlight_error", locals: { message: I18n.t("errors.not_found.user_not_found.message"),
|
||||
help: I18n.t("errors.not_found.user_not_found.help") }
|
||||
elsif e.message.eql? "Provider not included."
|
||||
when "Provider not included."
|
||||
set_default_settings
|
||||
|
||||
render "errors/greenlight_error", locals: { message: I18n.t("errors.not_found.user_missing.message"),
|
||||
help: I18n.t("errors.not_found.user_missing.help") }
|
||||
elsif e.message.eql? "That user has no configured provider."
|
||||
when "That user has no configured provider."
|
||||
if Setting.exists?(provider: @user_domain)
|
||||
# Keep the branding
|
||||
@settings = Setting.find_by(provider: @user_domain)
|
||||
|
Reference in New Issue
Block a user