Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
Fix infinite redirect when logged in
Browse files Browse the repository at this point in the history
By default the `permission_required` decorator redirects
to the login url when you don't have sufficient permissions.
The result of this is if a user navigates to a page they
don't have permission to view they end up in an infinite
redirect loop between the forbidden page and the login page.

This change will allow logged out users a chance to login but
return forbidden when you don't have sufficient permissions.
  • Loading branch information
gmjosack authored and ObserverOfTime committed Jan 4, 2021
1 parent a65b7bb commit 20c8d69
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions commentary/views/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def flag(request, comment_id, next=None):


@csrf_protect
@login_required
@permission_required('commentary.can_moderate')
def delete(request, comment_id, next=None):
"""
Expand All @@ -65,6 +66,7 @@ def delete(request, comment_id, next=None):


@csrf_protect
@login_required
@permission_required("commentary.can_moderate")
def approve(request, comment_id, next=None):
"""
Expand Down

0 comments on commit 20c8d69

Please sign in to comment.