2023-02-04 14:04:35 +01:00
|
|
|
module ApplicationCable
|
|
|
|
class Connection < ActionCable::Connection::Base
|
2023-02-05 21:01:07 +01:00
|
|
|
identified_by :current_user
|
|
|
|
|
|
|
|
def connect
|
|
|
|
self.current_user = find_verified_user
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
def find_verified_user
|
|
|
|
if (verified_user = env['warden'].user)
|
|
|
|
verified_user
|
|
|
|
else
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
2023-02-04 14:04:35 +01:00
|
|
|
end
|
|
|
|
end
|