tachybase_todo/packages/plugins/users/src/authenticators/index.ts
Junyi 7e6a394f73
feat(plugin-verification): add plugin-verification and phone for users (#722)
* feat(plugin-verification): add plugin-verification and phone for users

* feat(plugin-verification): add env example

* fix(plugin-verification): fix locales

* fix(plugin-verification): remove sending comment

* fix(plugin-verification): fix i18n

* refactor(plugin-verification): move invalid error message to action

* fix(plugin-verification): add field migration

* chore(plugin-verification): update packages version

* test(plugin-verification): temp remove new package dependency

* refactor(plugin-verification): make sms authentication configurable in system settings

* fix: smsAuthEnabled

* feat: update preset-nocobase

Co-authored-by: chenos <chenlinxh@gmail.com>
2022-08-20 18:06:12 +08:00

25 lines
668 B
TypeScript

import path from 'path';
import { requireModule } from '@nocobase/utils';
import { HandlerType } from '@nocobase/resourcer';
import Plugin from '..';
interface Authenticators {
[key: string]: HandlerType
};
export default function(plugin: Plugin, more: Authenticators = {}) {
const { authenticators } = plugin;
const natives = [
'password'
].reduce((result, key) => Object.assign(result, {
[key]: requireModule(path.isAbsolute(key) ? key : path.join(__dirname, key)) as HandlerType
}), {});
for (const [name, authenticator] of Object.entries(<Authenticators>{ ...more, ...natives })) {
authenticators.register(name, authenticator);
}
}