From ab5c56c27d813c88fcbbdf82e8b4f6cbded717cb Mon Sep 17 00:00:00 2001 From: Josh Date: Thu, 13 Jul 2017 12:11:16 -0400 Subject: [PATCH] add guest landing page when guest access disabled --- app/assets/images/signin-icon.png | Bin 0 -> 4286 bytes app/controllers/landing_controller.rb | 10 ++++- app/views/landing/guest.html.erb | 44 ++++++++++++++++++++ config/locales/en-us.yml | 4 ++ config/routes.rb | 1 + test/controllers/landing_controller_test.rb | 36 ++++++++-------- 6 files changed, 76 insertions(+), 19 deletions(-) create mode 100644 app/assets/images/signin-icon.png create mode 100644 app/views/landing/guest.html.erb diff --git a/app/assets/images/signin-icon.png b/app/assets/images/signin-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..2973ae483bc1a656ff41f9b854c611a33cc82abd GIT binary patch literal 4286 zcmYM2c|276|HnUPhC!KdN4Aljv{L#U-7GX-(u~&$2 zB4mrm5@F;dvF$59ijk3S!Ab^K6C@mYxg^^=M2y~Q z`D8g%M!d9hEG=*fKTq`yAJP_lU&s4T_o&6#i_BG%_>z}8PA=0a{x6Ht&KeojNlJ+g zCrVk!oZ*yAsP7v8+O^AkO!SOS`}_~-{YG5xCP6&Z3KzE2vrW=1U)9R#-Hds!!lrLE z18{@GLdv$W=5}s2gL~SpKR0#-wq9Pb8C<#jaU^asEPWBZCB3$~M$Pd{U%*tONdq$Y zJg3TTmpf+uV$~Djd_ECP^Dq>&VB#c>&C6qzL(nY$9{Hum3PJ@y9R^ z(p_jBY8?@H&=RyWi^7v_ocdesPOg&=A+bngzsy(wP#gZ%4r7u0xulQ{*Ia(K5PQMA zQoqz55wNbYYf8gNpfgB~envgEo^1F58B!N0ELaie*};WoZ!rCDoFr$mvUmgTA?8V5 zW9MO#MUfW+HJoQ^Cj?9;=tX5rJzy8DSd`}t6UnS`WCqM-Ualm@M1+5>S)uksBg5nX zszD&yozH&H2Ie4p65>DJ<*milz9YgdCwJ8mrPs6e9E*_dL%C1;89*R-Ck+w6H)+oa z(cV1m9>#;F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P{@v&v=p>-XWUXQr-%AzF{L-;28R+IAX zcmlIXdkaXgCF;6z zG+5@%{yw?%{a8CNUfyl$5JRX)`>%T%4>%h_eH_)0xMkWxc-L{XL^gPU-es@VWNAR5 zk{gafxnr0|LtP$S*gjr9HRjqUZ-=aO;PQ99Y%Kc3(zjXrN@>wpW zQRfmzT4qA*c7!9V91387=;vF#_$(TQvd2tC!rHDosUif7?{8On>XY=M{uy3nZU5fT%c&%K!O7`=uK*1XEBjz9+#N}nxeC%E?z$C z_se2zR+_Fm^ER-q}7;vH#w*FA=Q=`^81( zRO_zmHT6X_NM^@-CLGqi{%P99>^aZFMJQW*O`?<=R_oY0{V-mfsn!$x?F1Qr&G$0t zO~}yQtI94e%m9RJDRln$c=32xx!ea)h{)O zx=P6!;Zb6}Jmh&{`YT_*gyroJ>9apQ!12IS9z|c1XK!jhhyX&$9b(iz+aL|@7dh0JX{SZWY{8H72s4hdToh+C(c1R3A9K2o1 zc!*x&2==R5iPQkayr7nM1XZ%~*xGD?s_5)yo>sErx=>YS|6G3cCE}7$`XFZi9pg`# zh&d8wKE7%q2y8jmIL)p%{TZS!?VF)IQd9J(U+j_B3ENllt6z~@h#)+@z~_6z95=K! z>zCT_nqLp85~8wr+MkA^SvTu0mTe9zFJiJ$V!&0bt)UUB2<1JC!oy*(9=k=$a3WPW zECEXpXRk(`x)z=j0*)(kw^7@g%0v!37(DoW?dub#lFh|0Gd0O$#MnjDL|I&{cRJ(V aPCO*d8;f19N@M+(0H&ucjLLp@zxp3AF6lD> literal 0 HcmV?d00001 diff --git a/app/controllers/landing_controller.rb b/app/controllers/landing_controller.rb index 2387c9f4..3b13c61a 100644 --- a/app/controllers/landing_controller.rb +++ b/app/controllers/landing_controller.rb @@ -18,12 +18,13 @@ class LandingController < ApplicationController include BbbApi def index - redirect_to user_login_path if Rails.configuration.disable_guest_access + # If guest access is disabled, redirect the user to the guest landing and force login. + redirect_to guest_path if Rails.configuration.disable_guest_access end def resource if Rails.configuration.disable_guest_access && params[:resource] == 'meetings' - redirect_to user_login_path + redirect_to guest_path else if params[:id].size > meeting_name_limit redirect_to root_url, flash: {danger: t('meeting_name_long')} @@ -38,6 +39,11 @@ class LandingController < ApplicationController end end end + + def guest + # If someone tries to aceess the guest landing when guest access is enabled, just send them to root. + redirect_to root_url unless Rails.configuration.disable_guest_access + end def send_meetings_data render json: {active: bbb.get_meetings, waiting: WaitingList.waiting} diff --git a/app/views/landing/guest.html.erb b/app/views/landing/guest.html.erb new file mode 100644 index 00000000..c5490a18 --- /dev/null +++ b/app/views/landing/guest.html.erb @@ -0,0 +1,44 @@ +<% +# BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. +# Copyright (c) 2016 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 . +%> + +
+
+ +
+ <%= render layout: 'shared/center_panel' do %> +

<%= t('welcome_to_greenlight') %>

+
+ <%= link_to user_login_path, class: "signin-link" do %> + + <% end %> +
+

<%= t('guest_sentence_one_html', bbb_link: link_to('BigBlueButton', + 'http://bigbluebutton.org/', target: "_blank")) %>
<%= t('guest_sentence_two') %>

+ <% end %> +
+ +
+ +
+ +
+
diff --git a/config/locales/en-us.yml b/config/locales/en-us.yml index 28d8da1f..b37af14e 100644 --- a/config/locales/en-us.yml +++ b/config/locales/en-us.yml @@ -88,6 +88,8 @@ en-US: error: An error occured error_title: An error has occured footer_html: Powered by %{bbb_link} + guest_sentence_one_html: GreenLight lets you create and manage %{bbb_link} meetings and recordings. + guest_sentence_two: To learn more about how GreenLight works, check out the video below! help: Help hi_all: Hi Everyone home_page: Home page @@ -107,6 +109,7 @@ en-US: logged_in_description_html: You are logged in as %{link} login: login login_description: Want to record a meeting? + login_greenlight: Login to GreenLight logout: logout meeting: Meeting meeting_invite: @@ -184,6 +187,7 @@ en-US: wait_for_mod_explanation: You will automatically join when the meeting starts watch: Watch 'yes': 'Yes' + welcome_to_greenlight: Welcome to GreenLight! youtube_description: This recording was recorded with BigBlueButton. For more information check out %{url}. youtube_footer: this will upload all webcam and audio data youtube_privacy_options: diff --git a/config/routes.rb b/config/routes.rb index 1bf019f7..faa14a1f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -56,6 +56,7 @@ Rails.application.routes.draw do get '/(:room_id)/:id', to: 'landing#resource', as: :meeting_room, defaults: {room_id: nil}, :constraints => {:id => disallow_slash, :room_id => disallow_slash} end + get '/guest', to: 'landing#guest', as: :guest get '/preferences', to: 'landing#preferences', as: :preferences root to: 'landing#index', :resource => 'meetings' diff --git a/test/controllers/landing_controller_test.rb b/test/controllers/landing_controller_test.rb index 554068ae..91055cc5 100644 --- a/test/controllers/landing_controller_test.rb +++ b/test/controllers/landing_controller_test.rb @@ -18,28 +18,33 @@ require 'test_helper' class LandingControllerTest < ActionController::TestCase - # Should redirect to login url if guest access is disabled. - def assert_login_or_success - if Rails.configuration.disable_guest_access - assert_redirected_to user_login_path - else - assert_response :success - end - end - setup do @meeting_id = 'test_id' @user = users :user1 end test "should get index" do + Rails.configuration.disable_guest_access = false get :index, params: {resource: 'meetings'} - assert_login_or_success + assert_response :success + end + + test "should redirect to guest from index" do + Rails.configuration.disable_guest_access = true + get :index, params: {resource: 'meetings'} + assert_redirected_to guest_path end test "should get meeting" do + Rails.configuration.disable_guest_access = false get :resource, params: { id: @meeting_id, resource: 'meetings' } - assert_login_or_success + assert_response :success + end + + test "should redirect to guest from meeting" do + Rails.configuration.disable_guest_access = true + get :index, params: {resource: 'meetings'} + assert_redirected_to guest_path end test "should get room" do @@ -68,14 +73,11 @@ class LandingControllerTest < ActionController::TestCase end test "should fallback to en-US locale if locale is en" do + Rails.configuration.disable_guest_access = false request.headers["Accept-Language"] = 'en' get :index, params: {resource: 'meetings'} - if Rails.configuration.disable_guest_access - assert_redirected_to user_login_path - else - assert_response :success - assert css_select('html').attribute('lang').value, 'en' - end + assert_response :success + assert css_select('html').attribute('lang').value, 'en' end end