Skip to content

Commit

Permalink
🔒 セキュリティ強化:入退時のuser_idをline_idに変更
Browse files Browse the repository at this point in the history
  • Loading branch information
Nori0219 committed Oct 5, 2023
1 parent b491cd5 commit 02c016e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,14 @@ def client
end

if current_user
user_id = current_user.id
line_uid = current_user.line_uid
else
#ログインせずpostメソッドを叩いた時,getメソッドでは出来た
user_id = params[:user_id]
line_uid = params[:line_uid]
puts "外部からentry処理を実行"
end

latest_entry_record = room.entry_records.where(user_id: user_id, exit_time: nil).order(created_at: :desc).first
latest_entry_record = room.entry_records.where(line_uid: line_uid, exit_time: nil).order(created_at: :desc).first

if latest_entry_record
puts'すでに入室しています'
Expand Down Expand Up @@ -370,13 +370,13 @@ def client
end

if current_user
user_id = current_user.id
line_uid = current_user.line_uid
else
user_id = params[:user_id]
line_uid = params[:line_uid]
puts "外部からentry処理を実行"
end
# 最後に入室した記録を取得
@latest_entry_record = room.entry_records.where(user_id: user_id, exit_time: nil).order(created_at: :desc).first
@latest_entry_record = room.entry_records.where(line_uid: line_uid, exit_time: nil).order(created_at: :desc).first

if @latest_entry_record
# 退室時間を記録
Expand Down

0 comments on commit 02c016e

Please sign in to comment.