login redirect to intended page

This commit is contained in:
smilerz
2021-04-17 18:34:56 -05:00
parent 880db58d38
commit 49fb1e7183
2 changed files with 4 additions and 3 deletions

View File

@@ -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()

View File

@@ -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')