pcmt/templates/manage/user.tmpl
surtur 6b45213649
All checks were successful
continuous-integration/drone/push Build is passing
go: add user onboarding, HIBP search functionality
* add user onboarding workflow
* fix user editing (no edits of passwords of regular users after
  onboarding)
* refresh HIBP breach cache in DB on app start-up
* display HIBP breach details
* fix request scheduling to prevent panics (this still needs some love..)
* fix middleware auth
* add TODOs
* update head.tmpl
* reword some error messages
2023-08-24 18:43:24 +02:00

77 lines
2.8 KiB
Go HTML Template

{{ template "head.tmpl" . }}
<body class="min-h-screen flex flex-col justify-between bg-white dark:bg-gray-900">
{{ template "navbar.tmpl" . }}
<main class="grow mb-auto">
<div class="container mx-auto place-items-center px-8">
{{ if and .Data .Data.flash }}
<h1 class="text-xl text-pink-600 dark:text-pink-500 py-2">
{{ .Data.flash }}
</h1>
{{- end }}
<div class="flex justify-between place-items-center">
<h1 class="text-xl text-fuchsia-600 dark:text-fuchsia-400 capitalize py-2">
Manage users
</h1>
<a href="/manage/users/new" class="w-auto py-1 mt-2 text-center text-blue-500 md:mt-0 md:mx-6 lg:mx-4 hover:underline dark:text-blue-400">
New user
</a>
</div>
<div class="p-2 mt-3 border-2 dark:border-slate-500 rounded-sm overflow-x-auto">
<table class="text-center text-gray-500 dark:text-gray-300 w-full striped">
<thead>
<tr>
<th scope="col" class="md:p-2 sm:p-0 text-slate-600 dark:text-slate-400">Username</th>
<th scope="col" class="md:p-2 sm:p-0 text-left text-slate-600 dark:text-slate-400">Email</th>
<th scope="col" class="md:p-2 sm:p-0 text-left px-2 text-slate-600 dark:text-slate-400">Last login</th>
<th scope="col" class="md:p-2 sm:p-0 text-left px-2 text-slate-600 dark:text-slate-400">Created</th>
<th scope="col" class="md:p-2 sm:p-0 sm:px-1 text-slate-600 dark:text-slate-400">Admin</th>
<th scope="col" class="md:p-2 sm:p-0 text-slate-600 dark:text-slate-400">Active</th>
</tr>
</thead>
<tbody>
{{ $users := index .Data.allusers }}
{{ range $_, $u := $users }}
<tr class="border-t border-gray-300 dark:border-slate-600 hover:outline hover:outline-1 hover:outline-pink-300 dark:hover:outline-pink-400">
<td class="text-center text-ellipsis">
<span class="p-2 font-bold text-purple-500 dark:text-purple-400 hover:text-purple-700 dark:hover:text-purple-500 hover:underline">
<a href="/manage/users/{{ $u.ID }}">{{ $u.Username }}</a>
</span>
</td>
<td class="text-left">
<span class="p-2 font-mono select-all">
{{- $u.Email -}}
</span>
</td>
<td class="text-left">
<span class="p-2 font-mono select-all">
{{ if usrFinishedSetup $u.LastLogin }}
{{- $u.LastLogin -}}
{{- else -}}
never
{{- end -}}
</span>
</td>
<td class="text-left">
<span class="p-2 text-sm mx-auto font-mono">
{{- $u.CreatedAt -}}
</span>
</td>
<td class="text-center text-slate-400">
<span class="p-2">
{{- if $u.IsAdmin -}}{{- else -}}{{- end -}}
</span>
</td>
<td class="text-center text-slate-400">
<span class="p-2">
{{- if $u.IsActive -}}{{- else -}}{{- end -}}
</span>
</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
</main>
{{ template "footer.tmpl" . }}