feat: reduce one time access code length for better UX

This commit is contained in:
Elias Schneider
2026-08-18 21:31:22 +02:00
parent 900346a1c3
commit a487c78550
6 changed files with 38 additions and 12 deletions
@@ -18,12 +18,16 @@
let isLoading = $state(false);
let error: string | undefined = $state();
let backHref = $state('/login/alternative');
const shortCodeLength = 6;
const longCodeLength = 12;
let longCodeRequested = $state(
code.length > 6 || !$appConfigStore.emailOneTimeAccessAsUnauthenticatedEnabled
code.length > shortCodeLength || !$appConfigStore.emailOneTimeAccessAsUnauthenticatedEnabled
);
let showLongCodeOption = $state($appConfigStore.emailOneTimeAccessAsUnauthenticatedEnabled);
let codeComplete = $derived(longCodeRequested ? code.length === 16 : code.length === 6);
let codeComplete = $derived(
longCodeRequested ? code.length === longCodeLength : code.length === shortCodeLength
);
const userService = new UserService();
@@ -94,7 +98,7 @@
type="text"
/>
{:else}
<InputOTP.Root maxlength={6} bind:value={code} autofocus>
<InputOTP.Root maxlength={shortCodeLength} bind:value={code} autofocus>
{#snippet children({ cells })}
<InputOTP.Group>
{#each cells as cell (cell)}