mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-08-17 21:25:52 +02:00
Linting and formatting errors
This commit is contained in:
@@ -17,12 +17,7 @@
|
||||
|
||||
<FormPrimitive.Field {form} {name}>
|
||||
{#snippet children({ constraints, errors, tainted, value })}
|
||||
<div
|
||||
bind:this={ref}
|
||||
data-slot="form-item"
|
||||
class={cn("space-y-2", className)}
|
||||
{...restProps}
|
||||
>
|
||||
<div bind:this={ref} data-slot="form-item" class={cn("space-y-2", className)} {...restProps}>
|
||||
{@render childrenProp?.({ constraints, errors, tainted, value: value as T[U] })}
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
|
||||
<FormPrimitive.Legend
|
||||
bind:ref
|
||||
class={cn("data-[fs-error]:text-destructive text-sm font-medium leading-none", className)}
|
||||
class={cn("data-[fs-error]:text-destructive text-sm leading-none font-medium", className)}
|
||||
{...restProps}
|
||||
/>
|
||||
|
||||
@@ -3,5 +3,5 @@ import Root from "./input.svelte";
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
Root as Input,
|
||||
Root as Input
|
||||
};
|
||||
|
||||
@@ -3,5 +3,5 @@ import Root from "./label.svelte";
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
Root as Label,
|
||||
Root as Label
|
||||
};
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -3,5 +3,5 @@ import Root from "./skeleton.svelte";
|
||||
export {
|
||||
Root,
|
||||
//
|
||||
Root as Skeleton,
|
||||
Root as Skeleton
|
||||
};
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user