sync snapshot from LAN repo (source codex/merge-tjlnew-classic-retrieval-20261019 @ ded012d9)

This commit is contained in:
gozeros committed 2026-11-05 11:04:44 +08:00
1 parent ea9dcff9c0
commit c753e6c9b5
818 files changed
+14037 -108991

No files matched your search

+1 -34
View File
@@ -11,13 +11,6 @@ export function shouldStartSso(
(explicitSso || !options.password_login_enabled));
}
/** Claim the one automatic SSO login started by a mounted LoginPage. */
export function claimSsoLoginStart(started: { current: boolean }): boolean {
if (started.current) return false;
started.current = true;
return true;
}
/** External callers put login parameters before or after the hash route. */
export function mergeLoginSearch(routeSearch: string, outerSearch: string): URLSearchParams {
const params = new URLSearchParams(outerSearch);
@@ -27,31 +20,6 @@ export function mergeLoginSearch(routeSearch: string, outerSearch: string): URLS
return params;
}
const OUTER_IDENTITY_PARAMS = ["authToken", "yUserId", "ticket", "token", "access_token", "userId"] as const;
/**
* `/login/:username?password=` names the account. Identity params left in front
* of the hash by an earlier external-token entry must not sign that user back
* in. The same keys written inside the hash route are still honored.
*/
export function loginParamsForEntry(
routeSearch: string,
outerSearch: string,
routeUsername?: string | null,
): URLSearchParams {
const params = mergeLoginSearch(routeSearch, outerSearch);
const route = new URLSearchParams(routeSearch);
const username = routeUsername?.trim() ?? "";
const password = route.has("password")
? (route.get("password") ?? "")
: (new URLSearchParams(outerSearch).get("password") ?? "");
if (!username || !password) return params;
for (const key of OUTER_IDENTITY_PARAMS) {
if (!route.has(key)) params.delete(key);
}
return params;
}
export const LOGIN_CREDENTIAL_PARAMS = [
"ticket", "userId", "yUserId", "token", "access_token", "password", "authToken", "routeKey",
] as const;
@@ -60,9 +28,8 @@ export const LOGIN_CREDENTIAL_PARAMS = [
export function shouldUseStoredTicket(
options: AuthenticationOptions | null,
explicitSso: boolean,
hasCurrentSession = false,
): boolean {
return Boolean(options?.sso_enabled && !options.password_login_enabled && !explicitSso && !hasCurrentSession);
return Boolean(options?.sso_enabled && !options.password_login_enabled && !explicitSso);
}
/** Keep the destination/presentation when switching forms; discard credentials. */