From cf759dbb2f0ce867806194f4b612e3a3dcab7698 Mon Sep 17 00:00:00 2001 From: Karl Hobley Date: Wed, 12 Mar 2014 15:40:34 +0000 Subject: [PATCH] Don't render edit bird if user is not logged in --- wagtail/wagtailadmin/edit_bird.py | 4 ++++ wagtail/wagtailadmin/templatetags/wagtail_edit_bird.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wagtail/wagtailadmin/edit_bird.py b/wagtail/wagtailadmin/edit_bird.py index 1bdff2f1f1..cb1decc494 100644 --- a/wagtail/wagtailadmin/edit_bird.py +++ b/wagtail/wagtailadmin/edit_bird.py @@ -28,6 +28,10 @@ class EditPageItem(BaseItem): def render_edit_bird(request, items): + # Don't render if the user is not logged in + if not request.user.is_authenticated(): + return + # Render the items rendered_items = [item.render(request) for item in items] diff --git a/wagtail/wagtailadmin/templatetags/wagtail_edit_bird.py b/wagtail/wagtailadmin/templatetags/wagtail_edit_bird.py index 13fe4a6326..1112517bff 100644 --- a/wagtail/wagtailadmin/templatetags/wagtail_edit_bird.py +++ b/wagtail/wagtailadmin/templatetags/wagtail_edit_bird.py @@ -29,4 +29,4 @@ def wagtail_edit_bird(context, current_page=None, items=None): fn(request, items) # Render edit bird - return edit_bird.render_edit_bird(request, items) + return edit_bird.render_edit_bird(request, items) or ''