feat(auth): enhance authentication flow with TOTP and admin reset features
- Added TOTP setup, enable, and disable functions to the API. - Implemented admin reset request and confirmation functionalities. - Updated AuthPage to handle new reset functionalities and TOTP inputs. - Enhanced auth store to manage user creation, deletion, and listing. - Improved AppShell and SettingsDialog to support user management features. - Refactored API calls for better organization and clarity.
This commit is contained in:
1 parent
ac08be0248
commit
652e81dacb
9 files changed
+4333
-3737
No files matched your search
@@ -26,11 +26,12 @@
|
||||
|
||||
<Tooltip.Provider delayDuration={300}>
|
||||
{#if auth.loading}
|
||||
<div class="flex min-h-screen items-center justify-center text-sm text-muted-fg">Loading…</div>
|
||||
<AuthPage setupRequired={auth.status?.setupRequired ?? true} loading />
|
||||
{:else if auth.error}
|
||||
<div class="flex min-h-screen items-center justify-center px-4 text-sm text-danger">
|
||||
{auth.error instanceof Error ? auth.error.message : 'Request failed.'}
|
||||
</div>
|
||||
<AuthPage
|
||||
setupRequired={auth.status?.setupRequired ?? true}
|
||||
error={auth.error instanceof Error ? auth.error.message : 'Request failed.'}
|
||||
/>
|
||||
{:else if !auth.status || auth.status.setupRequired || !auth.status.authenticated}
|
||||
<AuthPage setupRequired={auth.status?.setupRequired ?? true} />
|
||||
{:else}
|
||||
@@ -44,17 +45,33 @@
|
||||
onProfile={() => (credentialsOpen = true)}
|
||||
onSettings={() => (settingsOpen = true)}
|
||||
>
|
||||
{#snippet children()}
|
||||
{@render children?.()}
|
||||
{/snippet}
|
||||
{@render children?.()}
|
||||
</SharedAppShell>
|
||||
{/if}
|
||||
</Tooltip.Provider>
|
||||
|
||||
<SettingsDialog bind:open={settingsOpen} />
|
||||
<SettingsDialog
|
||||
bind:open={settingsOpen}
|
||||
currentRole={auth.status?.role ?? 'user'}
|
||||
currentUserId={auth.status?.id}
|
||||
onCreateUser={(input) => auth.createUser(input)}
|
||||
onDeleteUser={(id) => auth.deleteUser(id)}
|
||||
onListUsers={() => auth.listUsers()}
|
||||
onUpdateUser={(id, input) => auth.updateUser(id, input)}
|
||||
/>
|
||||
<ProfileDialog
|
||||
bind:open={credentialsOpen}
|
||||
currentUsername={auth.status?.username ?? ''}
|
||||
currentEmail={auth.status?.email ?? ''}
|
||||
currentRole={auth.status?.role ?? 'user'}
|
||||
currentUserId={auth.status?.id}
|
||||
onCreateUser={(input) => auth.createUser(input)}
|
||||
onDeleteUser={(id) => auth.deleteUser(id)}
|
||||
onListUsers={() => auth.listUsers()}
|
||||
onSave={saveProfile}
|
||||
onUpdateUser={(id, input) => auth.updateUser(id, input)}
|
||||
onTotpStatus={() => auth.totpStatus()}
|
||||
onTotpSetup={() => auth.setupTotp()}
|
||||
onTotpEnable={(token) => auth.enableTotp(token)}
|
||||
onTotpDisable={(token) => auth.disableTotp(token)}
|
||||
/>
|
||||
Reference in new issue
Block a user