core: fix error 500 when accessing user tools with anonymous user

This commit is contained in:
Antoine Bartuccio 2019-07-13 04:58:23 +02:00
parent a2b431b1ab
commit b18746e769
Signed by: klmp200
GPG Key ID: E7245548C53F904B

View File

@ -770,6 +770,11 @@ class UserToolsView(QuickNotifMixin, UserTabsMixin, TemplateView):
template_name = "core/user_tools.jinja" template_name = "core/user_tools.jinja"
current_tab = "tools" 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): def get_context_data(self, **kwargs):
self.object = self.request.user self.object = self.request.user
from launderette.models import Launderette from launderette.models import Launderette