app/controllers/devise/invitations_controller.rb in devise_invitable-2.0.0 vs app/controllers/devise/invitations_controller.rb in devise_invitable-2.0.1
- old
+ new
@@ -49,11 +49,11 @@
invitation_accepted = resource.errors.empty?
yield resource if block_given?
if invitation_accepted
- if Devise.allow_insecure_sign_in_after_accept
+ if resource.class.allow_insecure_sign_in_after_accept
flash_message = resource.active_for_authentication? ? :updated : :updated_not_active
set_flash_message :notice, flash_message if is_flashing_format?
sign_in(resource_name, resource)
respond_with resource, location: after_accept_path_for(resource)
else
@@ -73,44 +73,44 @@
redirect_to after_sign_out_path_for(resource_name)
end
protected
- def invite_resource(&block)
- resource_class.invite!(invite_params, current_inviter, &block)
- end
+ def invite_resource(&block)
+ resource_class.invite!(invite_params, current_inviter, &block)
+ end
- def accept_resource
- resource_class.accept_invitation!(update_resource_params)
- end
+ def accept_resource
+ resource_class.accept_invitation!(update_resource_params)
+ end
- def current_inviter
- authenticate_inviter!
- end
+ def current_inviter
+ authenticate_inviter!
+ end
- def has_invitations_left?
- unless current_inviter.nil? || current_inviter.has_invitations_left?
- self.resource = resource_class.new
- set_flash_message :alert, :no_invitations_remaining if is_flashing_format?
- respond_with_navigational(resource) { render :new }
+ def has_invitations_left?
+ unless current_inviter.nil? || current_inviter.has_invitations_left?
+ self.resource = resource_class.new
+ set_flash_message :alert, :no_invitations_remaining if is_flashing_format?
+ respond_with_navigational(resource) { render :new }
+ end
end
- end
- def resource_from_invitation_token
- unless params[:invitation_token] && self.resource = resource_class.find_by_invitation_token(params[:invitation_token], true)
- set_flash_message(:alert, :invitation_token_invalid) if is_flashing_format?
- redirect_to after_sign_out_path_for(resource_name)
+ def resource_from_invitation_token
+ unless params[:invitation_token] && self.resource = resource_class.find_by_invitation_token(params[:invitation_token], true)
+ set_flash_message(:alert, :invitation_token_invalid) if is_flashing_format?
+ redirect_to after_sign_out_path_for(resource_name)
+ end
end
- end
- def invite_params
- devise_parameter_sanitizer.sanitize(:invite)
- end
+ def invite_params
+ devise_parameter_sanitizer.sanitize(:invite)
+ end
- def update_resource_params
- devise_parameter_sanitizer.sanitize(:accept_invitation)
- end
+ def update_resource_params
+ devise_parameter_sanitizer.sanitize(:accept_invitation)
+ end
- def translation_scope
- 'devise.invitations'
- end
+ def translation_scope
+ 'devise.invitations'
+ end
end