forked from External/greenlight
parent
9dd30138ba
commit
ee26036105
|
@ -111,7 +111,7 @@ class ApplicationController < ActionController::Base
|
||||||
|
|
||||||
# Manually deal with 401 errors
|
# Manually deal with 401 errors
|
||||||
rescue_from CanCan::AccessDenied do |_exception|
|
rescue_from CanCan::AccessDenied do |_exception|
|
||||||
render "errors/not_found"
|
render "errors/greenlight_error"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks to make sure that the admin has changed his password from the default
|
# Checks to make sure that the admin has changed his password from the default
|
||||||
|
@ -141,13 +141,18 @@ class ApplicationController < ActionController::Base
|
||||||
retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
|
retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials')
|
||||||
rescue => e
|
rescue => e
|
||||||
if e.message.eql? "No user with that id exists"
|
if e.message.eql? "No user with that id exists"
|
||||||
render "errors/not_found", locals: { message: I18n.t("errors.not_found.user_not_found.message"),
|
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") }
|
help: I18n.t("errors.not_found.user_not_found.help") }
|
||||||
elsif e.message.eql? "Provider not included."
|
elsif e.message.eql? "Provider not included."
|
||||||
render "errors/not_found", locals: { message: I18n.t("errors.not_found.user_missing.message"),
|
render "errors/greenlight_error", locals: { message: I18n.t("errors.not_found.user_missing.message"),
|
||||||
help: I18n.t("errors.not_found.user_missing.help") }
|
help: I18n.t("errors.not_found.user_missing.help") }
|
||||||
|
elsif e.message.eql? "That user has no configured provider."
|
||||||
|
render "errors/greenlight_error", locals: { status_code: 501,
|
||||||
|
message: I18n.t("errors.no_provider.message"),
|
||||||
|
help: I18n.t("errors.no_provider.help") }
|
||||||
else
|
else
|
||||||
render "errors/internal_error"
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,14 +18,21 @@
|
||||||
|
|
||||||
class ErrorsController < ApplicationController
|
class ErrorsController < ApplicationController
|
||||||
def not_found
|
def not_found
|
||||||
render status: 404, formats: :html
|
render "greenlight_error", status: 404, formats: :html
|
||||||
end
|
end
|
||||||
|
|
||||||
def internal_error
|
def internal_error
|
||||||
render status: 500, formats: :html
|
render "errors/greenlight_error", status: 500, formats: :html,
|
||||||
|
locals: {
|
||||||
|
status_code: 500,
|
||||||
|
message: I18n.t("errors.internal.message"),
|
||||||
|
help: I18n.t("errors.internal.help"),
|
||||||
|
display_back: true
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
def unauthorized
|
def unauthorized
|
||||||
render status: 401, formats: :html
|
render "errors/greenlight_error", status: 401, formats: :html, locals: { status_code: 401,
|
||||||
|
message: I18n.t("errors.unauthorized.message"), help: I18n.t("errors.unauthorized.help"), display_back: true }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
<%
|
||||||
|
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
|
||||||
|
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
|
||||||
|
# This program is free software; you can redistribute it and/or modify it under the
|
||||||
|
# terms of the GNU Lesser General Public License as published by the Free Software
|
||||||
|
# Foundation; either version 3.0 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
#
|
||||||
|
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
|
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||||
|
# You should have received a copy of the GNU Lesser General Public License along
|
||||||
|
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
%>
|
||||||
|
|
||||||
|
<div class="container text-center pt-9">
|
||||||
|
<div class="display-1 text-primary mb-5">
|
||||||
|
<% if defined?(status_code) %>
|
||||||
|
<%= status_code %>
|
||||||
|
<% else %>
|
||||||
|
404
|
||||||
|
<% end %>
|
||||||
|
</div>
|
||||||
|
<% if defined?(message) && defined?(help) %>
|
||||||
|
<h1 class="h2 mb-3"><%= message %></h1>
|
||||||
|
<p class="h4 text-muted font-weight-normal mb-7"><%= help %></p>
|
||||||
|
<% if defined?(display_back) && display_back %>
|
||||||
|
<a class="btn btn-primary" href="javascript:history.back()">
|
||||||
|
<i class="fas fa-arrow-left mr-2"></i><%= t("go_back") %>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
<% else %>
|
||||||
|
<h1 class="h2 mb-3"><%= t("errors.not_found.message") %></h1>
|
||||||
|
<p class="h4 text-muted font-weight-normal mb-7"><%= t("errors.not_found.help") %></p>
|
||||||
|
<a class="btn btn-primary" href="javascript:history.back()">
|
||||||
|
<i class="fas fa-arrow-left mr-2"></i><%= t("go_back") %>
|
||||||
|
</a>
|
||||||
|
<% end %>
|
||||||
|
</div>
|
|
@ -1,23 +0,0 @@
|
||||||
<%
|
|
||||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
|
|
||||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
|
|
||||||
# This program is free software; you can redistribute it and/or modify it under the
|
|
||||||
# terms of the GNU Lesser General Public License as published by the Free Software
|
|
||||||
# Foundation; either version 3.0 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
#
|
|
||||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
# You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
%>
|
|
||||||
|
|
||||||
<div class="container text-center pt-9">
|
|
||||||
<div class="display-1 text-primary mb-5">500</div>
|
|
||||||
<h1 class="h2 mb-3"><%= t("errors.internal.message") %></h1>
|
|
||||||
<p class="h4 text-muted font-weight-normal mb-7"><%= t("errors.internal.help") %></p>
|
|
||||||
<a class="btn btn-primary" href="javascript:history.back()">
|
|
||||||
<i class="fas fa-arrow-left mr-2"></i><%= t("go_back") %>
|
|
||||||
</a>
|
|
||||||
</div>
|
|
|
@ -1,28 +0,0 @@
|
||||||
<%
|
|
||||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
|
|
||||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
|
|
||||||
# This program is free software; you can redistribute it and/or modify it under the
|
|
||||||
# terms of the GNU Lesser General Public License as published by the Free Software
|
|
||||||
# Foundation; either version 3.0 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
#
|
|
||||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
# You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
%>
|
|
||||||
|
|
||||||
<div class="container text-center pt-9">
|
|
||||||
<div class="display-1 mb-5 text-primary">404</div>
|
|
||||||
<% if defined?(message) && defined?(help) %>
|
|
||||||
<h1 class="h2 mb-3"><%= message %></h1>
|
|
||||||
<p class="h4 text-muted font-weight-normal mb-7"><%= help %></p>
|
|
||||||
<% else %>
|
|
||||||
<h1 class="h2 mb-3"><%= t("errors.not_found.message") %></h1>
|
|
||||||
<p class="h4 text-muted font-weight-normal mb-7"><%= t("errors.not_found.help") %></p>
|
|
||||||
<a class="btn btn-primary" href="javascript:history.back()">
|
|
||||||
<i class="fas fa-arrow-left mr-2"></i><%= t("go_back") %>
|
|
||||||
</a>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
|
|
@ -1,20 +0,0 @@
|
||||||
<%
|
|
||||||
# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
|
|
||||||
# Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
|
|
||||||
# This program is free software; you can redistribute it and/or modify it under the
|
|
||||||
# terms of the GNU Lesser General Public License as published by the Free Software
|
|
||||||
# Foundation; either version 3.0 of the License, or (at your option) any later
|
|
||||||
# version.
|
|
||||||
#
|
|
||||||
# BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
|
||||||
# You should have received a copy of the GNU Lesser General Public License along
|
|
||||||
# with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
|
||||||
%>
|
|
||||||
|
|
||||||
<div class="container text-center pt-9">
|
|
||||||
<div class="display-1 text-primary mb-5">401</div>
|
|
||||||
<h1 class="h2 mb-3"><%= t("errors.unauthorized.message") %></h1>
|
|
||||||
<p class="h4 text-muted font-weight-normal mb-7"><%= t("errors.unauthorized.help") %></p>
|
|
||||||
</div>
|
|
|
@ -137,6 +137,9 @@ en:
|
||||||
accepted: must be accepted
|
accepted: must be accepted
|
||||||
confirmation: doesn't match %{attribute}
|
confirmation: doesn't match %{attribute}
|
||||||
inclusion: is not included in the list
|
inclusion: is not included in the list
|
||||||
|
no_provider:
|
||||||
|
message: The customer you provided doesn't have Greenlight configured
|
||||||
|
help: Please contact Blindside Networks to setup Greenlight
|
||||||
not_found:
|
not_found:
|
||||||
message: Sorry! The page you are looking for does not exist.
|
message: Sorry! The page you are looking for does not exist.
|
||||||
help: Is it possible its been removed?
|
help: Is it possible its been removed?
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe AdminsController, type: :controller do
|
||||||
@request.session[:user_id] = @user.id
|
@request.session[:user_id] = @user.id
|
||||||
get :index
|
get :index
|
||||||
|
|
||||||
expect(response).to render_template(:not_found)
|
expect(response).to render_template(:greenlight_error)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders the admin settings if an admin tries to acccess it" do
|
it "renders the admin settings if an admin tries to acccess it" do
|
||||||
|
|
|
@ -80,7 +80,7 @@ describe ApplicationController do
|
||||||
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
|
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
|
||||||
|
|
||||||
get :user_not_found
|
get :user_not_found
|
||||||
expect(response).to render_template("errors/not_found")
|
expect(response).to render_template("errors/greenlight_error")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders a 404 error if user is not given" do
|
it "renders a 404 error if user is not given" do
|
||||||
|
@ -92,7 +92,7 @@ describe ApplicationController do
|
||||||
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
|
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
|
||||||
|
|
||||||
get :user_not_found
|
get :user_not_found
|
||||||
expect(response).to render_template("errors/not_found")
|
expect(response).to render_template("errors/greenlight_error")
|
||||||
end
|
end
|
||||||
|
|
||||||
it "renders a 500 error if any other error related to bbb api" do
|
it "renders a 500 error if any other error related to bbb api" do
|
||||||
|
@ -104,7 +104,7 @@ describe ApplicationController do
|
||||||
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
|
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
|
||||||
|
|
||||||
get :user_not_found
|
get :user_not_found
|
||||||
expect(response).to render_template("errors/internal_error")
|
expect(response).to render_template("errors/greenlight_error")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue