feat(login): add plugin seam for default landing path

Plugins can supply `LoginPlugin.resolveDefaultPath` to override the
post-login redirect target. checkDefaultPage consults the hook and
uses the returned path when non-null; otherwise falls back to the
existing admin/non-admin defaults. The lookup runs in parallel with
the IS_FIRST_LOGIN read. Applies to both first-login and
subsequent-login flows.
This commit is contained in:
gitlawr
2026-06-04 15:56:24 +08:00
committed by jialin
parent ab766b8c54
commit 973d2c4529
2 changed files with 35 additions and 7 deletions
+9
View File
@@ -48,6 +48,15 @@ export interface LoginKit {
export interface LoginPlugin {
shouldUseCustomLogin?: (enterpriseSettings: any) => boolean;
CustomLoginComponent?: ComponentType<{ kit: LoginKit }>;
/**
* Seam for plugins to override the default landing path after login.
* Returning a path overrides both the admin and non-admin defaults;
* returning null/undefined falls back to the built-in behavior.
*/
resolveDefaultPath?: (
userInfo: any,
ctx: { request: <T = any>(url: string, options?: any) => Promise<T> }
) => Promise<string | null | undefined> | string | null | undefined;
}
/**