This commit is contained in:
2026-09-28 16:01:03 +02:00
parent 471ec4b12a
commit 4627266577
4 changed files with 26 additions and 7 deletions
+8 -2
View File
@@ -68,8 +68,14 @@ import { buildSeoPlugin, injectAutoFillMeta, injectSeoTabs } from './modules/seo
// node_modules). Avoids TS2307 without @ts-expect-error; the module
// exists at runtime in projects that installed it.
const pkg = '@clocklimited/payload-2fa';
const { totpPlugin } = await import(pkg);
config = await totpPlugin({
const mod = await import(pkg);
// The package exports `payloadTotp`; older/other builds may use
// `totpPlugin`. Accept either so a rename doesn't break us.
const totp = mod.payloadTotp ?? mod.totpPlugin;
if (typeof totp !== 'function') {
throw new Error('expected export payloadTotp (or totpPlugin) to be a function — ' + 'check the installed @clocklimited/payload-2fa version');
}
config = await totp({
collection: tf.collectionSlug ?? 'users',
forceSetup: true,
totp: {
+1 -1
View File
File diff suppressed because one or more lines are too long