闭社主体 forked from https://github.com/tootsuite/mastodon
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
398 B

  1. module ApplicationCable
  2. class Connection < ActionCable::Connection::Base
  3. identified_by :current_user
  4. def connect
  5. self.current_user = find_verified_user
  6. end
  7. protected
  8. def find_verified_user
  9. catch :warden do
  10. verified_user = env['warden'].user
  11. return verified_user if verified_user
  12. end
  13. reject_unauthorized_connection
  14. end
  15. end
  16. end