mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-08-17 21:25:52 +02:00
Added salutation field (#183)
* Added salutation field * Handle honeypot in backend --------- Co-authored-by: Karl Ludwig Weise <ludwig@ludwigweise.de> Co-authored-by: Hendrik Belitz <hendrik@innovation-through-understanding.de>
This commit is contained in:
co-authored by
Karl Ludwig Weise
Hendrik Belitz
parent
1fa1a07055
commit
25f10462da
@@ -70,6 +70,7 @@
|
||||
"pinInsecure": "Diese PIN ist zu unsicher"
|
||||
},
|
||||
"passkey": "Passkey",
|
||||
"salutation": "Anrede",
|
||||
"name": "Name",
|
||||
"phone": "Telefonnummer",
|
||||
"pin": "PIN",
|
||||
|
||||
@@ -86,6 +86,7 @@
|
||||
},
|
||||
"noPassAtAll": "Either passphrase or passkey is required",
|
||||
"passkey": "Passkey",
|
||||
"salutation": "Salutation",
|
||||
"name": "Name",
|
||||
"phone": "Phone Number",
|
||||
"pin": "PIN",
|
||||
|
||||
@@ -69,6 +69,7 @@ interface EncryptedData {
|
||||
}
|
||||
|
||||
export interface AppointmentData {
|
||||
salutation?: string;
|
||||
name: string;
|
||||
email: string;
|
||||
shareEmail: boolean;
|
||||
@@ -328,6 +329,7 @@ export class UnifiedAppointmentCrypto {
|
||||
staffKeyShares: await this.getStaffKeyShares(tenantId),
|
||||
clientKeyShare: await this.getClientKeyShare(),
|
||||
clientEncryptedTunnelKey: await this.encryptTunnelKeyForClient(),
|
||||
salutation: appointmentData.salutation,
|
||||
}
|
||||
: {
|
||||
// Existing client
|
||||
@@ -340,6 +342,7 @@ export class UnifiedAppointmentCrypto {
|
||||
clientEmail: appointmentData.shareEmail ? appointmentData.email : undefined,
|
||||
clientLanguage,
|
||||
encryptedAppointment,
|
||||
salutation: appointmentData.salutation,
|
||||
};
|
||||
|
||||
const response = await fetch(endpoint, {
|
||||
|
||||
@@ -39,6 +39,7 @@ export type TPublicAppointment = {
|
||||
duration: number;
|
||||
};
|
||||
data?: {
|
||||
salutation: string;
|
||||
name: string;
|
||||
shareEmail: boolean;
|
||||
email: string;
|
||||
|
||||
+11
@@ -19,6 +19,7 @@
|
||||
|
||||
const form = superForm(
|
||||
{
|
||||
salutation: "",
|
||||
name: "",
|
||||
shareEmail: false,
|
||||
email: "",
|
||||
@@ -37,6 +38,7 @@
|
||||
proceed({
|
||||
...appointment,
|
||||
data: {
|
||||
salutation: validation.data.salutation,
|
||||
name: validation.data.name,
|
||||
shareEmail: validation.data.shareEmail,
|
||||
email: validation.data.email,
|
||||
@@ -68,6 +70,15 @@
|
||||
>
|
||||
</Alert.Root>
|
||||
<Form.Root {enhance} class="flex flex-col gap-4">
|
||||
<Form.Field {form} name="salutation" class="hidden">
|
||||
<Form.Control>
|
||||
{#snippet children({ props })}
|
||||
<Form.Label>{m["form.salutation"]()}</Form.Label>
|
||||
<Input {...props} bind:value={$formData.salutation} type="text" />
|
||||
{/snippet}
|
||||
</Form.Control>
|
||||
<Form.FieldErrors />
|
||||
</Form.Field>
|
||||
<Form.Field {form} name="name">
|
||||
<Form.Control>
|
||||
{#snippet children({ props })}
|
||||
|
||||
@@ -29,6 +29,7 @@ const requestSchema = z.object({
|
||||
duration: z.number().int().positive(),
|
||||
clientEmail: z.email().optional(),
|
||||
clientLanguage: z.string().optional().default("en"),
|
||||
salutation: z.string().optional(),
|
||||
encryptedAppointment: z.object({
|
||||
encryptedPayload: z.string(),
|
||||
iv: z.string(),
|
||||
@@ -202,6 +203,10 @@ export const POST: RequestHandler = async ({ request, params }) => {
|
||||
const body = await request.json();
|
||||
const validatedData = requestSchema.parse(body);
|
||||
|
||||
if (validatedData.salutation) {
|
||||
throw new ValidationError("Bees incoming");
|
||||
}
|
||||
|
||||
logger.info("Adding appointment to existing tunnel", {
|
||||
tenantId,
|
||||
tunnelId: validatedData.tunnelId,
|
||||
|
||||
@@ -16,6 +16,7 @@ const requestSchema = z.object({
|
||||
clientLanguage: z.string().optional().default("en"),
|
||||
clientPublicKey: z.string(),
|
||||
privateKeyShare: z.string(),
|
||||
salutation: z.string().optional(),
|
||||
encryptedAppointment: z.object({
|
||||
encryptedPayload: z.string(),
|
||||
iv: z.string(),
|
||||
@@ -228,6 +229,10 @@ export const POST: RequestHandler = async ({ request, params }) => {
|
||||
const body = await request.json();
|
||||
const validatedData = requestSchema.parse(body);
|
||||
|
||||
if (validatedData.salutation) {
|
||||
throw new ValidationError("Bees incoming");
|
||||
}
|
||||
|
||||
logger.info("Creating new client appointment tunnel", {
|
||||
tenantId,
|
||||
tunnelId: validatedData.tunnelId,
|
||||
|
||||
Reference in New Issue
Block a user