forked from External/greenlight
Complete refactor of Gemfile and upgraded gems (#2553)
This commit is contained in:
@ -41,7 +41,7 @@ class AccountActivationsController < ApplicationController
|
||||
flash: { success: I18n.t("registration.approval.signup") } if @user.has_role?(:pending)
|
||||
|
||||
# Redirect user to sign in path with success flash
|
||||
redirect_to signin_path, flash: { success: I18n.t("verify.activated") + " " + I18n.t("verify.signin") }
|
||||
redirect_to signin_path, flash: { success: "#{I18n.t('verify.activated')} #{I18n.t('verify.signin')}" }
|
||||
else
|
||||
redirect_to root_path, flash: { alert: I18n.t("verify.invalid") }
|
||||
end
|
||||
|
@ -228,7 +228,7 @@ class AdminsController < ApplicationController
|
||||
flash_message = I18n.t("administrator.flash.settings")
|
||||
|
||||
if params[:value] == "Default Recording Visibility"
|
||||
flash_message += ". " + I18n.t("administrator.site_settings.recording_visibility.warning")
|
||||
flash_message += ". #{I18n.t('administrator.site_settings.recording_visibility.warning')}"
|
||||
end
|
||||
|
||||
redirect_to admin_site_settings_path(tab: tab), flash: { success: flash_message }
|
||||
|
@ -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)
|
||||
|
@ -113,7 +113,7 @@ module Authenticator
|
||||
old_user.rooms.each do |room|
|
||||
room.owner = user
|
||||
|
||||
room.name = "Old " + room.name if room.id == old_user.main_room.id
|
||||
room.name = "Old #{room.name}" if room.id == old_user.main_room.id
|
||||
|
||||
room.save!
|
||||
end
|
||||
|
@ -123,9 +123,10 @@ module Rolify
|
||||
:can_manage_rooms_recordings, :can_appear_in_share_list, :colour)
|
||||
|
||||
permission_params.transform_values! do |v|
|
||||
if v == "0"
|
||||
case v
|
||||
when "0"
|
||||
"false"
|
||||
elsif v == "1"
|
||||
when "1"
|
||||
"true"
|
||||
else
|
||||
v
|
||||
|
@ -47,9 +47,7 @@ class HealthCheckController < ApplicationController
|
||||
end
|
||||
|
||||
def database_check
|
||||
if defined?(ActiveRecord)
|
||||
raise "Database not responding" unless ActiveRecord::Migrator.current_version
|
||||
end
|
||||
raise "Database not responding" if defined?(ActiveRecord) && !ActiveRecord::Migrator.current_version
|
||||
raise "Pending migrations" unless ActiveRecord::Migration.check_pending!.nil?
|
||||
end
|
||||
|
||||
@ -61,9 +59,7 @@ class HealthCheckController < ApplicationController
|
||||
settings = ActionMailer::Base.smtp_settings
|
||||
|
||||
smtp = Net::SMTP.new(settings[:address], settings[:port])
|
||||
if settings[:enable_starttls_auto] == "true"
|
||||
smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto)
|
||||
end
|
||||
smtp.enable_starttls_auto if settings[:enable_starttls_auto] == ("true") && smtp.respond_to?(:enable_starttls_auto)
|
||||
|
||||
if settings[:authentication].present? && settings[:authentication] != "none"
|
||||
smtp.start(settings[:domain]) do |s|
|
||||
|
@ -332,11 +332,11 @@ class RoomsController < ApplicationController
|
||||
|
||||
def create_room_settings_string(options)
|
||||
room_settings = {
|
||||
"muteOnStart": options[:mute_on_join] == "1",
|
||||
"requireModeratorApproval": options[:require_moderator_approval] == "1",
|
||||
"anyoneCanStart": options[:anyone_can_start] == "1",
|
||||
"joinModerator": options[:all_join_moderator] == "1",
|
||||
"recording": options[:recording] == "1",
|
||||
muteOnStart: options[:mute_on_join] == "1",
|
||||
requireModeratorApproval: options[:require_moderator_approval] == "1",
|
||||
anyoneCanStart: options[:anyone_can_start] == "1",
|
||||
joinModerator: options[:all_join_moderator] == "1",
|
||||
recording: options[:recording] == "1",
|
||||
}
|
||||
|
||||
room_settings.to_json
|
||||
|
@ -125,13 +125,14 @@ class SessionsController < ApplicationController
|
||||
def ldap
|
||||
ldap_config = {}
|
||||
ldap_config[:host] = ENV['LDAP_SERVER']
|
||||
ldap_config[:port] = ENV['LDAP_PORT'].to_i != 0 ? ENV['LDAP_PORT'].to_i : 389
|
||||
ldap_config[:port] = ENV['LDAP_PORT'].to_i.zero? ? 389 : ENV['LDAP_PORT'].to_i
|
||||
ldap_config[:bind_dn] = ENV['LDAP_BIND_DN']
|
||||
ldap_config[:password] = ENV['LDAP_PASSWORD']
|
||||
ldap_config[:auth_method] = ENV['LDAP_AUTH']
|
||||
ldap_config[:encryption] = if ENV['LDAP_METHOD'] == 'ssl'
|
||||
ldap_config[:encryption] = case ENV['LDAP_METHOD']
|
||||
when 'ssl'
|
||||
'simple_tls'
|
||||
elsif ENV['LDAP_METHOD'] == 'tls'
|
||||
when 'tls'
|
||||
'start_tls'
|
||||
end
|
||||
ldap_config[:base] = ENV['LDAP_BASE']
|
||||
|
Reference in New Issue
Block a user