Skip to content

Commit

Permalink
Validate user authentication and api address
Browse files Browse the repository at this point in the history
  • Loading branch information
say-yawn committed Jun 30, 2020
1 parent 093cfad commit 0be30f1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions emails/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,11 @@
def index(request):
incr_if_enabled('emails_index', 1)
request_data = get_post_data_from_request(request)
if (not request.user.is_authenticated and
not request_data.get("api_token", False)
):
is_validated_user = (
request.user.is_authenticated and
request_data.get("api_token", False)
)
if not is_validated_user:
raise PermissionDenied
if request.method == 'POST':
return _index_POST(request)
Expand Down

0 comments on commit 0be30f1

Please sign in to comment.