From b18746e769eef8bfe144fb7d856cf11bb1528d07 Mon Sep 17 00:00:00 2001 From: Bartuccio Antoine Date: Sat, 13 Jul 2019 04:58:23 +0200 Subject: [PATCH] core: fix error 500 when accessing user tools with anonymous user --- core/views/user.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/views/user.py b/core/views/user.py index 019cda0a..5cbc2d88 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -770,6 +770,11 @@ class UserToolsView(QuickNotifMixin, UserTabsMixin, TemplateView): template_name = "core/user_tools.jinja" current_tab = "tools" + def dispatch(self, request, *args, **kwargs): + if request.user.is_anonymous: + raise PermissionDenied + return super(UserToolsView, self).dispatch(request, *args, **kwargs) + def get_context_data(self, **kwargs): self.object = self.request.user from launderette.models import Launderette