diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index c5197b97..a8345be2 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -111,7 +111,7 @@ class ApplicationController < ActionController::Base
# Manually deal with 401 errors
rescue_from CanCan::AccessDenied do |_exception|
- render "errors/not_found"
+ render "errors/greenlight_error"
end
# 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')
rescue => e
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") }
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") }
+ 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
- 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
diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb
index e9131af4..3bea0915 100644
--- a/app/controllers/errors_controller.rb
+++ b/app/controllers/errors_controller.rb
@@ -18,14 +18,21 @@
class ErrorsController < ApplicationController
def not_found
- render status: 404, formats: :html
+ render "greenlight_error", status: 404, formats: :html
end
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
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
diff --git a/app/views/errors/greenlight_error.html.erb b/app/views/errors/greenlight_error.html.erb
new file mode 100644
index 00000000..c7c83e74
--- /dev/null
+++ b/app/views/errors/greenlight_error.html.erb
@@ -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 .
+%>
+
+
+
+ <% if defined?(status_code) %>
+ <%= status_code %>
+ <% else %>
+ 404
+ <% end %>
+
+ <% if defined?(message) && defined?(help) %>
+
<%= message %>
+
<%= help %>
+ <% if defined?(display_back) && display_back %>
+
+ <%= t("go_back") %>
+
+ <% end %>
+ <% else %>
+
<%= t("errors.not_found.message") %>
+
<%= t("errors.not_found.help") %>
+
+ <%= t("go_back") %>
+
+ <% end %>
+
diff --git a/app/views/errors/internal_error.html.erb b/app/views/errors/internal_error.html.erb
deleted file mode 100644
index 0c76f1db..00000000
--- a/app/views/errors/internal_error.html.erb
+++ /dev/null
@@ -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 .
-%>
-
-
-
500
-
<%= t("errors.internal.message") %>
-
<%= t("errors.internal.help") %>
-
- <%= t("go_back") %>
-
-
diff --git a/app/views/errors/not_found.html.erb b/app/views/errors/not_found.html.erb
deleted file mode 100644
index d259ceac..00000000
--- a/app/views/errors/not_found.html.erb
+++ /dev/null
@@ -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 .
-%>
-
-
-
404
- <% if defined?(message) && defined?(help) %>
-
<%= message %>
-
<%= help %>
- <% else %>
-
<%= t("errors.not_found.message") %>
-
<%= t("errors.not_found.help") %>
-
- <%= t("go_back") %>
-
- <% end %>
-
diff --git a/app/views/errors/unauthorized.html.erb b/app/views/errors/unauthorized.html.erb
deleted file mode 100644
index 23dcdd7d..00000000
--- a/app/views/errors/unauthorized.html.erb
+++ /dev/null
@@ -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 .
-%>
-
-
-
401
-
<%= t("errors.unauthorized.message") %>
-
<%= t("errors.unauthorized.help") %>
-
diff --git a/config/locales/en.yml b/config/locales/en.yml
index e04ed564..5c41d99a 100755
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -137,6 +137,9 @@ en:
accepted: must be accepted
confirmation: doesn't match %{attribute}
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:
message: Sorry! The page you are looking for does not exist.
help: Is it possible its been removed?
diff --git a/spec/controllers/admins_controller_spec.rb b/spec/controllers/admins_controller_spec.rb
index 3f55a2c0..539fb9da 100644
--- a/spec/controllers/admins_controller_spec.rb
+++ b/spec/controllers/admins_controller_spec.rb
@@ -35,7 +35,7 @@ describe AdminsController, type: :controller do
@request.session[:user_id] = @user.id
get :index
- expect(response).to render_template(:not_found)
+ expect(response).to render_template(:greenlight_error)
end
it "renders the admin settings if an admin tries to acccess it" do
diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb
index f8f8a917..0085a6e7 100644
--- a/spec/controllers/application_controller_spec.rb
+++ b/spec/controllers/application_controller_spec.rb
@@ -80,7 +80,7 @@ describe ApplicationController do
routes.draw { get "user_not_found" => "anonymous#user_not_found" }
get :user_not_found
- expect(response).to render_template("errors/not_found")
+ expect(response).to render_template("errors/greenlight_error")
end
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" }
get :user_not_found
- expect(response).to render_template("errors/not_found")
+ expect(response).to render_template("errors/greenlight_error")
end
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" }
get :user_not_found
- expect(response).to render_template("errors/internal_error")
+ expect(response).to render_template("errors/greenlight_error")
end
end
end