You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 lines
1.8 KiB

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Users - CamMonitor</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="min-h-screen bg-slate-950 p-6 text-slate-100">
<main class="mx-auto max-w-3xl space-y-6">
<header class="flex items-center justify-between">
<h1 class="text-2xl font-semibold">Users</h1>
<form method="post" action="/logout"><button class="rounded bg-slate-800 px-3 py-2">Sign out</button></form>
</header>
<form method="post" action="/admin/users" class="grid gap-3 md:grid-cols-[1fr_1fr_auto_auto]">
<input name="username" placeholder="Username" class="rounded bg-slate-900 px-3 py-2 ring-1 ring-slate-700">
<input name="password" type="password" placeholder="Password" class="rounded bg-slate-900 px-3 py-2 ring-1 ring-slate-700">
<label class="flex items-center gap-2 text-sm"><input name="is_admin" type="checkbox"> Admin</label>
<button class="rounded bg-indigo-500 px-3 py-2 font-medium text-white">Add</button>
</form>
<table class="w-full border-collapse text-left">
<thead><tr class="border-b border-slate-800"><th class="py-2">Username</th><th class="py-2">Role</th><th class="py-2"></th></tr></thead>
<tbody>
{{range .Users}}
<tr class="border-b border-slate-900">
<td class="py-2">{{.Username}}</td>
<td class="py-2">{{if .IsAdmin}}admin{{else}}user{{end}}</td>
<td class="py-2 text-right">
<form method="post" action="/admin/users/{{.ID}}/delete">
<button class="rounded bg-slate-800 px-3 py-1">Delete</button>
</form>
</td>
</tr>
{{end}}
</tbody>
</table>
</main>
</body>
</html>