mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-04-24 20:31:42 +02:00
29 lines
717 B
Svelte
29 lines
717 B
Svelte
<script>
|
|
import { Button } from 'sveltestrap'
|
|
|
|
export let user
|
|
let jwt = ""
|
|
|
|
function getUserJwt(username) {
|
|
fetch(`/api/jwt/?username=${username}`)
|
|
.then(res => res.text())
|
|
.then(text => {
|
|
jwt = text
|
|
navigator.clipboard.writeText(text).catch(reason => console.error(reason))
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<td>{user.username}</td>
|
|
<td>{user.name}</td>
|
|
<td>{user.projects}</td>
|
|
<td>{user.email}</td>
|
|
<td><code>{user.roles.join(', ')}</code></td>
|
|
<td>
|
|
{#if ! jwt}
|
|
<Button color="success" on:click={getUserJwt(user.username)}>Gen. JWT</Button>
|
|
{:else}
|
|
<textarea rows="3" cols="20">{jwt}</textarea>
|
|
{/if}
|
|
</td>
|