Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Only logged in users can acces the user detail page

Roland Geider7bb213be2b18
diff --git a/wger/core/views/user.py b/wger/core/views/user.py
index 569c53dba..f9de7218c 100644
--- a/wger/core/views/user.py
+++ b/wger/core/views/user.py
@@ -365,7 +365,8 @@ class UserDetailView(WgerPermissionMixin, DetailView):
'''
Only managers for this gym can access the members
'''
- if request.user.userprofile.gym == self.get_object().userprofile.gym:
+ user = request.user
+ if user.is_authenticated() and user.userprofile.gym == self.get_object().userprofile.gym:
return super(UserDetailView, self).dispatch(request, *args, **kwargs)
else:
return HttpResponseForbidden()