From f753550d440ebcf01847e90b3aeb6768095ea352 Mon Sep 17 00:00:00 2001 From: Timothy Yin Date: Thu, 12 Mar 2026 00:27:21 +0800 Subject: [PATCH] fix(csms): fix comment and return value in getParentDomain function --- apps/csms/src/lib/auth.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/csms/src/lib/auth.ts b/apps/csms/src/lib/auth.ts index 48a2cf0..cde8479 100644 --- a/apps/csms/src/lib/auth.ts +++ b/apps/csms/src/lib/auth.ts @@ -8,12 +8,12 @@ import { passkey } from "@better-auth/passkey"; const webOrigin = process.env.WEB_ORIGIN ?? "http://localhost:3000"; const rpID = new URL(webOrigin).hostname; -// 从 WEB_ORIGIN 的主机名推导父域(如 csms.uniiem.com → .uniiem.com), +// 从 WEB_ORIGIN 的主机名推导父域(如 csms.uniiem.com → uniiem.com), // 用于跨子域共享 session cookie;本地开发时返回 undefined 不启用。 function getParentDomain(hostname: string): string | undefined { if (hostname === "localhost" || /^\d/.test(hostname)) return undefined; const parts = hostname.split("."); - return parts.length >= 3 ? "." + parts.slice(1).join(".") : undefined; + return parts.length >= 3 ? parts.slice(1).join(".") : undefined; } const cookieDomain = process.env.COOKIE_DOMAIN ?? getParentDomain(rpID);