2FA Fix
This commit is contained in:
Vendored
+8
-2
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user