【发布时间】:2015-10-04 07:30:47
【问题描述】:
在下面的代码中,未经授权如何发出403?
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")
【问题讨论】:
标签: django