Add names to API tokens.

This commit is contained in:
2026-05-18 22:22:14 +02:00
parent 30cbb0e1c7
commit 995eca4111
6 changed files with 25 additions and 14 deletions

View File

@@ -242,7 +242,7 @@ return [
'api_token' => 'API token',
'api_tokens' => 'API tokens',
'api_token_copy_new' => 'This token is visible only once. Make sure to copy and save it now if you plan to use it later.',
'generate_new_api_token' => 'Generate new API token',
'generate_new_api_token' => 'Generate',
'inserve_url' => 'Inserve URL',
'inserve_source' => 'Inserve Configuration',
'test_connection' => 'Test Connection',

View File

@@ -242,7 +242,7 @@ return [
'api_token' => 'API token',
'api_tokens' => 'API tokens',
'api_token_copy_new' => 'Deze token is alleen nu zichtbaar, kopieer hem nu als je hem later wilt gebruiken.',
'generate_new_api_token' => 'Genereer API token',
'generate_new_api_token' => 'Genereer',
'inserve_url' => 'Inserve URL',
'inserve_source' => 'Inserve Configuratie',
'test_connection' => 'Test Connectie',

View File

@@ -275,9 +275,12 @@ if ($user_data) { ?>
<form method="POST" action="/api/v1/user/apitoken/">
<input type="hidden" name="user_uuid" value="<?php echo $user_uuid ?>">
<input type="hidden" name="_return" value="/userprofile/">
<button type="submit" href="#" class="btn btn-primary">
<i class="fa-solid fa-plus"></i> <?php echo __('generate_new_api_token') ?>
</button>
<div class="input-group mb-3">
<input type="text" name="api_token_name" class="form-control" placeholder="API Token name..." aria-label="API Token name..." aria-describedby="button-addon2">
<button type="submit" href="#" class="btn btn-success">
<i class="fa-solid fa-plus"></i> <?php echo __('generate_new_api_token') ?>
</button>
</div>
</form>
<?php } ?>
</div>
@@ -286,6 +289,7 @@ if ($user_data) { ?>
<thead>
<tr>
<th>Token id</th>
<th>Token Name</th>
<th>Expiration</th>
<th>Created</th>
<th>Last used</th>
@@ -300,11 +304,12 @@ if ($user_data) { ?>
<div class="text-truncate" style="max-width: 200px;" id="<?php echo $token_data['api_token_uuid'] ?>" data-copy-data="<?php echo $token_data['api_token_uuid']; ?>">
<?php echo $token_data['api_token_uuid']; ?>
</div>
<button type="button" class="btn btn-sm btn-outline-secondary" data-copy-target="<?php echo $token_data['api_token_uuid'] ?>" title="Copy Token">
<button type="button" class="btn btn-sm btn-outline-secondary" data-copy-target="<?php echo $token_data['api_token_uuid'] ?>" title="Copy ID">
<i class="fa-solid fa-copy"></i>
</button>
</div>
</td>
<td><?php echo $token_data['api_token_name'] ?></td>
<td><?php showTime($token_data['api_token_expiration_timestamp']) ?></td>
<td><?php showTime($token_data['api_token_created_timestamp']) ?></td>
<td><?php showTime($token_data['api_token_last_used_timestamp']) ?></td>