forked from github/plane
dev: enable api key authentication
This commit is contained in:
parent
7f521da889
commit
7a550dd2f7
@ -23,7 +23,7 @@ class CheckoutEndpoint(BaseAPIView):
|
||||
license = License.objects.first()
|
||||
|
||||
if license is None:
|
||||
return Response({"error": "Instance is not activated"}, status=status.HTTP_400_BAD_REQUEST)
|
||||
return Response({"error": "Instance is not activated"}, status=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
|
||||
price_id = request.data.get("price_id", False)
|
||||
|
@ -68,7 +68,7 @@ class InstanceEndpoint(BaseAPIView):
|
||||
license = License.objects.first()
|
||||
|
||||
if license is None:
|
||||
return Response({"activated": False}, status=status.HTTP_200_OK)
|
||||
return Response({"activated": False}, status=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
data = {
|
||||
"instance_id": license.instance_id,
|
||||
|
@ -20,17 +20,19 @@ class ProductEndpoint(BaseAPIView):
|
||||
if license is None:
|
||||
return Response(
|
||||
{"error": "Instance is not activated"},
|
||||
status=status.HTTP_400_BAD_REQUEST,
|
||||
status=status.HTTP_403_FORBIDDEN,
|
||||
)
|
||||
|
||||
# # Request the licensing engine
|
||||
headers = {
|
||||
"x-api-key": license.api_key,
|
||||
}
|
||||
|
||||
response = requests.get(
|
||||
f"{LICENSE_ENGINE_BASE_URL}/api/products",
|
||||
headers={
|
||||
"X-Api-Key": license.api_key,
|
||||
},
|
||||
headers=headers,
|
||||
)
|
||||
|
||||
if response.status_code == 200:
|
||||
return Response(response.json(), status=status.HTTP_200_OK)
|
||||
return Response(
|
||||
|
Loading…
Reference in New Issue
Block a user