feat(site): add ability to create tokens from account tokens page (#6608)

* add token actions

* added basic token form

* removed token switch

* refined date field

* limiting lifetime days to maxTokenLifetime

* broke apart files

* added loader and error

* fixed form layout

* added some unit tests

* fixed be tests

* no authorize check
This commit is contained in:
Kira Pilot
2023-03-16 08:25:08 -07:00
committed by GitHub
parent af618477bd
commit 811a69f371
27 changed files with 737 additions and 131 deletions
+37
View File
@@ -516,3 +516,40 @@ curl -X GET http://coder-server:8080/api/v2/updatecheck \
| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ---------------------------------------------------------------------- |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.UpdateCheckResponse](schemas.md#codersdkupdatecheckresponse) |
## Get token config
### Code samples
```shell
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{user}/keys/tokens/tokenconfig \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'
```
`GET /users/{user}/keys/tokens/tokenconfig`
### Parameters
| Name | In | Type | Required | Description |
| ------ | ---- | ------ | -------- | -------------------- |
| `user` | path | string | true | User ID, name, or me |
### Example responses
> 200 Response
```json
{
"max_token_lifetime": 0
}
```
### Responses
| Status | Meaning | Description | Schema |
| ------ | ------------------------------------------------------- | ----------- | ------------------------------------------------------ |
| 200 | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | OK | [codersdk.TokenConfig](schemas.md#codersdktokenconfig) |
To perform this operation, you must be authenticated. [Learn more](authentication.md).
+14
View File
@@ -3840,6 +3840,20 @@ Parameter represents a set value for the scope.
| `type` | `number` |
| `type` | `bool` |
## codersdk.TokenConfig
```json
{
"max_token_lifetime": 0
}
```
### Properties
| Name | Type | Required | Restrictions | Description |
| -------------------- | ------- | -------- | ------------ | ----------- |
| `max_token_lifetime` | integer | false | | |
## codersdk.TraceConfig
```json