diff --git a/app/assets/images/signin-icon.png b/app/assets/images/signin-icon.png new file mode 100644 index 00000000..2973ae48 Binary files /dev/null and b/app/assets/images/signin-icon.png differ 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