- Introduced `web/templates/` for HTMX-fragmented pages (`dashboard`, `accounts`, `account_detail`, `error_fragment`, etc.). - Implemented UI routes for account CRUD, audit log display, and login/logout with CSRF protection. - Added `internal/ui/` package for handlers, CSRF manager, session validation, and token issuance. - Updated documentation to include new UI features and templates directory structure. - Security: Double-submit CSRF cookies, constant-time HMAC validation, login password/Argon2id re-verification at all steps to prevent bypass.
40 lines
1.6 KiB
HTML
40 lines
1.6 KiB
HTML
{{define "account_row"}}
|
|
<tr id="account-row-{{.UUID}}">
|
|
<td><a href="/accounts/{{.UUID}}">{{.Username}}</a></td>
|
|
<td class="text-small text-muted">{{.AccountType}}</td>
|
|
<td>
|
|
<span class="badge {{if eq (string .Status) "active"}}badge-active{{else if eq (string .Status) "inactive"}}badge-inactive{{else}}badge-deleted{{end}}">
|
|
{{.Status}}
|
|
</span>
|
|
</td>
|
|
<td class="text-small text-muted">{{if .TOTPRequired}}Yes{{else}}No{{end}}</td>
|
|
<td class="text-small text-muted">{{formatTime .CreatedAt}}</td>
|
|
<td>
|
|
<div class="d-flex gap-1">
|
|
<a class="btn btn-sm btn-secondary" href="/accounts/{{.UUID}}">View</a>
|
|
{{if eq (string .Status) "active"}}
|
|
<button class="btn btn-sm btn-secondary"
|
|
hx-patch="/accounts/{{.UUID}}/status"
|
|
hx-vals='{"status":"inactive"}'
|
|
hx-target="#account-row-{{.UUID}}"
|
|
hx-swap="outerHTML"
|
|
hx-confirm="Deactivate this account?">Deactivate</button>
|
|
{{else if eq (string .Status) "inactive"}}
|
|
<button class="btn btn-sm btn-secondary"
|
|
hx-patch="/accounts/{{.UUID}}/status"
|
|
hx-vals='{"status":"active"}'
|
|
hx-target="#account-row-{{.UUID}}"
|
|
hx-swap="outerHTML">Activate</button>
|
|
{{end}}
|
|
{{if ne (string .Status) "deleted"}}
|
|
<button class="btn btn-sm btn-danger"
|
|
hx-delete="/accounts/{{.UUID}}"
|
|
hx-target="#account-row-{{.UUID}}"
|
|
hx-swap="outerHTML"
|
|
hx-confirm="Permanently delete this account? This cannot be undone.">Delete</button>
|
|
{{end}}
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|