From f33298e76288b7efca0f54d5d61e7aba227e364f Mon Sep 17 00:00:00 2001 From: ilya <ilya@laptop.(none)> Date: Sat, 16 Oct 2010 00:42:37 -0700 Subject: [PATCH] removed the puts, initial token checking --- app/controllers/invitations_controller.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/app/controllers/invitations_controller.rb b/app/controllers/invitations_controller.rb index ab1574347f..ab9939a112 100644 --- a/app/controllers/invitations_controller.rb +++ b/app/controllers/invitations_controller.rb @@ -4,9 +4,10 @@ class InvitationsController < Devise::InvitationsController + before_filter :check_token, :only => [:edit] + def create - puts params.inspect begin params[:user][:aspect_id] = params[:user].delete(:aspects) self.resource = current_user.invite_user(params[resource_name]) @@ -39,4 +40,13 @@ class InvitationsController < Devise::InvitationsController redirect_to new_user_registration_path end end + + protected + + def check_token + if User.find_by_invitation_token(params['invitation_token']).nil? + flash[:error] = "Invitation token not found" + redirect_to root_url + end + end end -- GitLab