Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions django_basic_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def view_or_basicauth(view, request, test_func, realm = "", *args, **kwargs):
request.user = user
if test_func(request.user):
return view(request, *args, **kwargs)
else:
# successfully authenticated but no permission
return HttpResponse(status=403)

# Either they did not provide an authorization header or
# something in the authorization attempt failed. Send a 401
Expand Down