Generated authentication

This commit is contained in:
2025-06-21 23:26:05 +03:00
parent c2920708ab
commit 02be5a53d6
20 changed files with 210 additions and 1 deletions
@@ -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