forked from External/greenlight
add guest landing page when guest access disabled
This commit is contained in:
parent
ec16f51926
commit
ab5c56c27d
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
|
@ -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}
|
||||
|
|
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
%>
|
||||
|
||||
<div class="page-wrapper meetings">
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="center-panel-wrapper">
|
||||
<%= render layout: 'shared/center_panel' do %>
|
||||
<h1 class='text-center'><%= t('welcome_to_greenlight') %></h1>
|
||||
<br>
|
||||
<%= link_to user_login_path, class: "signin-link" do %>
|
||||
<div class="signin-button center-block">
|
||||
<div class="signin-icon-wrapper">
|
||||
<%= image_tag("signin-icon.png", alt: "L", class: "signin-icon") %>
|
||||
</div>
|
||||
<div class="signin-text-wrapper text-center">
|
||||
<span class="signin-text"><%= t('login_greenlight') %></span>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
<br>
|
||||
<p class='text-center' style='font-size: 13px;'> <%= t('guest_sentence_one_html', bbb_link: link_to('BigBlueButton',
|
||||
'http://bigbluebutton.org/', target: "_blank")) %><br><%= t('guest_sentence_two') %></p>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<div class="text-center" style="padding-top:20px;">
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/yGX3JCv7OVM" frameborder="0" allowfullscreen></iframe>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
|
@ -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:
|
||||
|
|
|
@ -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'
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue