forked from External/greenlight
GRN2-xx: Hide signin when error occures (#2221)
* Hide signin when error occures * Rubocop fixes
This commit is contained in:
parent
0801c626c5
commit
0ff938a0fd
|
@ -259,24 +259,40 @@ class ApplicationController < ActionController::Base
|
|||
session[:provider_exists] = @user_domain
|
||||
rescue => e
|
||||
logger.error "Error in retrieve provider info: #{e}"
|
||||
# Use the default site settings
|
||||
@user_domain = "greenlight"
|
||||
@settings = Setting.find_or_create_by(provider: @user_domain)
|
||||
|
||||
@hide_signin = true
|
||||
if e.message.eql? "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."
|
||||
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."
|
||||
if Setting.exists(provider: @user_domain)
|
||||
# Keep the branding
|
||||
@settings = Setting.find_by(provider: @user_domain)
|
||||
else
|
||||
set_default_settings
|
||||
end
|
||||
|
||||
render "errors/greenlight_error", locals: { status_code: 501,
|
||||
message: I18n.t("errors.no_provider.message"),
|
||||
help: I18n.t("errors.no_provider.help") }
|
||||
else
|
||||
set_default_settings
|
||||
|
||||
render "errors/greenlight_error", locals: { status_code: 500, message: I18n.t("errors.internal.message"),
|
||||
help: I18n.t("errors.internal.help"), display_back: true }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def set_default_settings
|
||||
# Use the default site settings
|
||||
@user_domain = "greenlight"
|
||||
@settings = Setting.find_or_create_by(provider: @user_domain)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -130,4 +130,9 @@ module ApplicationHelper
|
|||
return false unless recording_consent_required?
|
||||
@settings.get_value("Room Configuration Recording") == "disabled"
|
||||
end
|
||||
|
||||
# Hide the signin buttons if there is an error on the page
|
||||
def show_signin
|
||||
!@hide_signin.present?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<% else %>
|
||||
<% elsif show_signin %>
|
||||
<% allow_greenlight_accounts = allow_greenlight_accounts? %>
|
||||
<% if allow_greenlight_accounts %>
|
||||
<%= link_to t("login"), signin_path, :class => "btn btn-outline-primary mx-2 sign-in-button" %>
|
||||
|
|
Loading…
Reference in New Issue