Files
drop/pages/mfa/setup/totp.vue
DecDuck 63ac2b8ffc Depot API & v4 (#298)
* feat: nginx + torrential basics & services system

* fix: lint + i18n

* fix: update torrential to remove openssl

* feat: add torrential to Docker build

* feat: move to self hosted runner

* fix: move off self-hosted runner

* fix: update nginx.conf

* feat: torrential cache invalidation

* fix: update torrential for cache invalidation

* feat: integrity check task

* fix: lint

* feat: move to version ids

* fix: client fixes and client-side checks

* feat: new depot apis and version id fixes

* feat: update torrential

* feat: droplet bump and remove unsafe update functions

* fix: lint

* feat: v4 featureset: emulators, multi-launch commands

* fix: lint

* fix: mobile ui for game editor

* feat: launch options

* fix: lint

* fix: remove axios, use $fetch

* feat: metadata and task api improvements

* feat: task actions

* fix: slight styling issue

* feat: fix style and lints

* feat: totp backend routes

* feat: oidc groups

* fix: update drop-base

* feat: creation of passkeys & totp

* feat: totp signin

* feat: webauthn mfa/signin

* feat: launch selecting ui

* fix: manually running tasks

* feat: update add company game modal to use new SelectorGame

* feat: executor selector

* fix(docker): update rust to rust nightly for torrential build (#305)

* feat: new version ui

* feat: move package lookup to build time to allow for deno dev

* fix: lint

* feat: localisation cleanup

* feat: apply localisation cleanup

* feat: potential i18n refactor logic

* feat: remove args from commands

* fix: lint

* fix: lockfile

---------

Co-authored-by: Aden Lindsay <140392385+AdenMGB@users.noreply.github.com>
2026-01-13 15:32:39 +11:00

92 lines
2.6 KiB
Vue

<template>
<main
class="mx-auto grid lg:grid-cols-2 max-w-md lg:max-w-none min-h-full place-items-center w-full gap-4 px-6 py-12 sm:py-32 lg:px-8"
>
<div>
<div class="text-left max-w-md">
<h1
class="mt-4 text-3xl font-bold font-display tracking-tight text-zinc-100 sm:text-5xl"
>
Set up your authenticator
</h1>
<p class="mt-6 text-base leading-7 text-zinc-400">
Use your TOTP authenticator, like Google Authenticator, Aegis, or
Bitwarden, to add 2FA to your Drop account.
</p>
<div class="mt-8">
<p class="text-xs leading-7 text-zinc-200">
Enter the generated code to enable TOTP
</p>
<div class="mt-2 flex flex-row gap-2">
<CodeInput
:length="6"
placeholder="123456"
size="w-10 h-10 text-sm"
@complete="(code) => complete(code)"
/>
</div>
<div
v-if="error"
class="mt-4 rounded-md bg-red-600/10 p-4 max-w-sm mx-auto"
>
<div class="flex">
<div class="flex-shrink-0">
<XCircleIcon class="h-5 w-5 text-red-600" aria-hidden="true" />
</div>
<div class="ml-3">
<h3 class="text-sm font-medium text-red-600">
{{ error }}
</h3>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div class="max-w-2xl flex flex-col items-center gap-2">
<div id="qrcode" />
<p
class="font-bold font-display text-zinc-500 uppercase font-sm tracking-tight"
>
{{ totpSecrets?.secret }}
</p>
</div>
</div>
</main>
</template>
<script setup lang="ts">
import type { FetchError } from "ofetch";
useHead({
title: "Set up TOTP",
});
const totpSecrets = await $dropFetch("/api/v1/user/mfa/totp/start", {
method: "POST",
});
const error = ref<string | undefined>();
const router = useRouter();
onMounted(async () => {
const kjua = await import("kjua");
const el = kjua.default({ text: totpSecrets.url, render: "svg", size: 400 });
document.querySelector("#qrcode")?.appendChild(el);
});
async function complete(code: string) {
try {
await $dropFetch("/api/v1/user/mfa/totp/finish", {
method: "POST",
body: { code },
});
router.push("/mfa/setup/successful");
} catch (e) {
error.value =
(e as FetchError).data?.message ?? (e as FetchError).statusMessage;
}
}
</script>