In the following code how to issue 403 for unauthorized?
user = authenticate(username=username, password=password)
if user is not None:
# the password verified for the user
if user.is_active:
print("User is valid, active and authenticated")
return HttpResponse("Authorized")
else:
print("The password is valid, but the account has been disabled!")
return HttpResponse("Unauthorized")
else:
# the authentication system was unable to verify the username and password
print("The username and password were incorrect.")
return HttpResponse("Unauthorized")