Add authentication

This commit is contained in:
2025-06-11 18:08:24 +02:00
parent f8523fc3eb
commit 16b27a0d1c
24 changed files with 276 additions and 22 deletions

View File

@@ -0,0 +1,16 @@
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
set_current_user || reject_unauthorized_connection
end
private
def set_current_user
if session = Session.find_by(id: cookies.signed[:session_id])
self.current_user = session.user
end
end
end
end