45 lines
2.2 KiB
HTML
45 lines
2.2 KiB
HTML
{{define "admin_users"}}{{template "header" .}}
|
|
<div class="card mb-4" style="max-width: 500px;">
|
|
<div class="card-body">
|
|
<h2 class="h6">Add user</h2>
|
|
<form method="post" action="/admin/users">
|
|
{{template "csrf_field" .CSRFToken}}
|
|
<div class="row g-2">
|
|
<div class="col-6"><input type="text" name="username" class="form-control form-control-sm" placeholder="Username" required></div>
|
|
<div class="col-6"><input type="password" name="password" class="form-control form-control-sm" placeholder="Password" minlength="8" required></div>
|
|
</div>
|
|
<div class="form-check mt-2">
|
|
<input class="form-check-input" type="checkbox" name="is_admin" id="is_admin" value="1">
|
|
<label class="form-check-label small" for="is_admin">Administrator</label>
|
|
</div>
|
|
<button type="submit" class="btn btn-primary btn-sm mt-2">Add user</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
|
|
<table class="table vs-table table-sm">
|
|
<thead><tr><th>Username</th><th>Email</th><th>Role</th><th>Status</th><th></th></tr></thead>
|
|
<tbody>
|
|
{{range .Data}}
|
|
<tr>
|
|
<td>{{.Username}}{{if .ExternalAuth}} <span class="badge text-bg-secondary">external</span>{{end}}</td>
|
|
<td class="text-secondary">{{.Email}}</td>
|
|
<td>{{if .IsAdmin}}Admin{{else}}User{{end}}</td>
|
|
<td>{{if .Disabled}}<span class="text-danger">Disabled</span>{{else}}<span class="text-success">Active</span>{{end}}</td>
|
|
<td class="text-end">
|
|
<a href="/admin/users/{{.ID}}/permissions" class="btn btn-sm btn-outline-secondary">Permissions</a>
|
|
<form method="post" action="/admin/users/{{.ID}}/toggle-disabled" class="d-inline">
|
|
{{template "csrf_field" $.CSRFToken}}
|
|
<button type="submit" class="btn btn-sm btn-outline-secondary">{{if .Disabled}}Enable{{else}}Disable{{end}}</button>
|
|
</form>
|
|
<form method="post" action="/admin/users/{{.ID}}/delete" class="d-inline" onsubmit="return confirm('Delete this user?');">
|
|
{{template "csrf_field" $.CSRFToken}}
|
|
<button type="submit" class="btn btn-sm btn-outline-danger">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{{end}}
|
|
</tbody>
|
|
</table>
|
|
{{template "footer" .}}{{end}}
|