Store a random user id for unauthenticated users as a cookie (#1364)

This commit is contained in:
Ahmad Farhat
2020-04-22 09:46:21 -04:00
committed by GitHub
parent bbec5bdf2d
commit 855694c716
2 changed files with 18 additions and 2 deletions

View File

@ -62,7 +62,8 @@ module Joiner
redirect_to join_path(@room, current_user.name, opts, current_user.uid)
else
join_name = params[:join_name] || params[@room.invite_path][:join_name]
redirect_to join_path(@room, join_name, opts)
redirect_to join_path(@room, join_name, opts, fetch_guest_id)
end
else
search_params = params[@room.invite_path] || params
@ -92,4 +93,19 @@ module Joiner
recording_default_visibility: @settings.get_value("Default Recording Visibility") == "public"
}
end
private
def fetch_guest_id
return cookies[:guest_id] if cookies[:guest_id].present?
guest_id = "gl-guest-#{SecureRandom.hex(12)}"
cookies[:guest_id] = {
value: guest_id,
expires: 1.day.from_now
}
guest_id
end
end