Files
kiddo/project-management/feedback/templates/user_tokens.html

100 lines
4.6 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Tokens</title>
<link rel="stylesheet" href="/static/styles.css">
</head>
<body>
<div class="container">
<header>
<h1>Initial Access Tokens</h1>
<p>Logged in as: <strong>{{ user.username }}</strong></p>
</header>
{% if message %}
<div class="import-results success" style="max-width: 100%; margin-bottom: 16px;">
{{ message }}
</div>
{% endif %}
{% if new_token %}
<div class="import-results warning" style="max-width: 100%; margin-bottom: 16px; word-break: break-all;">
New Token (copy now): <code>{{ new_token }}</code>
</div>
{% endif %}
{% if error %}
<div class="import-results" style="background: #3b1a1a; color: #f0b6b6; max-width: 100%; margin-bottom: 16px;">
{{ error }}
</div>
{% endif %}
<div class="modal-content" style="max-width: 640px; margin: 0 auto;">
<h2>Create Initial Access Token</h2>
<form method="POST">
<div class="form-group">
<label>Scope</label>
<input type="text" name="scope" value="dcr:register">
</div>
<div class="form-group">
<label>TTL (days)</label>
<input type="number" name="ttl_days" value="365" min="1" max="3650">
</div>
<button type="submit">Create Token</button>
<a href="/dashboard" style="margin-left: 8px;">Back</a>
</form>
</div>
<div class="table-container" style="margin-top: 24px;">
<table>
<thead>
<tr>
<th>Token</th>
<th>Scope</th>
<th>Expires</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for token in tokens %}
<tr>
<td style="max-width: 320px; word-break: break-all;"><code>{{ token.token }}</code></td>
<td>{{ token.scope }}</td>
<td>{{ token.expires_at.strftime('%Y-%m-%d') }}</td>
<td>
{% if token.revoked %}
<span class="status-badge status-retired">Revoked</span>
{% elif token.is_valid %}
<span class="status-badge status-available">Valid</span>
{% else %}
<span class="status-badge status-retired">Expired</span>
{% endif %}
</td>
<td>
<form method="POST" action="/my-tokens/{{ token.id }}" style="display: inline-block; margin-right: 6px;">
<input type="hidden" name="action" value="revoke">
<button type="submit" class="danger" style="padding: 6px 10px; font-size: 0.8rem;">Revoke</button>
</form>
<form method="POST" action="/my-tokens/{{ token.id }}" style="display: inline-block; margin-right: 6px;">
<input type="hidden" name="action" value="update">
<input type="text" name="scope" value="{{ token.scope }}" style="width: 140px; font-size: 0.8rem;" aria-label="Scope">
<input type="number" name="ttl_days" value="365" min="1" max="3650" style="width: 70px; font-size: 0.8rem;" aria-label="TTL days">
<button type="submit" class="secondary" style="padding: 6px 10px; font-size: 0.8rem;">Update</button>
</form>
<form method="POST" action="/my-tokens/{{ token.id }}" style="display: inline-block;">
<input type="hidden" name="action" value="delete">
<button type="submit" class="danger" style="padding: 6px 10px; font-size: 0.8rem;" onclick="return confirm('Delete this token?');">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</body>
</html>