diff --git a/app/assets/javascripts/rename.js b/app/assets/javascripts/rename.js index 02e6eb0d..20570498 100644 --- a/app/assets/javascripts/rename.js +++ b/app/assets/javascripts/rename.js @@ -145,7 +145,6 @@ $(document).on('turbolinks:load', function(){ // Elements that can be renamed var room_title = $('#room-title'); - var room_blocks = $('#room_block_container').find('a'); var recording_rows = $('#recording-table').find('tr'); // Configure renaming for room header diff --git a/app/assets/javascripts/room.js b/app/assets/javascripts/room.js index ab02eabe..c4361069 100644 --- a/app/assets/javascripts/room.js +++ b/app/assets/javascripts/room.js @@ -62,13 +62,13 @@ $(document).on('turbolinks:load', function(){ //show all elements & their children with a create-only class $(".create-only").each(function() { $(this).show() - if($(this).children().length > 0) $(this).children().show() + if($(this).children().length > 0) { $(this).children().show() } }) //hide all elements & their children with a update-only class $(".update-only").each(function() { $(this).attr('style',"display:none !important") - if($(this).children().length > 0) $(this).children().attr('style',"display:none !important") + if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") } }) }) @@ -81,13 +81,13 @@ $(document).on('turbolinks:load', function(){ //show all elements & their children with a update-only class $(".update-only").each(function() { $(this).show() - if($(this).children().length > 0) $(this).children().show() + if($(this).children().length > 0) { $(this).children().show() } }) //hide all elements & their children with a create-only class $(".create-only").each(function() { $(this).attr('style',"display:none !important") - if($(this).children().length > 0) $(this).children().attr('style',"display:none !important") + if($(this).children().length > 0) { $(this).children().attr('style',"display:none !important") } }) updateCurrentSettings($(this).closest("#room-block").data("room-settings")) @@ -105,7 +105,7 @@ $(document).on('turbolinks:load', function(){ //set dropdown value if (settings.joinViaHtml5) { updateDropdown($(".dropdown-item[value='html5']")) - } else if (settings.joinViaHtml5 == false) { + } else if (settings.joinViaHtml5 === false) { updateDropdown($(".dropdown-item[value='flash']")) } else { //default option updateDropdown($(".dropdown-item[value='default']")) diff --git a/app/assets/javascripts/sort.js b/app/assets/javascripts/sort.js index 35ed9d1d..09452868 100644 --- a/app/assets/javascripts/sort.js +++ b/app/assets/javascripts/sort.js @@ -92,6 +92,8 @@ $(document).on('turbolinks:load', function(){ } else if(order === "desc"){ return b_val.localeCompare(a_val); + } else { + return undefined; } diff --git a/app/controllers/account_activations_controller.rb b/app/controllers/account_activations_controller.rb index 9e7eee79..549253d9 100644 --- a/app/controllers/account_activations_controller.rb +++ b/app/controllers/account_activations_controller.rb @@ -17,6 +17,8 @@ # with BigBlueButton; if not, see . class AccountActivationsController < ApplicationController + include Verifier + before_action :ensure_unauthenticated before_action :find_user @@ -44,7 +46,7 @@ class AccountActivationsController < ApplicationController flash[:alert] = I18n.t("verify.already_verified") else begin - @user.send_activation_email(verification_link) + @user.send_activation_email(user_verification_link) rescue => e logger.error "Error in email delivery: #{e}" flash[:alert] = I18n.t(params[:message], default: I18n.t("delivery_error")) @@ -58,10 +60,6 @@ class AccountActivationsController < ApplicationController private - def verification_link - request.base_url + edit_account_activation_path(token: @user.activation_token, email: @user.email) - end - def ensure_unauthenticated redirect_to current_user.main_room if current_user end diff --git a/app/controllers/concerns/verifier.rb b/app/controllers/concerns/verifier.rb new file mode 100644 index 00000000..b6bc852b --- /dev/null +++ b/app/controllers/concerns/verifier.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# 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 . + +module Verifier + extend ActiveSupport::Concern + + # Returns the link the user needs to click to verify their account + def user_verification_link + request.base_url + edit_account_activation_path(token: @user.activation_token, email: @user.email) + end +end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index aea7b4ba..dc638764 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -18,6 +18,7 @@ class UsersController < ApplicationController include RecordingsHelper + include Verifier before_action :find_user, only: [:edit, :update, :destroy] before_action :ensure_unauthenticated, only: [:new, :create] @@ -141,10 +142,6 @@ class UsersController < ApplicationController @user = User.find_by!(uid: params[:user_uid]) end - def verification_link - request.base_url + edit_account_activation_path(token: @user.activation_token, email: @user.email) - end - def ensure_unauthenticated redirect_to current_user.main_room if current_user end