forked from External/greenlight
oauth update
This commit is contained in:
@ -9,7 +9,7 @@ class BbbController < ApplicationController
|
||||
if params[:name].blank?
|
||||
render_bbb_response("missing_parameter", "user name was not included", :unprocessable_entity)
|
||||
else
|
||||
user = User.find_by username: params[:id]
|
||||
user = User.find_by encrypted_id: params[:id]
|
||||
|
||||
options = if user
|
||||
{
|
||||
@ -29,7 +29,7 @@ class BbbController < ApplicationController
|
||||
)
|
||||
|
||||
if bbb_res[:returncode] && current_user && current_user == user
|
||||
ActionCable.server.broadcast "#{user.username}_meeting_updates_channel",
|
||||
ActionCable.server.broadcast "#{user.encrypted_id}_meeting_updates_channel",
|
||||
action: 'moderator_joined',
|
||||
moderator: 'joined'
|
||||
end
|
||||
@ -42,9 +42,9 @@ class BbbController < ApplicationController
|
||||
def end
|
||||
load_and_authorize_room_owner!
|
||||
|
||||
bbb_res = bbb_end_meeting @user.username
|
||||
bbb_res = bbb_end_meeting @user.encrypted_id
|
||||
if bbb_res[:returncode]
|
||||
EndMeetingJob.perform_later(@user.username)
|
||||
EndMeetingJob.perform_later(@user.encrypted_id)
|
||||
end
|
||||
render_bbb_response bbb_res
|
||||
end
|
||||
@ -53,7 +53,7 @@ class BbbController < ApplicationController
|
||||
def recordings
|
||||
load_room!
|
||||
|
||||
bbb_res = bbb_get_recordings @user.username
|
||||
bbb_res = bbb_get_recordings @user.encrypted_id
|
||||
render_bbb_response bbb_res, bbb_res[:recordings]
|
||||
end
|
||||
|
||||
@ -61,7 +61,7 @@ class BbbController < ApplicationController
|
||||
def update_recordings
|
||||
bbb_res = bbb_update_recordings(params[:record_id], params[:published] == 'true')
|
||||
if bbb_res[:returncode]
|
||||
RecordingUpdatesJob.perform_later(@user.username, params[:record_id], bbb_res[:published])
|
||||
RecordingUpdatesJob.perform_later(@user.encrypted_id, params[:record_id], bbb_res[:published])
|
||||
end
|
||||
render_bbb_response bbb_res
|
||||
end
|
||||
@ -70,7 +70,7 @@ class BbbController < ApplicationController
|
||||
def delete_recordings
|
||||
bbb_res = bbb_delete_recordings(params[:record_id])
|
||||
if bbb_res[:returncode]
|
||||
RecordingDeletesJob.perform_later(@user.username, params[:record_id])
|
||||
RecordingDeletesJob.perform_later(@user.encrypted_id, params[:record_id])
|
||||
end
|
||||
render_bbb_response bbb_res
|
||||
end
|
||||
@ -78,7 +78,7 @@ class BbbController < ApplicationController
|
||||
private
|
||||
|
||||
def load_room!
|
||||
@user = User.find_by username: params[:id]
|
||||
@user = User.find_by encrypted_id: params[:id]
|
||||
if !@user
|
||||
render head(:not_found) && return
|
||||
end
|
||||
|
@ -16,16 +16,20 @@ class LandingController < ApplicationController
|
||||
end
|
||||
|
||||
def session_status_refresh
|
||||
@user = User.find_by(username: params[:id])
|
||||
@user = User.find_by(encrypted_id: params[:id])
|
||||
if @user.nil?
|
||||
render head(:not_found) && return
|
||||
end
|
||||
|
||||
@meeting_running = bbb_get_meeting_info(@user.username)[:returncode]
|
||||
@meeting_running = bbb_get_meeting_info(@user.encrypted_id)[:returncode]
|
||||
|
||||
render layout: false
|
||||
end
|
||||
|
||||
def auth_failure
|
||||
redirect_to '/'
|
||||
end
|
||||
|
||||
def admin?
|
||||
@user && @user == current_user
|
||||
end
|
||||
@ -42,13 +46,13 @@ class LandingController < ApplicationController
|
||||
def render_room
|
||||
params[:action] = 'rooms'
|
||||
|
||||
@user = User.find_by(username: params[:id])
|
||||
@user = User.find_by(encrypted_id: params[:id])
|
||||
if @user.nil?
|
||||
redirect_to root_path
|
||||
return
|
||||
end
|
||||
|
||||
@meeting_running = bbb_get_meeting_info(@user.username)[:returncode]
|
||||
@meeting_running = bbb_get_meeting_info(@user.encrypted_id)[:returncode]
|
||||
|
||||
render :action => 'rooms'
|
||||
end
|
||||
|
@ -1,14 +1,8 @@
|
||||
class SessionsController < ApplicationController
|
||||
def create
|
||||
@user = User.from_omniauth(request.env['omniauth.auth'])
|
||||
if @user.persisted?
|
||||
session[:user_id] = @user.id
|
||||
redirect_to controller: 'landing', action: 'index', id: @user.username, resource: 'rooms'
|
||||
else
|
||||
@user.save!
|
||||
session[:user_id] = @user.id
|
||||
redirect_to controller: 'users', action: 'edit', id: @user.id
|
||||
end
|
||||
session[:user_id] = @user.id
|
||||
redirect_to controller: 'landing', action: 'index', id: @user.encrypted_id, resource: 'rooms'
|
||||
rescue => e
|
||||
logger.error "Error authenticating via omniauth: #{e}"
|
||||
redirect_to root_path
|
||||
|
@ -1,32 +0,0 @@
|
||||
class UsersController < ApplicationController
|
||||
before_action :set_user, only: [:edit, :update]
|
||||
|
||||
# GET /users/1/edit
|
||||
def edit
|
||||
end
|
||||
|
||||
# PATCH/PUT /users/1
|
||||
# PATCH/PUT /users/1.json
|
||||
def update
|
||||
if @user.update(user_params)
|
||||
redirect_to controller: 'landing', action: 'index', id: @user.username, resource: 'rooms'
|
||||
else
|
||||
@error = @user.errors.first[1] rescue nil
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
# Use callbacks to share common setup or constraints between actions.
|
||||
def set_user
|
||||
@user = User.find(params[:id])
|
||||
if @user.username
|
||||
render 'errors/error'
|
||||
end
|
||||
end
|
||||
|
||||
# Never trust parameters from the scary internet, only allow the white list through.
|
||||
def user_params
|
||||
params.require(:user).permit(:username)
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user