opengist/templates/pages/totp.html

55 lines
2.7 KiB
HTML
Raw Normal View History

2024-10-24 21:23:00 +00:00
{{ template "header" .}}
<div class="py-10">
<header class="pb-4">
<div>
<h1 class="text-2xl font-bold leading-tight">{{ .locale.Tr "auth.totp" }}</h1>
</div>
</header>
<main>
{{ if .recoveryCodes }}
<p class="mb-4">{{ .locale.Tr "auth.totp.save-recovery-codes" }}</p>
<div class="mt-8 sm:w-full sm:max-w-md mx-auto flex">
<div class="mx-auto bg-white dark:bg-gray-900 rounded-md border border-1 border-gray-200 dark:border-gray-700 py-8 px-4 shadow sm:rounded-lg sm:px-10">
<ul class="list-none">
<code>
{{ range .recoveryCodes }}
<li>{{ . }}</li>
{{ end }}
</code>
</ul>
</div>
</div>
<div class="mt-8 sm:w-full sm:max-w-md mx-auto flex flex-col items-center">
<a href="{{ $.c.ExternalUrl }}/settings" class="px-4 py-2 border border-transparent border-gray-200 dark:border-gray-700 text-sm font-medium rounded-md shadow-sm text-white dark:text-white bg-primary-500 hover:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">{{ .locale.Tr "auth.totp.proceed" }}</a>
</div>
{{ else }}
<p class="mb-2">{{ .locale.Tr "auth.totp.scan-qr-code" }}</p>
<div class="sm:grid grid-cols-2 gap-x-4 md:gap-x-8">
<div class="mt-4">
<p class="mb-4"><code>{{.totpSecret}}</code></p>
<img src="{{.totpQrcode}}" alt="{{.totpSecret}}">
</div>
<div>
<form method="post" action="{{ $.c.ExternalUrl }}/settings/totp/generate">
{{ .csrfHtml }}
<label for="code" class="block text-sm font-medium text-slate-700 dark:text-slate-300">{{ .locale.Tr "auth.totp.code" }}</label>
<div class="mt-1">
<input id="code" name="code" type="text" required autocomplete="off" class="dark:bg-gray-800 appearance-none block w-full px-3 py-2 border border-gray-200 dark:border-gray-700 rounded-md shadow-sm placeholder-gray-600 dark:placeholder-gray-400 focus:outline-none focus:ring-primary-500 focus:border-primary-500 sm:text-sm" />
</div>
<button type="submit" class="mt-4 inline-flex items-center px-4 py-2 border border-transparent border-gray-200 dark:border-gray-700 text-sm font-medium rounded-md shadow-sm text-white dark:text-white bg-primary-500 hover:bg-primary-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500">{{ .locale.Tr "auth.totp.submit" }}</button>
</form>
</div>
</div>
{{ end }}
</main>
</div>
{{ template "footer" .}}