pcmt/templates/home.tmpl
surtur 1b2d860beb
All checks were successful
continuous-integration/drone/push Build is passing
fix(go,tmpl): solve the Chromium/Safari logout...
...issue by deleting the session cookie after successful password change
and forcing the user to re-authenticate.

additionally, split the InitialPasswordChange func into separate "GET"
and "POST" variants.
2023-09-04 19:21:01 +02:00

94 lines
3.8 KiB
Go HTML Template

{{ template "head.tmpl" . }}
<body class="h-screen bg-white dark:bg-gray-900">
{{ template "navbar.tmpl" . }}
<main class="grow">
<div class="px-2 md:px-0 place-items-center text-center">
{{ if and .Data .Data.flash }}
<h1 class="mt-8 text-xl text-pink-600 dark:text-pink-500 py-2">
{{ .Data.flash }}
</h1>
{{- end }}
{{ if and .Data .Data.info }}
<h2 class="mt-4 text-xl font-bold text-green-600 dark:text-green-500 py-2">
{{ .Data.info }}
</h2>
{{- end }}
{{ if .Name -}}
<h1 class="mt-14 text-2xl text-pink-400 font-bold">
Welcome to
<code class="p-1 rounded-sm border-l-2 border-fuchsia-200">
{{ .AppName }}</code>,
<code class="p-1 rounded-sm bg-fuchsia-200">
{{.Name}}</code>!
</h1>
{{if .User}}
{{if .User.IsAdmin}}
<div class="px-10 mx-16 md:mx-32">
<p class="mt-4 px-12 text-sm text-gray-500 dark:text-gray-400">
<span class="font-mono text-md">&#128712;</span> To query
the breach APIs, you need to create a <b>user-level</b>
account. To use it, log into it in another browser
(<em>not</em> just another browser window, as normally that
would share the session details of this user). User and
administrator-level accounts each have distinct
capabilities. Similarly to how it is only possible to
manage users using the administrator-level account,
browsing breach data is only allowed for user-level
accounts
<a href="https://git.dotya.ml/mirre-mt/masters-thesis/" rel="noopener"
target="_blank"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">
&#128712; learn more about this project</a>.
</p>
<p class="mt-2 text-sm text-gray-500 dark:text-gray-400">
<span class="font-mono text-md">&#128712;</span> Add a new user
<a href="/manage/users/new"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">
from here</a>, or
<a href="/manage/users"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">
view a listing of all existing users</a>.
</p>
<p class="mt-4 text-sm text-gray-500 dark:text-gray-400">
<span class="font-mono text-md">&#128712;</span> You can also view the configured API keys
<a href="/manage/api-keys"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">
here</a>.
</p>
</div>
{{else}}
<div class="px-10 mx-16 md:px-32">
<p class="mt-2 text-sm text-gray-500 dark:text-gray-400">
<span class="font-mono text-md">&#128712;</span>
Check whether your email account is a part of a breach
<a href="/user/hibp-search"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">
here</a>.
</p>
<p class="mt-2 text-sm text-gray-500 dark:text-gray-400">
<span class="font-mono text-md">&#128712;</span>
Alternatively,
<a href="https://git.dotya.ml/mirre-mt/masters-thesis/"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">
learn more</a> about this project.
</p>
</div>
{{end}}
{{end}}
<div class="mt-8 md:flex md:items-center md:place-items-center md:justify-between">
<form method="POST" class="w-full md:w-5xl" action="/logout">
<input type="hidden" name="csrf" value="{{- .CSRF -}}">
<button
class="w-full py-3 text-sm font-medium tracking-wide text-white capitalize transition-colors duration-300 transform bg-blue-500 rounded-lg md:w-1/4 hover:bg-blue-400 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-50"
type="submit">Logout</button>
</form>
</div>
{{- else }}
<h1 class="mt-20 text-2xl text-pink-400 font-bold">
Please log in.
</h1>
{{- end -}}
</div>
</main>
{{ template "footer.tmpl" . }}