Files
readeck/assets/templates/auth/totp.jet.html
Olivier Meunier 822d78d57d TOTP authentication
This is only the first part. When a totp_secret exists for a user, the
authentication then asks for the code and carries on.

The totp lib can handle 6 or 8 letter codes and sha1, sha256 and sha512.
For maximum compatibility with Google Authenticator though, it sticks
to 6 character and sha1.
2025-12-09 07:23:13 +01:00

35 lines
1.1 KiB
HTML

{*
SPDX-FileCopyrightText: © 2021 Olivier Meunier <olivier@neokraft.net>
SPDX-License-Identifier: AGPL-3.0-only
*}
{{ extends "./base" }}
{{ import "/_libs/forms" }}
{{ block title() }}{{ gettext("Two-factor authentication") }}{{ end }}
{{ block main() }}
<h2 class="text-h3 mb-8 text-center">{{ yield title() }}</h2>
<form action="{{ urlFor(`/login/mfa`) }}" method="post">
{{ yield formErrors(form=.Form) }}
<input type="hidden" name="redirect" value="{{ .Form.Get(`redirect`).String() }}" />
{{ yield textField(field=.Form.Get("code"),
label=gettext("Passcode"),
class="max",
inputClass="form-input w-full text-center text-lg font-bold",
inputAttrs=attrList(
"minlength", "6",
"maxlength", "6",
"autocapitalize", "off",
"autocomplete", "one-time-code",
),
) }}
<button class="btn btn-default block mt-6 w-full rounded-md" type="submit">{{ gettext("Verify") }}</button>
</form>
{{ end }}