Skip to content

Commit

Permalink
Update pusher_controller.rb
Browse files Browse the repository at this point in the history
prevent other users from subscribing to private channel of current user
  • Loading branch information
longkt90 committed Aug 5, 2013
1 parent 3eddfbb commit c302b1c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/controllers/pusher_controller.rb
Expand Up @@ -2,11 +2,11 @@ class PusherController < ApplicationController
protect_from_forgery :except => :auth # stop rails CSRF protection for this action

def auth
if current_user
if current_user && params[:channel_name] == "private-#{current_user.id}"
response = Pusher[params[:channel_name]].authenticate(params[:socket_id])
render :json => response
else
render :text => "Not authorized", :status => '403'
end
end
end
end

0 comments on commit c302b1c

Please sign in to comment.