@nocobase/plugin-auth-sms 1.2.13-alpha → 1.3.0-alpha.20240710084543

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 (37) hide show
  1. package/package.json +2 -2
  2. package/dist/client/Options.d.ts +0 -10
  3. package/dist/client/SigninPage.d.ts +0 -13
  4. package/dist/client/VerificationCode.d.ts +0 -15
  5. package/dist/client/index.d.ts +0 -13
  6. package/dist/client/index.js +0 -13
  7. package/dist/client/locale/index.d.ts +0 -10
  8. package/dist/constants.d.ts +0 -10
  9. package/dist/constants.js +0 -40
  10. package/dist/externalVersion.js +0 -22
  11. package/dist/index.d.ts +0 -10
  12. package/dist/index.js +0 -48
  13. package/dist/locale/en-US.json +0 -6
  14. package/dist/locale/ko_KR.json +0 -5
  15. package/dist/locale/zh-CN.json +0 -6
  16. package/dist/server/index.d.ts +0 -9
  17. package/dist/server/index.js +0 -42
  18. package/dist/server/locale/en-US.d.ts +0 -17
  19. package/dist/server/locale/en-US.js +0 -39
  20. package/dist/server/locale/fr-FR.d.ts +0 -17
  21. package/dist/server/locale/fr-FR.js +0 -39
  22. package/dist/server/locale/index.d.ts +0 -11
  23. package/dist/server/locale/index.js +0 -52
  24. package/dist/server/locale/ja-JP.d.ts +0 -13
  25. package/dist/server/locale/ja-JP.js +0 -35
  26. package/dist/server/locale/pt-BR.d.ts +0 -17
  27. package/dist/server/locale/pt-BR.js +0 -39
  28. package/dist/server/locale/zh-CN.d.ts +0 -18
  29. package/dist/server/locale/zh-CN.js +0 -40
  30. package/dist/server/migrations/20230607180000-sms-authenticator.d.ts +0 -14
  31. package/dist/server/migrations/20230607180000-sms-authenticator.js +0 -63
  32. package/dist/server/migrations/20240425230310-change-locale-module.d.ts +0 -14
  33. package/dist/server/migrations/20240425230310-change-locale-module.js +0 -51
  34. package/dist/server/plugin.d.ts +0 -18
  35. package/dist/server/plugin.js +0 -77
  36. package/dist/server/sms-auth.d.ts +0 -14
  37. package/dist/server/sms-auth.js +0 -90
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "认证:短信",
5
5
  "description": "SMS authentication.",
6
6
  "description.zh-CN": "通过短信验证码认证身份。",
7
- "version": "1.2.13-alpha",
7
+ "version": "1.3.0-alpha.20240710084543",
8
8
  "main": "./dist/server/index.js",
9
9
  "homepage": "https://docs.nocobase.com/handbook/auth-sms",
10
10
  "homepage.zh-CN": "https://docs-cn.nocobase.com/handbook/auth-sms",
@@ -25,7 +25,7 @@
25
25
  "@nocobase/server": "1.x",
26
26
  "@nocobase/test": "1.x"
27
27
  },
