@nocobase/plugin-auth-sms 1.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +23 -0
  3. package/client.d.ts +2 -0
  4. package/client.js +65 -0
  5. package/dist/client/Options.d.ts +2 -0
  6. package/dist/client/SigninPage.d.ts +5 -0
  7. package/dist/client/VerificationCode.d.ts +7 -0
  8. package/dist/client/index.d.ts +5 -0
  9. package/dist/client/index.js +4 -0
  10. package/dist/client/locale/index.d.ts +2 -0
  11. package/dist/constants.d.ts +2 -0
  12. package/dist/constants.js +31 -0
  13. package/dist/externalVersion.js +12 -0
  14. package/dist/index.d.ts +2 -0
  15. package/dist/index.js +39 -0
  16. package/dist/locale/en-US.json +5 -0
  17. package/dist/locale/ko_KR.json +5 -0
  18. package/dist/locale/zh-CN.json +5 -0
  19. package/dist/server/index.d.ts +1 -0
  20. package/dist/server/index.js +33 -0
  21. package/dist/server/locale/en-US.d.ts +9 -0
  22. package/dist/server/locale/en-US.js +30 -0
  23. package/dist/server/locale/fr-FR.d.ts +9 -0
  24. package/dist/server/locale/fr-FR.js +30 -0
  25. package/dist/server/locale/index.d.ts +3 -0
  26. package/dist/server/locale/index.js +43 -0
  27. package/dist/server/locale/ja-JP.d.ts +5 -0
  28. package/dist/server/locale/ja-JP.js +26 -0
  29. package/dist/server/locale/pt-BR.d.ts +9 -0
  30. package/dist/server/locale/pt-BR.js +30 -0
  31. package/dist/server/locale/zh-CN.d.ts +10 -0
  32. package/dist/server/locale/zh-CN.js +31 -0
  33. package/dist/server/migrations/20230607180000-sms-authenticator.d.ts +6 -0
  34. package/dist/server/migrations/20230607180000-sms-authenticator.js +54 -0
  35. package/dist/server/migrations/20240425230310-change-locale-module.d.ts +6 -0
  36. package/dist/server/migrations/20240425230310-change-locale-module.js +42 -0
  37. package/dist/server/plugin.d.ts +10 -0
  38. package/dist/server/plugin.js +66 -0
  39. package/dist/server/sms-auth.d.ts +6 -0
  40. package/dist/server/sms-auth.js +81 -0
  41. package/package.json +32 -0
  42. package/server.d.ts +2 -0
  43. package/server.js +65 -0
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # SMS Auth
2
+
3
+ 提供短信登录认证功能。
4
+
5
+ ## 依赖
6
+
7
+ - `@nocobase/auth` 认证插件,提供认证相关功能,表、模型、函数复用等。
8
+ - `@nocobase/plugin-verification` 验证码插件,提供短信发送功能。
9
+
10
+ ## 使用方法
11
+
12
+ ### 新增验证码Provider
13
+ 插件设置 - Verification/验证码
14
+ 新增一个Provider, 并设置为默认方式。
15
+
16
+ <img src="https://s2.loli.net/2023/05/16/6VKDcqW41F8P9Gu.png" width="800px" />
17
+
18
+ ### 新增SMS认证器
19
+ 插件设置 - Authentication/认证
20
+ 新增,选择认证类型为SMS,新增一个Authenticator。
21
+
22
+ 效果如图:
23
+ <img src="https://s2.loli.net/2023/05/16/GVW5mHTvBhn8Zck.png" width="400px" />
package/client.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './dist/client';
2
+ export { default } from './dist/client';
package/client.js ADDED
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+
3
+ function _getRequireWildcardCache(nodeInterop) {
4
+ if (typeof WeakMap !== 'function') return null;
5
+ var cacheBabelInterop = new WeakMap();
6
+ var cacheNodeInterop = new WeakMap();
7
+ return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) {
8
+ return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
9
+ })(nodeInterop);
10
+ }
11
+
12
+ function _interopRequireWildcard(obj, nodeInterop) {
13
+ if (!nodeInterop && obj && obj.__esModule) {
14
+ return obj;
15
+ }
16
+ if (obj === null || (typeof obj !== 'object' && typeof obj !== 'function')) {
17
+ return { default: obj };
18
+ }
19
+ var cache = _getRequireWildcardCache(nodeInterop);
20
+ if (cache && cache.has(obj)) {
21
+ return cache.get(obj);
22
+ }
23
+ var newObj = {};
24
+ var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
25
+ for (var key in obj) {
26
+ if (key !== 'default' && Object.prototype.hasOwnProperty.call(obj, key)) {
27
+ var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
28
+ if (desc && (desc.get || desc.set)) {
29
+ Object.defineProperty(newObj, key, desc);
30
+ } else {
31
+ newObj[key] = obj[key];
32
+ }
33
+ }
34
+ }
35
+ newObj.default = obj;
36
+ if (cache) {
37
+ cache.set(obj, newObj);
38
+ }
39
+ return newObj;
40
+ }
41
+
42
+ var _index = _interopRequireWildcard(require('./dist/client'));
43
+
44
+ Object.defineProperty(exports, '__esModule', {
45
+ value: true,
46
+ });
47
+ var _exportNames = {};
48
+ Object.defineProperty(exports, 'default', {
49
+ enumerable: true,
50
+ get: function get() {
51
+ return _index.default;
52
+ },
53
+ });
54
+
55
+ Object.keys(_index).forEach(function (key) {
56
+ if (key === 'default' || key === '__esModule') return;
57
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
58
+ if (key in exports && exports[key] === _index[key]) return;
59
+ Object.defineProperty(exports, key, {
60
+ enumerable: true,
61
+ get: function get() {
62
+ return _index[key];
63
+ },
64
+ });
65
+ });
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const Options: () => React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { Authenticator } from '@nocobase/plugin-auth/client';
3
+ export declare const SigninPage: (props: {
4
+ authenticator: Authenticator;
5
+ }) => React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export default function VerificationCode({ targetFieldName, actionType, value, onChange }: {
3
+ targetFieldName?: string;
4
+ actionType: any;
5
+ value: any;
6
+ onChange: any;
7
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { Plugin } from '@nocobase/client';
2
+ export declare class PluginAuthSMSClient extends Plugin {
3
+ load(): Promise<void>;
4
+ }
5
+ export default PluginAuthSMSClient;
@@ -0,0 +1,4 @@
1
+ (function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("@nocobase/plugin-auth/client"),require("react/jsx-runtime"),require("@formily/react"),require("antd"),require("react"),require("react-i18next")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","@nocobase/plugin-auth/client","react/jsx-runtime","@formily/react","antd","react","react-i18next"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@nocobase/plugin-auth-sms"]={},e["@nocobase/client"],e["@nocobase/plugin-auth"],e.jsxRuntime,e["@formily/react"],e.antd,e.react,e["react-i18next"]))})(this,function(e,t,o,r,l,p,m,s){"use strict";var g=(e,t,o)=>new Promise((r,l)=>{var p=n=>{try{s(o.next(n))}catch(d){l(d)}},m=n=>{try{s(o.throw(n))}catch(d){l(d)}},s=n=>n.done?r(n.value):Promise.resolve(n.value).then(p,m);s((o=o.apply(e,t)).next())});function n({targetFieldName:i="phone",actionType:h,value:f,onChange:c}){const{t:a}=s.useTranslation(),x=t.useAPIClient(),j=l.useForm(),[u,I]=m.useState(0),S=m.useRef(null);m.useEffect(()=>{u<=0&&S.current&&clearInterval(S.current)},[u]);function q(){return g(this,null,function*(){if(!(u>0))try{const{data:{data:y}}=yield x.resource("verifications").create({values:{type:h,phone:j.values[i]}});p.message.success(a("Operation succeeded")),f&&c("");const M=y.expiresAt?Math.ceil((Date.parse(y.expiresAt)-Date.now())/1e3):60;I(M),S.current=setInterval(()=>{I(P=>P-1)},1e3)}catch(y){console.error(y)}})}return r.jsxs("fieldset",{className:t.css`
2
+ display: flex;
3
+ gap: 0.5em;
4
+ `,children:[r.jsx(p.Input,{value:f,onChange:c,placeholder:a("Verification code")}),r.jsx(p.Button,{onClick:q,disabled:u>0,children:u>0?a("Retry after {{count}} seconds",{count:u}):a("Send code")})]})}const d={type:"object",name:"phoneForm","x-component":"Form",properties:{phone:{type:"string",required:!0,"x-component":"Input","x-validator":"phone","x-decorator":"FormItem","x-component-props":{placeholder:'{{t("Phone")}}',style:{}}},code:{type:"string",required:!0,"x-component":"VerificationCode","x-component-props":{actionType:"auth:signIn",targetFieldName:"phone"},"x-decorator":"FormItem"},actions:{title:'{{t("Sign in")}}',type:"void","x-component":"Action","x-component-props":{htmlType:"submit",block:!0,type:"primary",useAction:"{{ useSMSSignIn }}",style:{width:"100%"}}},tip:{type:"void","x-component":"div","x-content":'{{t("User will be registered automatically if not exists.", {ns: "auth-sms"})}}',"x-component-props":{style:{color:"#ccc"}},"x-visible":"{{ autoSignup }}"}}},v=i=>{const h=i.authenticator,{name:f,options:c}=h,a=!!(c!=null&&c.autoSignup),x=()=>o.useSignIn(f);return r.jsx(t.SchemaComponent,{schema:d,scope:{useSMSSignIn:x,autoSignup:a},components:{VerificationCode:n}})},C="auth-sms";function A(){return s.useTranslation(C)}const F=()=>{const{t:i}=A();return r.jsx(t.SchemaComponent,{scope:{t:i},schema:{type:"object",properties:{sms:{type:"void",properties:{public:{type:"object",properties:{autoSignup:{"x-decorator":"FormItem",type:"boolean",title:'{{t("Sign up automatically when the user does not exist")}}',"x-component":"Checkbox"}}}}}}}})},T="SMS";class b extends t.Plugin{load(){return g(this,null,function*(){this.app.pm.get(o).registerType(T,{components:{SignInForm:v,AdminSettingsForm:F}})})}}e.PluginAuthSMSClient=b,e.default=b,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,2 @@
1
+ export declare const NAMESPACE = "auth-sms";
2
+ export declare function useAuthTranslation(): import("react-i18next").UseTranslationResponse<"auth-sms", undefined>;
@@ -0,0 +1,2 @@
1
+ export declare const authType = "SMS";
2
+ export declare const namespace: string;
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name2 in all)
7
+ __defProp(target, name2, { get: all[name2], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var constants_exports = {};
19
+ __export(constants_exports, {
20
+ authType: () => authType,
21
+ namespace: () => namespace
22
+ });
23
+ module.exports = __toCommonJS(constants_exports);
24
+ var import_package = require("../package.json");
25
+ const authType = "SMS";
26
+ const namespace = import_package.name;
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ authType,
30
+ namespace
31
+ });
@@ -0,0 +1,12 @@
1
+ module.exports = {
2
+ "@nocobase/client": "1.0.0-alpha.1",
3
+ "react": "18.2.0",
4
+ "@formily/react": "2.3.0",
5
+ "@nocobase/plugin-auth": "1.0.0-alpha.1",
6
+ "antd": "5.12.8",
7
+ "react-i18next": "11.18.6",
8
+ "@nocobase/plugin-verification": "1.0.0-alpha.1",
9
+ "@nocobase/server": "1.0.0-alpha.1",
10
+ "@nocobase/auth": "1.0.0-alpha.1",
11
+ "@nocobase/database": "1.0.0-alpha.1"
12
+ };
@@ -0,0 +1,2 @@
1
+ export * from './server';
2
+ export { default } from './server';
package/dist/index.js ADDED
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var src_exports = {};
30
+ __export(src_exports, {
31
+ default: () => import_server.default
32
+ });
33
+ module.exports = __toCommonJS(src_exports);
34
+ __reExport(src_exports, require("./server"), module.exports);
35
+ var import_server = __toESM(require("./server"));
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ...require("./server")
39
+ });
@@ -0,0 +1,5 @@
1
+ {
2
+ "Sign in via SMS": "Sign in via SMS",
3
+ "User will be registered automatically if not exists.": "User will be registered automatically if not exists.",
4
+ "Sign up automatically when the user does not exist": "Sign up automatically when the user does not exist"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "Sign in via SMS": "SMS 로그인",
3
+ "User will be registered automatically if not exists.": "사용자가 없을 경우 자동으로 등록됩니다.",
4
+ "Sign up automatically when the user does not exist": "사용자가 없을 때 자동으로 가입"
5
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "Sign in via SMS": "短信登录",
3
+ "User will be registered automatically if not exists.": "用户不存在时将自动注册。",
4
+ "Sign up automatically when the user does not exist": "用户不存在时自动注册"
5
+ }
@@ -0,0 +1 @@
1
+ export { default } from './plugin';
@@ -0,0 +1,33 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var server_exports = {};
29
+ __export(server_exports, {
30
+ default: () => import_plugin.default
31
+ });
32
+ module.exports = __toCommonJS(server_exports);
33
+ var import_plugin = __toESM(require("./plugin"));
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ 'The email is incorrect, please re-enter': string;
3
+ 'Please fill in your email address': string;
4
+ 'The password is incorrect, please re-enter': string;
5
+ 'Not a valid cellphone number, please re-enter': string;
6
+ 'The phone number has been registered, please login directly': string;
7
+ 'The phone number is not registered, please register first': string;
8
+ };
9
+ export default _default;
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var en_US_exports = {};
19
+ __export(en_US_exports, {
20
+ default: () => en_US_default
21
+ });
22
+ module.exports = __toCommonJS(en_US_exports);
23
+ var en_US_default = {
24
+ "The email is incorrect, please re-enter": "The email is incorrect, please re-enter",
25
+ "Please fill in your email address": "Please fill in your email address",
26
+ "The password is incorrect, please re-enter": "The password is incorrect, please re-enter",
27
+ "Not a valid cellphone number, please re-enter": "Not a valid cellphone number, please re-enter",
28
+ "The phone number has been registered, please login directly": "The phone number has been registered, please login directly",
29
+ "The phone number is not registered, please register first": "The phone number is not registered, please register first"
30
+ };
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ 'The email is incorrect, please re-enter': string;
3
+ 'Please fill in your email address': string;
4
+ 'The password is incorrect, please re-enter': string;
5
+ 'Not a valid cellphone number, please re-enter': string;
6
+ 'The phone number has been registered, please login directly': string;
7
+ 'The phone number is not registered, please register first': string;
8
+ };
9
+ export default _default;
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var fr_FR_exports = {};
19
+ __export(fr_FR_exports, {
20
+ default: () => fr_FR_default
21
+ });
22
+ module.exports = __toCommonJS(fr_FR_exports);
23
+ var fr_FR_default = {
24
+ "The email is incorrect, please re-enter": "L'email est incorrect, veuillez le saisir \xE0 nouveau",
25
+ "Please fill in your email address": "Veuillez remplir votre adresse e-mail",
26
+ "The password is incorrect, please re-enter": "Le mot de passe est incorrect, veuillez le saisir \xE0 nouveau",
27
+ "Not a valid cellphone number, please re-enter": "Num\xE9ro de t\xE9l\xE9phone portable invalide, veuillez le saisir \xE0 nouveau",
28
+ "The phone number has been registered, please login directly": "Le num\xE9ro de t\xE9l\xE9phone a \xE9t\xE9 enregistr\xE9, veuillez vous connecter directement",
29
+ "The phone number is not registered, please register first": "Le num\xE9ro de t\xE9l\xE9phone n'est pas enregistr\xE9, veuillez vous inscrire d'abord"
30
+ };
@@ -0,0 +1,3 @@
1
+ export { default as enUS } from './en-US';
2
+ export { default as zhCN } from './zh-CN';
3
+ export { default as ptBR } from './pt-BR';
@@ -0,0 +1,43 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var locale_exports = {};
29
+ __export(locale_exports, {
30
+ enUS: () => import_en_US.default,
31
+ ptBR: () => import_pt_BR.default,
32
+ zhCN: () => import_zh_CN.default
33
+ });
34
+ module.exports = __toCommonJS(locale_exports);
35
+ var import_en_US = __toESM(require("./en-US"));
36
+ var import_zh_CN = __toESM(require("./zh-CN"));
37
+ var import_pt_BR = __toESM(require("./pt-BR"));
38
+ // Annotate the CommonJS export names for ESM import in node:
39
+ 0 && (module.exports = {
40
+ enUS,
41
+ ptBR,
42
+ zhCN
43
+ });
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ 'Please fill in your email address': string;
3
+ 'The password is incorrect, please re-enter': string;
4
+ };
5
+ export default _default;
@@ -0,0 +1,26 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var ja_JP_exports = {};
19
+ __export(ja_JP_exports, {
20
+ default: () => ja_JP_default
21
+ });
22
+ module.exports = __toCommonJS(ja_JP_exports);
23
+ var ja_JP_default = {
24
+ "Please fill in your email address": "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
25
+ "The password is incorrect, please re-enter": "\u30D1\u30B9\u30EF\u30FC\u30C9\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002\u518D\u5EA6\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002"
26
+ };
@@ -0,0 +1,9 @@
1
+ declare const _default: {
2
+ 'The email is incorrect, please re-enter': string;
3
+ 'Please fill in your email address': string;
4
+ 'The password is incorrect, please re-enter': string;
5
+ 'Not a valid cellphone number, please re-enter': string;
6
+ 'The phone number has been registered, please login directly': string;
7
+ 'The phone number is not registered, please register first': string;
8
+ };
9
+ export default _default;
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var pt_BR_exports = {};
19
+ __export(pt_BR_exports, {
20
+ default: () => pt_BR_default
21
+ });
22
+ module.exports = __toCommonJS(pt_BR_exports);
23
+ var pt_BR_default = {
24
+ "The email is incorrect, please re-enter": "O e-mail est\xE1 incorreto, por favor, digite novamente",
25
+ "Please fill in your email address": "Por favor, preencha o seu endere\xE7o de e-mail",
26
+ "The password is incorrect, please re-enter": "A senha est\xE1 incorreta, por favor, digite novamente",
27
+ "Not a valid cellphone number, please re-enter": "N\xFAmero de celular inv\xE1lido, por favor, digite novamente",
28
+ "The phone number has been registered, please login directly": "O n\xFAmero de celular j\xE1 est\xE1 registrado, por favor, fa\xE7a login diretamente",
29
+ "The phone number is not registered, please register first": "O n\xFAmero de celular n\xE3o est\xE1 registrado, por favor, registre-se primeiro"
30
+ };
@@ -0,0 +1,10 @@
1
+ declare const _default: {
2
+ 'The email is incorrect, please re-enter': string;
3
+ 'Please fill in your email address': string;
4
+ 'The password is incorrect, please re-enter': string;
5
+ 'Not a valid cellphone number, please re-enter': string;
6
+ 'The phone number has been registered, please login directly': string;
7
+ 'The phone number is not registered, please register first': string;
8
+ 'Please keep and enable at least one authenticator': string;
9
+ };
10
+ export default _default;
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var zh_CN_exports = {};
19
+ __export(zh_CN_exports, {
20
+ default: () => zh_CN_default
21
+ });
22
+ module.exports = __toCommonJS(zh_CN_exports);
23
+ var zh_CN_default = {
24
+ "The email is incorrect, please re-enter": "\u90AE\u7BB1\u6709\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
25
+ "Please fill in your email address": "\u8BF7\u586B\u5199\u90AE\u7BB1",
26
+ "The password is incorrect, please re-enter": "\u5BC6\u7801\u6709\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
27
+ "Not a valid cellphone number, please re-enter": "\u4E0D\u662F\u6709\u6548\u7684\u624B\u673A\u53F7\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
28
+ "The phone number has been registered, please login directly": "\u624B\u673A\u53F7\u5DF2\u6CE8\u518C\uFF0C\u8BF7\u76F4\u63A5\u767B\u5F55",
29
+ "The phone number is not registered, please register first": "\u624B\u673A\u53F7\u672A\u6CE8\u518C\uFF0C\u8BF7\u5148\u6CE8\u518C",
30
+ "Please keep and enable at least one authenticator": "\u8BF7\u81F3\u5C11\u4FDD\u7559\u5E76\u542F\u7528\u4E00\u4E2A\u8BA4\u8BC1\u5668"
31
+ };
@@ -0,0 +1,6 @@
1
+ import { Migration } from '@nocobase/server';
2
+ export default class AddBasicAuthMigration extends Migration {
3
+ appVersion: string;
4
+ up(): Promise<void>;
5
+ down(): Promise<void>;
6
+ }
@@ -0,0 +1,54 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var sms_authenticator_exports = {};
19
+ __export(sms_authenticator_exports, {
20
+ default: () => AddBasicAuthMigration
21
+ });
22
+ module.exports = __toCommonJS(sms_authenticator_exports);
23
+ var import_server = require("@nocobase/server");
24
+ var import_constants = require("../../constants");
25
+ class AddBasicAuthMigration extends import_server.Migration {
26
+ appVersion = "<0.10.0-alpha.2";
27
+ async up() {
28
+ const SystemSetting = this.context.db.getRepository("systemSettings");
29
+ const setting = await SystemSetting.findOne();
30
+ const smsAuthEnabled = setting.get("smsAuthEnabled");
31
+ if (!smsAuthEnabled) {
32
+ return;
33
+ }
34
+ const repo = this.context.db.getRepository("authenticators");
35
+ const existed = await repo.count({
36
+ filter: {
37
+ authType: import_constants.authType
38
+ }
39
+ });
40
+ if (existed) {
41
+ return;
42
+ }
43
+ await repo.create({
44
+ values: {
45
+ name: "sms",
46
+ authType: import_constants.authType,
47
+ description: "Sign in with SMS.",
48
+ enabled: true
49
+ }
50
+ });
51
+ }
52
+ async down() {
53
+ }
54
+ }
@@ -0,0 +1,6 @@
1
+ import { Migration } from '@nocobase/server';
2
+ export default class extends Migration {
3
+ on: string;
4
+ appVersion: string;
5
+ up(): Promise<void>;
6
+ }