mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-03 13:19:16 -05:00
login redirect to intended page
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user