Guest User

Untitled

a guest
Nov 14th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. module ApplicationCable
  2. class Connection < ActionCable::Connection::Base
  3. identified_by :current_user
  4.  
  5. def connect
  6. self.current_user = find_verified_user
  7. end
  8.  
  9. def disconnect
  10.  
  11. end
  12. protected
  13.  
  14. def find_verified_user
  15. if verified_user = request.env['warden'].user
  16. verified_user
  17. else
  18. reject_unauthorized_connection
  19. end
  20. end
  21. end
  22. end
Add Comment
Please, Sign In to add comment