forked from github/plane
fix: make api token only view once (#382)
This commit is contained in:
parent
0bd3e8ae95
commit
1a04eda613
@ -5,4 +5,10 @@ from plane.db.models import APIToken
|
|||||||
class APITokenSerializer(BaseSerializer):
|
class APITokenSerializer(BaseSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = APIToken
|
model = APIToken
|
||||||
fields = "__all__"
|
fields = [
|
||||||
|
"label",
|
||||||
|
"user",
|
||||||
|
"user_type",
|
||||||
|
"workspace",
|
||||||
|
"created_at",
|
||||||
|
]
|
||||||
|
@ -28,7 +28,11 @@ class ApiTokenEndpoint(BaseAPIView):
|
|||||||
)
|
)
|
||||||
|
|
||||||
serializer = APITokenSerializer(api_token)
|
serializer = APITokenSerializer(api_token)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED)
|
# Token will be only vissible while creating
|
||||||
|
return Response(
|
||||||
|
{"api_token": serializer.data, "token": api_token.token},
|
||||||
|
status=status.HTTP_201_CREATED,
|
||||||
|
)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
capture_exception(e)
|
capture_exception(e)
|
||||||
|
Loading…
Reference in New Issue
Block a user