feat(auth): implement TOTP setup and management
Lint / Lint (Node/Svelte) (push) Successful in 24s
Lint / Lint (Go) (push) Successful in 28s
Lint / Lint (Python) (push) Failing after 14s
Tests / Test (Node/Svelte) (push) Successful in 18s
Tests / Test (Go) (push) Successful in 25s
Tests / Test (Python) (push) Successful in 12s

- Added TOTP support for two-factor authentication in the auth module.
- Introduced new types and interfaces for TOTP setup and token actions in the web UI.
- Created backend logic for generating and verifying TOTP secrets and tokens.
- Implemented user management features including role assignments and user CRUD operations.
- Enhanced UI components for managing users and TOTP settings.
- Added styles for optional labels and authentication reset links.
- Implemented reset code generation and validation for admin accounts.
This commit is contained in:
Gabriel20xx committed 2026-08-05 14:57:01 +02:00
1 parent 2f57554154
commit da97fd4fb1
30 files changed
+2145 -27

No files matched your search

@@ -1,17 +1,52 @@
<script lang="ts">
import type { ProfileUpdateInput } from '../types';
import type {
ProfileUpdateInput,
TotpSetupRequest,
TotpStatusRequest,
TotpTokenAction,
UserCreateRequest,
UserDeleteRequest,
UserId,
UserListRequest,
UserRole,
UserUpdateRequest
} from '../types';
import Button from './Button.svelte';
import Dialog from './Dialog.svelte';
import TotpSettings from './TotpSettings.svelte';
import UserManagement from './UserManagement.svelte';
let {
currentEmail = '',
currentRole = 'user',
currentUserId,
onCreateUser,
onDeleteUser,
onListUsers,
currentUsername = '',
onSave,
onTotpDisable,
onTotpEnable,
onTotpSetup,
onTotpStatus,
onUpdateUser,
totpEnabled = false,
open = $bindable(false)
}: {
currentEmail?: string;
currentRole?: UserRole;
currentUserId?: UserId;
onCreateUser?: UserCreateRequest;
onDeleteUser?: UserDeleteRequest;
onListUsers?: UserListRequest;
currentUsername?: string;
onSave?: (input: ProfileUpdateInput) => void | Promise<void>;
onTotpDisable?: TotpTokenAction;
onTotpEnable?: TotpTokenAction;
onTotpSetup?: TotpSetupRequest;
onTotpStatus?: TotpStatusRequest;
onUpdateUser?: UserUpdateRequest;
totpEnabled?: boolean;
open?: boolean;
} = $props();
@@ -112,4 +147,24 @@
<Button disabled={saving} type="submit">{saving ? 'Saving…' : 'Save changes'}</Button>
</div>
</form>
{#if onTotpSetup && onTotpEnable && onTotpDisable}
<TotpSettings
{open}
onDisable={onTotpDisable}
onEnable={onTotpEnable}
onSetup={onTotpSetup}
onStatus={onTotpStatus}
enabled={totpEnabled}
/>
{/if}
<UserManagement
currentRole={currentRole}
currentUserId={currentUserId}
onCreate={onCreateUser}
onDelete={onDeleteUser}
onList={onListUsers}
onUpdate={onUpdateUser}
/>
</Dialog>