diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bbd6f29e..95bb979b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -29,6 +29,9 @@ class ApplicationController < ActionController::Base before_action :set_user_domain before_action :check_user_role + # Manually handle BigBlueButton errors + rescue_from BigBlueButton::BigBlueButtonException, with: :handle_bigbluebutton_error + # Force SSL for loadbalancer configurations. before_action :redirect_to_https @@ -147,4 +150,9 @@ class ApplicationController < ActionController::Base end end helper_method :check_user_role + + # Manually Handle BigBlueButton errors + def handle_bigbluebutton_error + render "errors/bigbluebutton_error" + end end diff --git a/app/views/errors/bigbluebutton_error.html.erb b/app/views/errors/bigbluebutton_error.html.erb new file mode 100644 index 00000000..b1e41b6b --- /dev/null +++ b/app/views/errors/bigbluebutton_error.html.erb @@ -0,0 +1,20 @@ +<% +# 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 . +%> + +
+
<%= I18n.t("errors.bigbluebutton.title") %>
+

<%= I18n.t("errors.bigbluebutton.message") %>

+

<%= I18n.t("errors.bigbluebutton.help", doc_link: "http://docs.bigbluebutton.org/greenlight/gl-install.html#setting-bigbluebutton-credentials").html_safe %>

+
diff --git a/config/locales/en.yml b/config/locales/en.yml index 42a549c4..fb609a1e 100755 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -98,6 +98,10 @@ en: email_sent: Your %{email_type} email has been sent! (Please check your Spam folder if you haven't received it) enter_your_name: Enter your name! errors: + bigbluebutton: + help: Please make sure the proper steps have been taken. Learn more + message: Invalid BigBlueButton Endpoint and Secret + title: Server Error internal: message: Oh no! Looks like something went wrong on our end. help: The error has been logged, we'll take a look! @@ -124,7 +128,6 @@ en: unauthorized: message: You do not have access to this application help: If you believe this is a mistake, please contact your system administrator. - unprocessable: message: Oops! Request is unprocessable. help: Unfortunately this isn't a valid request. diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 2c2ce500..0d5e9550 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -24,11 +24,13 @@ end describe ApplicationController do controller do - before_action :check_if_unbanned - def index head :ok end + + def error + raise BigBlueButton::BigBlueButtonException + end end context "roles" do @@ -56,4 +58,13 @@ describe ApplicationController do expect(response).to redirect_to(root_path) end end + + context "errors" do + it "renders a BigBlueButton error if a BigBlueButtonException occurrs" do + routes.draw { get "error" => "anonymous#error" } + + get :error + expect(response).to render_template("errors/bigbluebutton_error") + end + end end