diff --git a/cookbook/helper/permission_helper.py b/cookbook/helper/permission_helper.py index 794107f18..4b104efe5 100644 --- a/cookbook/helper/permission_helper.py +++ b/cookbook/helper/permission_helper.py @@ -120,8 +120,8 @@ class GroupRequiredMixin(object): def dispatch(self, request, *args, **kwargs): if not has_group_permission(request.user, self.groups_required): - messages.add_message(request, messages.ERROR, _('You do not have the required permissions to view this page!')) - return HttpResponseRedirect(reverse_lazy('index')) + messages.add_message(request, messages.ERROR, _('You are not logged in and therefore cannot view this page!')) + return HttpResponseRedirect(reverse_lazy('account_login') + '?next=' + request.path) try: obj = self.get_object() diff --git a/cookbook/views/views.py b/cookbook/views/views.py index a892fab30..47b6af51a 100644 --- a/cookbook/views/views.py +++ b/cookbook/views/views.py @@ -107,7 +107,8 @@ def no_space(request): def no_perm(request): if not request.user.is_authenticated: - return HttpResponseRedirect(reverse('index')) + messages.add_message(request, messages.ERROR, _('You are not logged in and therefore cannot view this page!')) + return HttpResponseRedirect(reverse('account_login') + '?next=' + request.GET.get('next', '/search/')) return render(request, 'no_perm_info.html')