diff --git a/backend/src/routes/auth/me.ts b/backend/src/routes/auth/me.ts index ad013c7f..5af4fe53 100644 --- a/backend/src/routes/auth/me.ts +++ b/backend/src/routes/auth/me.ts @@ -58,6 +58,7 @@ export default async function meRoutes(server: FastifyInstance) { features: tenants.features, extraModules: tenants.extraModules, businessInfo: tenants.businessInfo, + portalConfig: tenants.portalConfig, numberRanges: tenants.numberRanges, accountChart: tenants.accountChart, taxEvaluationPeriod: tenants.taxEvaluationPeriod, diff --git a/backend/src/routes/tenant.ts b/backend/src/routes/tenant.ts index b67fb3a4..d9b913a5 100644 --- a/backend/src/routes/tenant.ts +++ b/backend/src/routes/tenant.ts @@ -271,6 +271,16 @@ export default async function tenantRoutes(server: FastifyInstance) { if (!data) return reply.code(400).send({ error: "data required" }) + if (Object.prototype.hasOwnProperty.call(data, "portalConfig")) { + const config = data.portalConfig + if (!config || typeof config !== "object" || Array.isArray(config) + || typeof config.primaryColor !== "string" || !/^#[0-9a-f]{6}$/i.test(config.primaryColor.trim())) { + return reply.code(400).send({ error: "Die Portal-Akzentfarbe muss ein Hex-Farbwert wie #69c350 sein." }) + } + data.portalConfig = { ...config, primaryColor: config.primaryColor.trim().toLowerCase() } + delete data.portalConfig.primayColor + } + const updated = await server.db .update(tenants) .set(data) diff --git a/frontend/pages/customer-portal.vue b/frontend/pages/customer-portal.vue index e5a00083..47d81525 100644 --- a/frontend/pages/customer-portal.vue +++ b/frontend/pages/customer-portal.vue @@ -1,5 +1,6 @@