28
- "gitHead": "b6a1c2ee330b47c2581ea2ce15ee46210e6220f2",
28
+ "gitHead": "07a8b596fc64a9779a194cb9b0dc2ca7570ed9d4",
29
29
  "keywords": [
30
30
  "Authentication"
31
31
  ]
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import React from 'react';
10
- export declare const Options: () => React.JSX.Element;
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import React from 'react';
10
- import { Authenticator } from '@nocobase/plugin-auth/client';
11
- export declare const SigninPage: (props: {
12
- authenticator: Authenticator;
13
- }) => React.JSX.Element;
@@ -1,15 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import React from 'react';
10
- export default function VerificationCode({ targetFieldName, actionType, value, onChange }: {
11
- targetFieldName?: string;
12
- actionType: any;
13
- value: any;
14
- onChange: any;
15
- }): React.JSX.Element;
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Plugin } from '@nocobase/client';
10
- export declare class PluginAuthSMSClient extends Plugin {
11
- load(): Promise<void>;
12
- }
13
- export default PluginAuthSMSClient;
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- (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`
11
- display: flex;
12
- gap: 0.5em;
13
- `,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"}})});
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export declare const NAMESPACE = "auth-sms";
10
- export declare function useAuthTranslation(): import("react-i18next").UseTranslationResponse<"auth-sms", undefined>;
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export declare const authType = "SMS";
10
- export declare const namespace: string;
package/dist/constants.js DELETED
@@ -1,40 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name2 in all)
16
- __defProp(target, name2, { get: all[name2], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var constants_exports = {};
28
- __export(constants_exports, {
29
- authType: () => authType,
30
- namespace: () => namespace
31
- });
32
- module.exports = __toCommonJS(constants_exports);
33
- var import_package = require("../package.json");
34
- const authType = "SMS";
35
- const namespace = import_package.name;
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- authType,
39
- namespace
40
- });
@@ -1,22 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- module.exports = {
11
- "@nocobase/client": "1.2.13-alpha",
12
- "react": "18.2.0",
13
- "@formily/react": "2.3.0",
14
- "@nocobase/plugin-auth": "1.2.13-alpha",
15
- "antd": "5.12.8",
16
- "react-i18next": "11.18.6",
17
- "@nocobase/plugin-verification": "1.2.13-alpha",
18
- "@nocobase/server": "1.2.13-alpha",
19
- "@nocobase/utils": "1.2.13-alpha",
20
- "@nocobase/auth": "1.2.13-alpha",
21
- "@nocobase/database": "1.2.13-alpha"
22
- };
package/dist/index.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export * from './server';
10
- export { default } from './server';
package/dist/index.js DELETED
@@ -1,48 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var src_exports = {};
39
- __export(src_exports, {
40
- default: () => import_server.default
41
- });
42
- module.exports = __toCommonJS(src_exports);
43
- __reExport(src_exports, require("./server"), module.exports);
44
- var import_server = __toESM(require("./server"));
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- ...require("./server")
48
- });
@@ -1,6 +0,0 @@
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
- "SMS": "SMS"
6
- }
@@ -1,5 +0,0 @@
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
- }
@@ -1,6 +0,0 @@
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
- "SMS": "短信"
6
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export { default } from './plugin';
@@ -1,42 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var server_exports = {};
38
- __export(server_exports, {
39
- default: () => import_plugin.default
40
- });
41
- module.exports = __toCommonJS(server_exports);
42
- var import_plugin = __toESM(require("./plugin"));
@@ -1,17 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- 'The email is incorrect, please re-enter': string;
11
- 'Please fill in your email address': string;
12
- 'The password is incorrect, please re-enter': string;
13
- 'Not a valid cellphone number, please re-enter': string;
14
- 'The phone number has been registered, please login directly': string;
15
- 'The phone number is not registered, please register first': string;
16
- };
17
- export default _default;
@@ -1,39 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var en_US_exports = {};
28
- __export(en_US_exports, {
29
- default: () => en_US_default
30
- });
31
- module.exports = __toCommonJS(en_US_exports);
32
- var en_US_default = {
33
- "The email is incorrect, please re-enter": "The email is incorrect, please re-enter",
34
- "Please fill in your email address": "Please fill in your email address",
35
- "The password is incorrect, please re-enter": "The password is incorrect, please re-enter",
36
- "Not a valid cellphone number, please re-enter": "Not a valid cellphone number, please re-enter",
37
- "The phone number has been registered, please login directly": "The phone number has been registered, please login directly",
38
- "The phone number is not registered, please register first": "The phone number is not registered, please register first"
39
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- 'The email is incorrect, please re-enter': string;
11
- 'Please fill in your email address': string;
12
- 'The password is incorrect, please re-enter': string;
13
- 'Not a valid cellphone number, please re-enter': string;
14
- 'The phone number has been registered, please login directly': string;
15
- 'The phone number is not registered, please register first': string;
16
- };
17
- export default _default;
@@ -1,39 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var fr_FR_exports = {};
28
- __export(fr_FR_exports, {
29
- default: () => fr_FR_default
30
- });
31
- module.exports = __toCommonJS(fr_FR_exports);
32
- var fr_FR_default = {
33
- "The email is incorrect, please re-enter": "L'email est incorrect, veuillez le saisir \xE0 nouveau",
34
- "Please fill in your email address": "Veuillez remplir votre adresse e-mail",
35
- "The password is incorrect, please re-enter": "Le mot de passe est incorrect, veuillez le saisir \xE0 nouveau",
36
- "Not a valid cellphone number, please re-enter": "Num\xE9ro de t\xE9l\xE9phone portable invalide, veuillez le saisir \xE0 nouveau",
37
- "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",
38
- "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"
39
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- export { default as enUS } from './en-US';
10
- export { default as zhCN } from './zh-CN';
11
- export { default as ptBR } from './pt-BR';
@@ -1,52 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var locale_exports = {};
38
- __export(locale_exports, {
39
- enUS: () => import_en_US.default,
40
- ptBR: () => import_pt_BR.default,
41
- zhCN: () => import_zh_CN.default
42
- });
43
- module.exports = __toCommonJS(locale_exports);
44
- var import_en_US = __toESM(require("./en-US"));
45
- var import_zh_CN = __toESM(require("./zh-CN"));
46
- var import_pt_BR = __toESM(require("./pt-BR"));
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- enUS,
50
- ptBR,
51
- zhCN
52
- });
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- 'Please fill in your email address': string;
11
- 'The password is incorrect, please re-enter': string;
12
- };
13
- export default _default;
@@ -1,35 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var ja_JP_exports = {};
28
- __export(ja_JP_exports, {
29
- default: () => ja_JP_default
30
- });
31
- module.exports = __toCommonJS(ja_JP_exports);
32
- var ja_JP_default = {
33
- "Please fill in your email address": "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
34
- "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"
35
- };
@@ -1,17 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- 'The email is incorrect, please re-enter': string;
11
- 'Please fill in your email address': string;
12
- 'The password is incorrect, please re-enter': string;
13
- 'Not a valid cellphone number, please re-enter': string;
14
- 'The phone number has been registered, please login directly': string;
15
- 'The phone number is not registered, please register first': string;
16
- };
17
- export default _default;
@@ -1,39 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var pt_BR_exports = {};
28
- __export(pt_BR_exports, {
29
- default: () => pt_BR_default
30
- });
31
- module.exports = __toCommonJS(pt_BR_exports);
32
- var pt_BR_default = {
33
- "The email is incorrect, please re-enter": "O e-mail est\xE1 incorreto, por favor, digite novamente",
34
- "Please fill in your email address": "Por favor, preencha o seu endere\xE7o de e-mail",
35
- "The password is incorrect, please re-enter": "A senha est\xE1 incorreta, por favor, digite novamente",
36
- "Not a valid cellphone number, please re-enter": "N\xFAmero de celular inv\xE1lido, por favor, digite novamente",
37
- "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",
38
- "The phone number is not registered, please register first": "O n\xFAmero de celular n\xE3o est\xE1 registrado, por favor, registre-se primeiro"
39
- };
@@ -1,18 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- 'The email is incorrect, please re-enter': string;
11
- 'Please fill in your email address': string;
12
- 'The password is incorrect, please re-enter': string;
13
- 'Not a valid cellphone number, please re-enter': string;
14
- 'The phone number has been registered, please login directly': string;
15
- 'The phone number is not registered, please register first': string;
16
- 'Please keep and enable at least one authenticator': string;
17
- };
18
- export default _default;
@@ -1,40 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var zh_CN_exports = {};
28
- __export(zh_CN_exports, {
29
- default: () => zh_CN_default
30
- });
31
- module.exports = __toCommonJS(zh_CN_exports);
32
- var zh_CN_default = {
33
- "The email is incorrect, please re-enter": "\u90AE\u7BB1\u6709\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
34
- "Please fill in your email address": "\u8BF7\u586B\u5199\u90AE\u7BB1",
35
- "The password is incorrect, please re-enter": "\u5BC6\u7801\u6709\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
36
- "Not a valid cellphone number, please re-enter": "\u4E0D\u662F\u6709\u6548\u7684\u624B\u673A\u53F7\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
37
- "The phone number has been registered, please login directly": "\u624B\u673A\u53F7\u5DF2\u6CE8\u518C\uFF0C\u8BF7\u76F4\u63A5\u767B\u5F55",
38
- "The phone number is not registered, please register first": "\u624B\u673A\u53F7\u672A\u6CE8\u518C\uFF0C\u8BF7\u5148\u6CE8\u518C",
39
- "Please keep and enable at least one authenticator": "\u8BF7\u81F3\u5C11\u4FDD\u7559\u5E76\u542F\u7528\u4E00\u4E2A\u8BA4\u8BC1\u5668"
40
- };
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class AddBasicAuthMigration extends Migration {
11
- appVersion: string;
12
- up(): Promise<void>;
13
- down(): Promise<void>;
14
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var sms_authenticator_exports = {};
28
- __export(sms_authenticator_exports, {
29
- default: () => AddBasicAuthMigration
30
- });
31
- module.exports = __toCommonJS(sms_authenticator_exports);
32
- var import_server = require("@nocobase/server");
33
- var import_constants = require("../../constants");
34
- class AddBasicAuthMigration extends import_server.Migration {
35
- appVersion = "<0.10.0-alpha.2";
36
- async up() {
37
- const SystemSetting = this.context.db.getRepository("systemSettings");
38
- const setting = await SystemSetting.findOne();
39
- const smsAuthEnabled = setting.get("smsAuthEnabled");
40
- if (!smsAuthEnabled) {
41
- return;
42
- }
43
- const repo = this.context.db.getRepository("authenticators");
44
- const existed = await repo.count({
45
- filter: {
46
- authType: import_constants.authType
47
- }
48
- });
49
- if (existed) {
50
- return;
51
- }
52
- await repo.create({
53
- values: {
54
- name: "sms",
55
- authType: import_constants.authType,
56
- description: "Sign in with SMS.",
57
- enabled: true
58
- }
59
- });
60
- }
61
- async down() {
62
- }
63
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class extends Migration {
11
- on: string;
12
- appVersion: string;
13
- up(): Promise<void>;
14
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var change_locale_module_exports = {};
28
- __export(change_locale_module_exports, {
29
- default: () => change_locale_module_default
30
- });
31
- module.exports = __toCommonJS(change_locale_module_exports);
32
- var import_server = require("@nocobase/server");
33
- class change_locale_module_default extends import_server.Migration {
34
- on = "afterLoad";
35
- // 'beforeLoad' or 'afterLoad'
36
- appVersion = "<1.0.0-alpha.1";
37
- async up() {
38
- const repo = this.db.getRepository("localizationTexts");
39
- if (!repo) {
40
- return;
41
- }
42
- await repo.update({
43
- filter: {
44
- module: "resources.sms-auth"
45
- },
46
- values: {
47
- module: "resources.auth-sms"
48
- }
49
- });
50
- }
51
- }
@@ -1,18 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { InstallOptions, Plugin } from '@nocobase/server';
10
- export declare class PluginAuthSMSServer extends Plugin {
11
- afterAdd(): void;
12
- load(): Promise<void>;
13
- install(options?: InstallOptions): Promise<void>;
14
- afterEnable(): Promise<void>;
15
- afterDisable(): Promise<void>;
16
- remove(): Promise<void>;
17
- }
18
- export default PluginAuthSMSServer;
@@ -1,77 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var plugin_exports = {};
28
- __export(plugin_exports, {
29
- PluginAuthSMSServer: () => PluginAuthSMSServer,
30
- default: () => plugin_default
31
- });
32
- module.exports = __toCommonJS(plugin_exports);
33
- var import_server = require("@nocobase/server");
34
- var import_constants = require("../constants");
35
- var import_sms_auth = require("./sms-auth");
36
- var import_utils = require("@nocobase/utils");
37
- class PluginAuthSMSServer extends import_server.Plugin {
38
- afterAdd() {
39
- }
40
- async load() {
41
- const verificationPlugin = this.app.getPlugin("verification");
42
- if (!verificationPlugin) {
43
- this.app.logger.warn("auth-sms: @nocobase/plugin-verification is required");
44
- return;
45
- }
46
- verificationPlugin.interceptors.register("auth:signIn", {
47
- manual: true,
48
- getReceiver: (ctx) => {
49
- return ctx.action.params.values.phone;
50
- },
51
- expiresIn: 120,
52
- validate: async (ctx, phone) => {
53
- if (!phone) {
54
- throw new Error(ctx.t("Not a valid cellphone number, please re-enter"));
55
- }
56
- return true;
57
- }
58
- });
59
- this.app.authManager.registerTypes(import_constants.authType, {
60
- auth: import_sms_auth.SMSAuth,
61
- title: (0, import_utils.tval)("SMS", { ns: import_constants.namespace })
62
- });
63
- }
64
- async install(options) {
65
- }
66
- async afterEnable() {
67
- }
68
- async afterDisable() {
69
- }
70
- async remove() {
71
- }
72
- }
73
- var plugin_default = PluginAuthSMSServer;
74
- // Annotate the CommonJS export names for ESM import in node:
75
- 0 && (module.exports = {
76
- PluginAuthSMSServer
77
- });
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { AuthConfig, BaseAuth } from '@nocobase/auth';
10
- import { Model } from '@nocobase/database';
11
- export declare class SMSAuth extends BaseAuth {
12
- constructor(config: AuthConfig);
13
- validate(): Promise<Model<any, any>>;
14
- }
@@ -1,90 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var sms_auth_exports = {};
28
- __export(sms_auth_exports, {
29
- SMSAuth: () => SMSAuth
30
- });
31
- module.exports = __toCommonJS(sms_auth_exports);
32
- var import_auth = require("@nocobase/auth");
33
- var import_constants = require("../constants");
34
- class SMSAuth extends import_auth.BaseAuth {
35
- constructor(config) {
36
- const { ctx } = config;
37
- super({
38
- ...config,
39
- userCollection: ctx.db.getCollection("users")
40
- });
41
- }
42
- async validate() {
43
- const ctx = this.ctx;
44
- const verificationPlugin = ctx.app.getPlugin("verification");
45
- if (!verificationPlugin) {
46
- throw new Error("auth-sms: @nocobase/plugin-verification is required");
47
- }
48
- let user;
49
- await verificationPlugin.intercept(ctx, async () => {
50
- var _a;
51
- const {
52
- values: { phone }
53
- } = ctx.action.params;
54
- try {
55
- user = await this.userRepository.findOne({
56
- filter: { phone }
57
- });
58
- if (user) {
59
- await this.authenticator.addUser(user, {
60
- through: {
61
- uuid: phone
62
- }
63
- });
64
- return;
65
- }
66
- const { autoSignup } = ((_a = this.authenticator.options) == null ? void 0 : _a.public) || {};
67
- const authenticator = this.authenticator;
68
- if (autoSignup) {
69
- user = await authenticator.findOrCreateUser(phone, {
70
- nickname: phone,
71
- phone
72
- });
73
- return;
74
- }
75
- user = await authenticator.findUser(phone);
76
- if (!user) {
77
- throw new Error(ctx.t("The phone number is not registered, please register first", { ns: import_constants.namespace }));
78
- }
79
- } catch (err) {
80
- console.log(err);
81
- throw new Error(err.message);
82
- }
83
- });
84
- return user;
85
- }
86
- }
87
- // Annotate the CommonJS export names for ESM import in node:
88
- 0 && (module.exports = {
89
- SMSAuth
90
- });