forked from External/greenlight
GRN2-224: Added event logs and production caching (#739)
* Added event logs and production caching * Added Support: before logs for easy identification * Added more Support for log errors * Reverted change to assets precompile check * Added vendor assets to precompile list * Travis fix
This commit is contained in:
committed by
Jesus Federico
parent
f87c2bfd16
commit
89f36c1766
@ -52,7 +52,7 @@ class AccountActivationsController < ApplicationController
|
||||
begin
|
||||
send_activation_email(@user)
|
||||
rescue => e
|
||||
logger.error "Error in email delivery: #{e}"
|
||||
logger.error "Support: Error in email delivery: #{e}"
|
||||
flash[:alert] = I18n.t(params[:message], default: I18n.t("delivery_error"))
|
||||
else
|
||||
flash[:success] = I18n.t("email_sent", email_type: t("verify.verification"))
|
||||
|
@ -97,7 +97,7 @@ class AdminsController < ApplicationController
|
||||
|
||||
send_invitation_email(current_user.name, email, invitation.invite_token)
|
||||
rescue => e
|
||||
logger.error "Error in email delivery: #{e}"
|
||||
logger.error "Support: Error in email delivery: #{e}"
|
||||
flash[:alert] = I18n.t(params[:message], default: I18n.t("delivery_error"))
|
||||
else
|
||||
flash[:success] = I18n.t("administrator.flash.invite", email: email)
|
||||
|
@ -39,7 +39,7 @@ class PasswordResetsController < ApplicationController
|
||||
redirect_to new_password_reset_path
|
||||
end
|
||||
rescue => e
|
||||
logger.error "Error in email delivery: #{e}"
|
||||
logger.error "Support: Error in email delivery: #{e}"
|
||||
redirect_to root_path, alert: I18n.t(params[:message], default: I18n.t("delivery_error"))
|
||||
end
|
||||
|
||||
|
@ -42,6 +42,8 @@ class RoomsController < ApplicationController
|
||||
room_params[:require_moderator_approval], room_params[:anyone_can_start], room_params[:all_join_moderator])
|
||||
|
||||
if @room.save
|
||||
logger.info("Support: #{current_user.email} has created a new room #{@room.uid}.")
|
||||
|
||||
if room_params[:auto_join] == "1"
|
||||
start
|
||||
else
|
||||
@ -138,6 +140,8 @@ class RoomsController < ApplicationController
|
||||
.uniq[0..2]
|
||||
end
|
||||
|
||||
logger.info("Support: #{current_user.present? ? current_user.email : @join_name} is joining room #{@room.uid}")
|
||||
|
||||
join_room(opts)
|
||||
end
|
||||
|
||||
@ -166,6 +170,8 @@ class RoomsController < ApplicationController
|
||||
|
||||
# POST /:room_uid/start
|
||||
def start
|
||||
logger.info("Support: #{current_user.email} is starting room #{@room.uid}")
|
||||
|
||||
# Join the user in and start the meeting.
|
||||
opts = default_meeting_options
|
||||
opts[:user_is_moderator] = true
|
||||
@ -178,6 +184,8 @@ class RoomsController < ApplicationController
|
||||
begin
|
||||
redirect_to @room.join_path(current_user.name, opts, current_user.uid)
|
||||
rescue BigBlueButton::BigBlueButtonException => e
|
||||
logger.error("Support: #{@room.uid} start failed: #{e}")
|
||||
|
||||
redirect_to room_path, alert: I18n.t(e.key.to_s.underscore, default: I18n.t("bigbluebutton_exception"))
|
||||
end
|
||||
|
||||
@ -208,6 +216,8 @@ class RoomsController < ApplicationController
|
||||
|
||||
# GET /:room_uid/logout
|
||||
def logout
|
||||
logger.info("Support: #{current_user.present? ? current_user.email : 'Guest'} has left room #{@room.uid}")
|
||||
|
||||
# Redirect the correct page.
|
||||
redirect_to @room
|
||||
end
|
||||
|
@ -31,6 +31,8 @@ class SessionsController < ApplicationController
|
||||
|
||||
# POST /users/login
|
||||
def create
|
||||
logger.info("Support: #{session_params[:email]} is attempting to login.")
|
||||
|
||||
admin = User.find_by(email: session_params[:email])
|
||||
if admin&.has_role? :super_admin
|
||||
user = admin
|
||||
@ -118,6 +120,8 @@ class SessionsController < ApplicationController
|
||||
|
||||
user = User.from_omniauth(@auth)
|
||||
|
||||
logger.info("Support: Auth user #{user.email} is attempting to login.")
|
||||
|
||||
# Add pending role if approval method and is a new user
|
||||
if approval_registration && !@user_exists
|
||||
user.add_role :pending
|
||||
@ -143,7 +147,7 @@ class SessionsController < ApplicationController
|
||||
end
|
||||
end
|
||||
rescue => e
|
||||
logger.error "Error authenticating via omniauth: #{e}"
|
||||
logger.error "Support: Error authenticating via omniauth: #{e}"
|
||||
omniauth_fail
|
||||
end
|
||||
end
|
||||
|
@ -43,6 +43,8 @@ class UsersController < ApplicationController
|
||||
# User has passed all validations required
|
||||
@user.save
|
||||
|
||||
logger.info("Support: #{@user.email} user has been created.")
|
||||
|
||||
# Set user to pending and redirect if Approval Registration is set
|
||||
if approval_registration
|
||||
@user.add_role :pending
|
||||
@ -161,6 +163,8 @@ class UsersController < ApplicationController
|
||||
|
||||
# DELETE /u/:user_uid
|
||||
def destroy
|
||||
logger.info("Support: #{current_user.email} is deleting #{@user.email}.")
|
||||
|
||||
if current_user && current_user == @user
|
||||
@user.destroy
|
||||
session.delete(:user_id)
|
||||
@ -168,7 +172,7 @@ class UsersController < ApplicationController
|
||||
begin
|
||||
@user.destroy
|
||||
rescue => e
|
||||
logger.error "Error in user deletion: #{e}"
|
||||
logger.error "Support: Error in user deletion: #{e}"
|
||||
flash[:alert] = I18n.t(params[:message], default: I18n.t("administrator.flash.delete_fail"))
|
||||
else
|
||||
flash[:success] = I18n.t("administrator.flash.delete")
|
||||
@ -220,7 +224,7 @@ class UsersController < ApplicationController
|
||||
begin
|
||||
send_activation_email(@user)
|
||||
rescue => e
|
||||
logger.error "Error in email delivery: #{e}"
|
||||
logger.error "Support: Error in email delivery: #{e}"
|
||||
flash[:alert] = I18n.t(params[:message], default: I18n.t("delivery_error"))
|
||||
else
|
||||
flash[:success] = I18n.t("email_sent", email_type: t("verify.verification"))
|
||||
@ -235,7 +239,7 @@ class UsersController < ApplicationController
|
||||
send_approval_user_signup_email(@user)
|
||||
end
|
||||
rescue => e
|
||||
logger.error "Error in email delivery: #{e}"
|
||||
logger.error "Support: Error in email delivery: #{e}"
|
||||
flash[:alert] = I18n.t(params[:message], default: I18n.t("delivery_error"))
|
||||
end
|
||||
end
|
||||
@ -245,6 +249,8 @@ class UsersController < ApplicationController
|
||||
valid_user = @user.valid?
|
||||
valid_captcha = Rails.configuration.recaptcha_enabled ? verify_recaptcha(model: @user) : true
|
||||
|
||||
logger.error("Support: #{@user.email} creation failed: User params are not valid.") unless valid_user
|
||||
|
||||
valid_user && valid_captcha
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user