diff --git a/src/lib/components/ui/form/form-field.svelte b/src/lib/components/ui/form/form-field.svelte index 7481fda..1398993 100644 --- a/src/lib/components/ui/form/form-field.svelte +++ b/src/lib/components/ui/form/form-field.svelte @@ -17,12 +17,7 @@ {#snippet children({ constraints, errors, tainted, value })} -
+
{@render childrenProp?.({ constraints, errors, tainted, value: value as T[U] })}
{/snippet} diff --git a/src/lib/components/ui/form/form-legend.svelte b/src/lib/components/ui/form/form-legend.svelte index 9d52f6a..b3c9043 100644 --- a/src/lib/components/ui/form/form-legend.svelte +++ b/src/lib/components/ui/form/form-legend.svelte @@ -11,6 +11,6 @@ diff --git a/src/lib/components/ui/input/index.ts b/src/lib/components/ui/input/index.ts index f47b6d3..c9ffe28 100644 --- a/src/lib/components/ui/input/index.ts +++ b/src/lib/components/ui/input/index.ts @@ -3,5 +3,5 @@ import Root from "./input.svelte"; export { Root, // - Root as Input, + Root as Input }; diff --git a/src/lib/components/ui/label/index.ts b/src/lib/components/ui/label/index.ts index 8bfca0b..2c3128c 100644 --- a/src/lib/components/ui/label/index.ts +++ b/src/lib/components/ui/label/index.ts @@ -3,5 +3,5 @@ import Root from "./label.svelte"; export { Root, // - Root as Label, + Root as Label }; diff --git a/src/lib/components/ui/label/label.svelte b/src/lib/components/ui/label/label.svelte index d0afda3..d71afbc 100644 --- a/src/lib/components/ui/label/label.svelte +++ b/src/lib/components/ui/label/label.svelte @@ -13,7 +13,7 @@ bind:ref data-slot="label" class={cn( - "flex select-none items-center gap-2 text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50 group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50", + "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className )} {...restProps} diff --git a/src/lib/components/ui/skeleton/index.ts b/src/lib/components/ui/skeleton/index.ts index 186db21..2be5c50 100644 --- a/src/lib/components/ui/skeleton/index.ts +++ b/src/lib/components/ui/skeleton/index.ts @@ -3,5 +3,5 @@ import Root from "./skeleton.svelte"; export { Root, // - Root as Skeleton, + Root as Skeleton }; diff --git a/src/lib/server/email/email-service.ts b/src/lib/server/email/email-service.ts index 2d5e2c3..643492f 100644 --- a/src/lib/server/email/email-service.ts +++ b/src/lib/server/email/email-service.ts @@ -195,28 +195,28 @@ export async function sendAppointmentUpdatedEmail( */ export function generateBaseUrl(requestUrl: URL, tenant: SelectTenant | null): string { const protocol = requestUrl.protocol; - const port = requestUrl.port ? `:${requestUrl.port}` : ''; + const port = requestUrl.port ? `:${requestUrl.port}` : ""; const hostname = requestUrl.hostname; - + // In development, always use the original hostname regardless of tenant - if (hostname === 'localhost' || hostname.startsWith('127.') || hostname.startsWith('192.168.')) { + if (hostname === "localhost" || hostname.startsWith("127.") || hostname.startsWith("192.168.")) { return `${protocol}//${hostname}${port}`; } - + // In production, handle tenant subdomains if (tenant?.shortName) { - const parts = hostname.split('.'); - + const parts = hostname.split("."); + if (parts.length > 2) { // Complex subdomain - use only the last two parts (domain.tld) and add tenant - const domain = parts.slice(-2).join('.'); + const domain = parts.slice(-2).join("."); return `${protocol}//${tenant.shortName}.${domain}${port}`; } else { // Main domain, prepend tenant subdomain return `${protocol}//${tenant.shortName}.${hostname}${port}`; } } - + // For global admin or no tenant, use main domain return `${protocol}//${hostname}${port}`; } @@ -243,7 +243,7 @@ export async function sendConfirmationEmail( const subject = language === "en" ? "Confirm Your Registration" : "Registrierung bestätigen"; // Generate appropriate base URL if request URL is provided - const baseUrl = requestUrl ? generateBaseUrl(requestUrl, tenant) : 'http://localhost:5173'; + const baseUrl = requestUrl ? generateBaseUrl(requestUrl, tenant) : "http://localhost:5173"; // Create enhanced tenant object with baseUrl const tenantWithBaseUrl = { diff --git a/src/routes/api/admin/init/+server.ts b/src/routes/api/admin/init/+server.ts index 4a292a0..13ef8fa 100644 --- a/src/routes/api/admin/init/+server.ts +++ b/src/routes/api/admin/init/+server.ts @@ -136,35 +136,41 @@ export const POST: RequestHandler = async ({ request, cookies, url }) => { }); // Create admin account - const admin = await UserService.createUser({ - name: body.name, - email: body.email, - passphrase: body.passphrase, // Will be undefined if passkey is used - language: body.language || "de" - }, url); + const admin = await UserService.createUser( + { + name: body.name, + email: body.email, + passphrase: body.passphrase, // Will be undefined if passkey is used + language: body.language || "de" + }, + url + ); // Add the passkey to the admin account if provided if (hasPasskey) { // Validate that this registration was preceded by a challenge request const registrationEmail = cookies.get("webauthn-registration-email"); - + if (!registrationEmail || registrationEmail !== body.email) { - return json({ error: "Invalid passkey registration. Please request a new challenge first." }, { status: 400 }); + return json( + { error: "Invalid passkey registration. Please request a new challenge first." }, + { status: 400 } + ); } - + // Clear the registration cookie after validation (challenge cookie is cleared by login route) cookies.delete("webauthn-registration-email", { path: "/" }); - + // Extract counter from WebAuthn credential const counter = WebAuthnService.extractCounterFromCredential(body.passkey); - + await UserService.addPasskey(admin.id, { id: body.passkey.id, publicKey: body.passkey.publicKey, counter, deviceName: body.passkey.deviceName || "Unknown Device" }); - + log.debug("Passkey added to admin account", { adminId: admin.id, passkeyId: body.passkey.id diff --git a/src/routes/api/auth/passkeys/+server.ts b/src/routes/api/auth/passkeys/+server.ts index 37432b6..80206a5 100644 --- a/src/routes/api/auth/passkeys/+server.ts +++ b/src/routes/api/auth/passkeys/+server.ts @@ -118,7 +118,7 @@ export const POST: RequestHandler = async ({ request }) => { // Extract counter from WebAuthn credential const counter = WebAuthnService.extractCounterFromCredential(body.passkey); - + // Add the passkey using the UserService await UserService.addAdditionalPasskey(body.userId, { id: body.passkey.id,