forked from External/greenlight
add support for deploying to a subdirectory
This commit is contained in:
@ -5,7 +5,7 @@ class RoomsController < ApplicationController
|
||||
|
||||
META_LISTED = "gl-listed"
|
||||
|
||||
# POST /r
|
||||
# POST /
|
||||
def create
|
||||
redirect_to root_path unless current_user
|
||||
|
||||
@ -24,7 +24,7 @@ class RoomsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /r/:room_uid
|
||||
# GET /:room_uid
|
||||
def show
|
||||
if current_user && @room.owned_by?(current_user)
|
||||
@recordings = @room.recordings
|
||||
@ -34,7 +34,7 @@ class RoomsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# POST /r/:room_uid
|
||||
# POST /:room_uid
|
||||
def join
|
||||
opts = default_meeting_options
|
||||
|
||||
@ -59,7 +59,7 @@ class RoomsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# DELETE /r/:room_uid
|
||||
# DELETE /:room_uid
|
||||
def destroy
|
||||
# Don't delete the users home room.
|
||||
@room.destroy if @room != current_user.main_room
|
||||
@ -67,7 +67,7 @@ class RoomsController < ApplicationController
|
||||
redirect_to current_user.main_room
|
||||
end
|
||||
|
||||
# POST /r/:room_uid/start
|
||||
# POST /:room_uid/start
|
||||
def start
|
||||
# Join the user in and start the meeting.
|
||||
opts = default_meeting_options
|
||||
@ -80,13 +80,13 @@ class RoomsController < ApplicationController
|
||||
NotifyUserWaitingJob.set(wait: 5.seconds).perform_later(@room)
|
||||
end
|
||||
|
||||
# GET /r/:room_uid/logout
|
||||
# GET /:room_uid/logout
|
||||
def logout
|
||||
# Redirect the correct page.
|
||||
redirect_to @room
|
||||
end
|
||||
|
||||
# POST /r/:room_uid/home
|
||||
# POST /:room_uid/home
|
||||
def home
|
||||
current_user.main_room = @room
|
||||
current_user.save
|
||||
@ -94,7 +94,7 @@ class RoomsController < ApplicationController
|
||||
redirect_to @room
|
||||
end
|
||||
|
||||
# POST /r/:room_uid/:record_id
|
||||
# POST /:room_uid/:record_id
|
||||
def update_recording
|
||||
meta = {
|
||||
"meta_#{META_LISTED}": (params[:state] == "public")
|
||||
@ -104,7 +104,7 @@ class RoomsController < ApplicationController
|
||||
redirect_to @room if res[:updated]
|
||||
end
|
||||
|
||||
# DELETE /r/:room_uid/:record_id
|
||||
# DELETE /:room_uid/:record_id
|
||||
def delete_recording
|
||||
@room.delete_recording(params[:record_id])
|
||||
|
||||
|
@ -3,7 +3,7 @@ class UsersController < ApplicationController
|
||||
before_action :find_user, only: [:edit, :update]
|
||||
before_action :ensure_unauthenticated, only: [:new, :create]
|
||||
|
||||
# POST /users
|
||||
# POST /u
|
||||
def create
|
||||
# Verify that GreenLight is configured to allow user signup.
|
||||
return unless Rails.configuration.allow_user_signup
|
||||
@ -28,7 +28,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# GET /users/:user_uid/edit
|
||||
# GET /u/:user_uid/edit
|
||||
def edit
|
||||
if current_user
|
||||
redirect_to current_user.room unless @user == current_user
|
||||
@ -37,41 +37,40 @@ class UsersController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
# PATCH /users/:user_uid
|
||||
# PATCH /u/:user_uid
|
||||
def update
|
||||
# Update account information if passed.
|
||||
@user.name = user_params[:name] if user_params[:name]
|
||||
@user.email = user_params[:email] if user_params[:email]
|
||||
@user.image = user_params[:image] if user_params[:image]
|
||||
if params[:setting] == "password"
|
||||
# Update the users password.
|
||||
errors = {}
|
||||
|
||||
# Custom errors not generated by validations.
|
||||
errors = {}
|
||||
|
||||
# Verify that the provided password is correct.
|
||||
if user_params[:password]
|
||||
if @user.authenticate(user_params[:password])
|
||||
# Verify that the new passwords match.
|
||||
if user_params[:new_password] == user_params[:password_confirmation]
|
||||
@user.password = user_params[:new_password]
|
||||
else
|
||||
# New passwords don't match.
|
||||
errors[:password_confirmation] = "'s don't match"
|
||||
errors[:password_confirmation] = "doesn't match"
|
||||
end
|
||||
else
|
||||
# Original password is incorrect, can't update.
|
||||
errors[:password] = "is incorrect"
|
||||
end
|
||||
end
|
||||
|
||||
if @user.save!
|
||||
# Notify the use that their account has been updated.
|
||||
redirect_to edit_user_path(@user), notice: "Information successfully updated."
|
||||
if errors.empty? && @user.save
|
||||
# Notify the use that their account has been updated.
|
||||
redirect_to edit_user_path(@user), notice: "Information successfully updated."
|
||||
else
|
||||
# Append custom errors.
|
||||
errors.each do |k, v| @user.errors.add(k, v) end
|
||||
render :edit
|
||||
end
|
||||
else
|
||||
# Append custom errors.
|
||||
errors.each do |k, v| @user.errors.add(k, v) end
|
||||
|
||||
# Handle validation errors.
|
||||
render :edit
|
||||
# Update the core user attributes.
|
||||
if @user.update_attributes(user_params)
|
||||
redirect_to edit_user_path(@user), notice: "Information successfully updated."
|
||||
else
|
||||
render :edit
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -21,7 +21,7 @@ class Room < ApplicationRecord
|
||||
|
||||
# Determines the invite URL for the room.
|
||||
def invite_path
|
||||
"/r/#{uid}"
|
||||
"#{Rails.configuration.relative_url_root}/#{uid}"
|
||||
end
|
||||
|
||||
# Creates a meeting on the BigBlueButton server.
|
||||
|
@ -13,7 +13,7 @@ class User < ApplicationRecord
|
||||
uniqueness: { case_sensitive: false },
|
||||
format: {with: /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i }
|
||||
|
||||
validates :password, length: { minimum: 6 }, presence: true, confirmation: true, allow_blank: true, if: :greenlight_account?
|
||||
validates :password, length: { minimum: 6 }, confirmation: true, if: :greenlight_account?
|
||||
|
||||
# We don't want to require password validations on all accounts.
|
||||
has_secure_password(validations: false)
|
||||
@ -57,7 +57,7 @@ class User < ApplicationRecord
|
||||
end
|
||||
|
||||
def twitter_image(auth)
|
||||
auth['info']['image'].gsub!("_normal", "")
|
||||
auth['info']['image'].gsub("_normal", "")
|
||||
end
|
||||
|
||||
def google_name(auth)
|
||||
|
Reference in New Issue
Block a user