removed the puts, initial token checking
This commit is contained in:
parent
2735cb026d
commit
f33298e762
1 changed files with 11 additions and 1 deletions
|
|
@ -4,9 +4,10 @@
|
||||||
|
|
||||||
class InvitationsController < Devise::InvitationsController
|
class InvitationsController < Devise::InvitationsController
|
||||||
|
|
||||||
|
before_filter :check_token, :only => [:edit]
|
||||||
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
puts params.inspect
|
|
||||||
begin
|
begin
|
||||||
params[:user][:aspect_id] = params[:user].delete(:aspects)
|
params[:user][:aspect_id] = params[:user].delete(:aspects)
|
||||||
self.resource = current_user.invite_user(params[resource_name])
|
self.resource = current_user.invite_user(params[resource_name])
|
||||||
|
|
@ -39,4 +40,13 @@ class InvitationsController < Devise::InvitationsController
|
||||||
redirect_to new_user_registration_path
|
redirect_to new_user_registration_path
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue