fix(hub): redirect Feishu OAuth default login to org admin SPA

Default returnTo=/admin previously landed on the static complete page
meant for chat onboarding; send users to /admin/org/:slug instead.
This commit is contained in:
2026-07-15 14:29:42 +08:00
parent 46ce942aec
commit 11de9e81db
2 changed files with 4 additions and 9 deletions
+3 -1
View File
@@ -433,8 +433,10 @@ async function resolvePostLoginRedirect(
});
if (intended === null) return "/admin?error=not_an_active_org_member";
const orgRoot = `/admin/org/${intended.organization.slug}`;
// Default / missing returnTo sanitizes to "/admin". Always land in the org
// admin SPA (not the legacy static "close this tab" complete page).
if (returnTo === "/admin") {
return `/auth/feishu/complete?org=${encodeURIComponent(intended.organization.name)}`;
return orgRoot;
}
return returnTo === orgRoot || returnTo.startsWith(`${orgRoot}/`) ? returnTo : orgRoot;
}