Fixed 2fa and white-label

This commit is contained in:
2026-10-12 13:10:34 +02:00
parent 13d669b757
commit 78e2f8fc7f
14 changed files with 322 additions and 161 deletions
+24 -1
View File
@@ -1,4 +1,15 @@
import type { Field } from 'payload';
import type { Field, Plugin } from 'payload';
/**
* Factory shape of @clocklimited/payload-2fa's `payloadTotp` export — injected
* so the plugin never imports the optional peer itself.
*/
export type TotpPluginFactory = (options: {
collection: string;
forceSetup: boolean;
totp: {
issuer: string;
};
}) => Plugin;
import type { AccessOption } from './modules/access/types.js';
import type { ContentOption } from './modules/content/types.js';
import type { FormsOption } from './modules/forms/types.js';
@@ -71,6 +82,18 @@ export type IpalOptions = {
collectionSlug?: string;
/** Name shown in the authenticator app (e.g. company/site name). */
issuer: string;
/**
* The 2FA plugin factory, INJECTED from the project:
* `import { payloadTotp } from '@clocklimited/payload-2fa'`. Strongly
* recommended — injecting it (the same pattern as NextResponse /
* revalidatePath) means the plugin never dynamically imports the
* optional peer, which Next can fail to bundle into the server chunks
* ("Cannot find module '@clocklimited/payload-2fa'" at runtime, even on
* public frontend pages). If omitted, the plugin falls back to a dynamic
* import and you MUST add '@clocklimited/payload-2fa' to
* serverExternalPackages in next.config. See docs/security.md.
*/
plugin?: TotpPluginFactory;
} | false;
/**
* White-label the admin panel: show the CLIENT's brand (logo + name) in the