pcmt/templates/manage/apikeys.tmpl
surtur 5d494fca8d
All checks were successful
continuous-integration/drone/push Build is passing
go,tmpl(api-keys): add tooltips, disable buttons
2023-09-04 15:00:41 +02:00

104 lines
6.3 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 md:px-12 lg:px-14">
{{ if and .Data .Data.flash }}
<h1 class="text-xl text-pink-600 dark:text-pink-500 py-2">
{{ .Data.flash }}
</h1>
<hr class="md:px-14 md:mx-24">
{{- else -}}{{end}}
<h1 class="text-xl text-fuchsia-600 dark:text-fuchsia-400 capitalize py-2">
Manage Your API keys
</h1>
<div class="p-2 mx-auto mt-8 lg:max-w-5xl lg:mt-0 block">
{{- $hibpK := .Data.hibpApiKey -}}
<!-- hibp form -->
<form method="post" class="w-full lg:max-w-7xl px-2">
<input type="hidden" name="csrf" value="{{- .CSRF -}}">
<div class="items-center">
<label for="hibpApiKey" class="text-purple-500 font-bold">
Have I Been Pwned?
</label>
<input name="hibpApiKey" type="text"
placeholder="HIBP API key" {{if $hibpK}}value="{{$hibpK}}"{{end}}
autofocus
disabled
class="py-3 px-8 mt-2 w-full valid:border text-gray-500 bg-white border rounded-lg dark:bg-gray-900 dark:text-gray-300 dark:valid:border-gray-600 focus:border-blue-400 dark:focus:border-blue-300 focus:ring-blue-300 focus:outline-none focus:ring focus:ring-opacity-40">
<p id="hibp-expl"
class="group relative hover:cursor-help mt-2 text-sm text-gray-500 dark:text-gray-400">
Adds support for querying Troy Hunt's
<a href="https://haveibeenpwned.com/API/v3"
class="font-medium text-blue-600 hover:underline dark:text-blue-500">Have I Been Pwned? API
</a>
<span
class="absolute hidden group-hover:flex -left-5 -top-2 -translate-y-full w-48 px-2 py-1 bg-gray-700 rounded-lg text-center text-white text-sm after:content-[''] after:absolute after:left-1/2 after:top-[100%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-b-transparent after:border-t-gray-700">
The input field reflects the value of $PCMT_HIBP_API_KEY environment variable.
</span>
</p>
</div>
<div class="group relative mt-4 block md:flex md:items-center place-items-end space-x-0 md:space-x-2">
<span
class="absolute hidden group-hover:flex -left-5 -top-2 -translate-y-full w-48 px-2 py-1 bg-gray-700 rounded-lg text-center text-white text-sm after:content-[''] after:absolute after:left-1/2 after:top-[100%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-b-transparent after:border-t-gray-700">
These buttons currently don't perform any actions. The key view is currently read-only.
</span>
<button
disabled
class="px-2 py-3 w-full md:w-auto text-sm font-medium tracking-wide text-white transition-colors duration-300 transform bg-blue-500 rounded-lg hover:bg-blue-400 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-50">
Save
</button>
<button
disabled {{if not $hibpK}}{{end}}
class="{{if not $hibpK}}cursor-not-allowed{{else}}transition-colors duration-300 transform hover:bg-gray-400 focus:outline-none focus:ring focus:ring-gray-300 focus:ring-opacity-50{{end}} px-2 py-3 mt-2 md:mt-0 w-full md:w-auto text-sm font-medium tracking-wide text-white bg-gray-500 rounded-lg">
Test key
</button>
</div>
</form>
<hr class="py-2 md:px-14 mt-4 lg:mx-22 sm:max-w-1/2">
{{- $dehashedK := .Data.dehashedApiKey -}}
<!-- dehashed.com form -->
<form method="post" class="w-full lg:max-w-7xl px-2">
<input type="hidden" name="csrf" value="{{- .CSRF -}}">
<div class="items-center">
<label for="dehashed-api-key" class="text-purple-500 font-bold">
DeHashed.com
</label>
<input name="dehashed-api-key" type="text"
placeholder="DeHashed.com API key" {{if $dehashedK}}value="{{$dehashedK}}"{{end}}
autofocus
disabled
class="py-3 px-8 mt-2 w-full valid:border text-gray-500 bg-white border rounded-lg dark:bg-gray-900 dark:text-gray-300 dark:valid:border-gray-600 focus:border-blue-400 dark:focus:border-blue-300 focus:ring-blue-300 focus:outline-none focus:ring focus:ring-opacity-40"
aria-described-by="dehashed-expl">
<p id="dehashed-expl" class="group relative hover:cursor-help mt-2 text-sm text-gray-500 dark:text-gray-400">Adds support for querying <a href="https://dehashed.com/" class="font-medium text-blue-600 hover:underline dark:text-blue-500">DeHashed API</a>
<span
class="absolute hidden group-hover:flex -left-5 -top-2 -translate-y-full w-54 px-2 py-1 bg-gray-700 rounded-lg text-center text-white text-sm after:content-[''] after:absolute after:left-1/2 after:top-[100%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-b-transparent after:border-t-gray-700">
Support for dehashed.com is coming up. The input field will reflect the value of $PCMT_DEHASHED_API_KEY environment variable.
</span>
</p>
</div>
<div class="group relative mt-4 block md:flex md:items-center place-items-end space-x-0 md:space-x-2">
<span
class="absolute hidden group-hover:flex -left-5 -top-2 -translate-y-full w-48 px-2 py-1 bg-gray-700 rounded-lg text-center text-white text-sm after:content-[''] after:absolute after:left-1/2 after:top-[100%] after:-translate-x-1/2 after:border-8 after:border-x-transparent after:border-b-transparent after:border-t-gray-700">
These buttons currently don't perform any actions.
</span>
<button
disabled
class="px-2 py-3 w-full md:w-auto text-sm font-medium tracking-wide text-white transition-colors duration-300 transform bg-blue-500 rounded-lg hover:bg-blue-400 focus:outline-none focus:ring focus:ring-blue-300 focus:ring-opacity-50">
Save
</button>
<button
disabled {{if not $dehashedK}}{{end}}
class="{{if not $dehashedK}}cursor-not-allowed{{else}}transition-colors duration-300 transform hover:bg-gray-400 focus:outline-none focus:ring focus:ring-gray-300 focus:ring-opacity-50{{end}} px-2 py-3 mt-2 md:mt-0 w-full md:w-auto text-sm font-medium tracking-wide text-white bg-gray-500 rounded-lg">
Test key
</button>
</div>
</form>
</div>
</div>
</main>
{{ template "footer.tmpl" . }}