@nocobase/plugin-users 0.13.0-alpha.3 → 0.13.0-alpha.5
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.
- package/dist/client/index.js +1 -11
- package/dist/index.js +37 -16
- package/dist/locale/en-US.js +22 -4
- package/dist/locale/es-ES.js +22 -4
- package/dist/locale/fr-FR.js +22 -4
- package/dist/locale/ja-JP.js +22 -4
- package/dist/locale/pt-BR.js +22 -4
- package/dist/locale/zh-CN.js +22 -4
- package/dist/server/actions/users.js +60 -25
- package/dist/server/authenticators/index.js +35 -12
- package/dist/server/authenticators/password.js +26 -9
- package/dist/server/collections/users.js +22 -4
- package/dist/server/index.js +39 -17
- package/dist/server/jwt-service.js +39 -12
- package/dist/server/locale/en-US.js +22 -4
- package/dist/server/locale/es-ES.js +22 -4
- package/dist/server/locale/fr-FR.js +22 -4
- package/dist/server/locale/index.js +41 -24
- package/dist/server/locale/ja-JP.js +22 -4
- package/dist/server/locale/pt-BR.js +22 -4
- package/dist/server/locale/zh-CN.js +22 -4
- package/dist/server/middlewares/check.js +26 -4
- package/dist/server/middlewares/index.js +28 -13
- package/dist/server/middlewares/parseToken.js +26 -4
- package/dist/server/migrations/20220818072639-add-users-phone.js +24 -7
- package/dist/server/migrations/20230802170800-add-username.js +24 -7
- package/dist/server/migrations/20230802183100-update-username.js +24 -7
- package/dist/server/server.js +58 -54
- package/dist/swagger/index.json +117 -0
- package/package.json +2 -2
- package/dist/swagger/index.js +0 -131
package/dist/client/index.js
CHANGED
|
@@ -1,11 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@nocobase/client")) : typeof define === "function" && define.amd ? define(["exports", "@nocobase/client"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["@nocobase/plugin-users"] = {}, global["@nocobase/client"]));
|
|
3
|
-
})(this, function(exports2, client) {
|
|
4
|
-
"use strict";
|
|
5
|
-
class UsersPlugin extends client.Plugin {
|
|
6
|
-
async load() {
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
exports2.default = UsersPlugin;
|
|
10
|
-
Object.defineProperties(exports2, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
11
|
-
});
|
|
1
|
+
(function(e,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("@nocobase/client")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client"],n):(e=typeof globalThis!="undefined"?globalThis:e||self,n(e["@nocobase/plugin-users"]={},e["@nocobase/client"]))})(this,function(e,n){"use strict";var l=(e,n,o)=>new Promise((u,d)=>{var c=i=>{try{s(o.next(i))}catch(t){d(t)}},f=i=>{try{s(o.throw(i))}catch(t){d(t)}},s=i=>i.done?u(i.value):Promise.resolve(i.value).then(c,f);s((o=o.apply(e,n)).next())});class o extends n.Plugin{load(){return l(this,null,function*(){})}}e.default=o,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
|
12
32
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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")
|
|
18
39
|
});
|
package/dist/locale/en-US.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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);
|
|
3
23
|
var en_US_default = {
|
|
4
24
|
"The email is incorrect, please re-enter": "The email is incorrect, please re-enter",
|
|
5
25
|
"Please fill in your email address": "Please fill in your email address",
|
|
@@ -8,5 +28,3 @@ var en_US_default = {
|
|
|
8
28
|
"The phone number has been registered, please login directly": "The phone number has been registered, please login directly",
|
|
9
29
|
"The phone number is not registered, please register first": "The phone number is not registered, please register first"
|
|
10
30
|
};
|
|
11
|
-
|
|
12
|
-
module.exports = en_US_default;
|
package/dist/locale/es-ES.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 es_ES_exports = {};
|
|
19
|
+
__export(es_ES_exports, {
|
|
20
|
+
default: () => es_ES_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(es_ES_exports);
|
|
3
23
|
var es_ES_default = {
|
|
4
24
|
"The email is incorrect, please re-enter": "El correo electr\xF3nico es incorrecto, por favor vuelva a introducirlo",
|
|
5
25
|
"Please fill in your email address": "Por favor, introduzca su direcci\xF3n de correo electr\xF3nico",
|
|
@@ -8,5 +28,3 @@ var es_ES_default = {
|
|
|
8
28
|
"The phone number has been registered, please login directly": "El n\xFAmero de tel\xE9fono ha sido registrado, por favor, inicie sesi\xF3n directamente",
|
|
9
29
|
"The phone number is not registered, please register first": "El n\xFAmero de tel\xE9fono no est\xE1 registrado, por favor reg\xEDstrese primero"
|
|
10
30
|
};
|
|
11
|
-
|
|
12
|
-
module.exports = es_ES_default;
|
package/dist/locale/fr-FR.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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);
|
|
3
23
|
var fr_FR_default = {
|
|
4
24
|
"The email is incorrect, please re-enter": "L'adresse e-mail est incorrecte, veuillez la saisir \xE0 nouveau",
|
|
5
25
|
"Please fill in your email address": "Veuillez remplir votre adresse e-mail",
|
|
@@ -8,5 +28,3 @@ var fr_FR_default = {
|
|
|
8
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",
|
|
9
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"
|
|
10
30
|
};
|
|
11
|
-
|
|
12
|
-
module.exports = fr_FR_default;
|
package/dist/locale/ja-JP.js
CHANGED
|
@@ -1,8 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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);
|
|
3
23
|
var ja_JP_default = {
|
|
4
24
|
"Please fill in your email address": "\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
5
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"
|
|
6
26
|
};
|
|
7
|
-
|
|
8
|
-
module.exports = ja_JP_default;
|
package/dist/locale/pt-BR.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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);
|
|
3
23
|
var pt_BR_default = {
|
|
4
24
|
"The email is incorrect, please re-enter": "O e-mail est\xE1 incorreto, por favor, digite novamente",
|
|
5
25
|
"Please fill in your email address": "Por favor, preencha o seu endere\xE7o de e-mail",
|
|
@@ -8,5 +28,3 @@ var pt_BR_default = {
|
|
|
8
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",
|
|
9
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"
|
|
10
30
|
};
|
|
11
|
-
|
|
12
|
-
module.exports = pt_BR_default;
|
package/dist/locale/zh-CN.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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);
|
|
3
23
|
var zh_CN_default = {
|
|
4
24
|
"The email is incorrect, please re-enter": "\u90AE\u7BB1\u6709\u8BEF\uFF0C\u8BF7\u91CD\u65B0\u8F93\u5165",
|
|
5
25
|
"Please fill in your email address": "\u8BF7\u586B\u5199\u90AE\u7BB1",
|
|
@@ -8,5 +28,3 @@ var zh_CN_default = {
|
|
|
8
28
|
"The phone number has been registered, please login directly": "\u624B\u673A\u53F7\u5DF2\u6CE8\u518C\uFF0C\u8BF7\u76F4\u63A5\u767B\u5F55",
|
|
9
29
|
"The phone number is not registered, please register first": "\u624B\u673A\u53F7\u672A\u6CE8\u518C\uFF0C\u8BF7\u5148\u6CE8\u518C"
|
|
10
30
|
};
|
|
11
|
-
|
|
12
|
-
module.exports = zh_CN_default;
|
|
@@ -1,13 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 users_exports = {};
|
|
29
|
+
__export(users_exports, {
|
|
30
|
+
changePassword: () => changePassword,
|
|
31
|
+
check: () => check,
|
|
32
|
+
getUserByResetToken: () => getUserByResetToken,
|
|
33
|
+
lostpassword: () => lostpassword,
|
|
34
|
+
resetpassword: () => resetpassword,
|
|
35
|
+
signin: () => signin,
|
|
36
|
+
signout: () => signout,
|
|
37
|
+
signup: () => signup,
|
|
38
|
+
updateProfile: () => updateProfile
|
|
39
|
+
});
|
|
40
|
+
module.exports = __toCommonJS(users_exports);
|
|
41
|
+
var import_resourcer = require("@nocobase/resourcer");
|
|
42
|
+
var import_crypto = __toESM(require("crypto"));
|
|
43
|
+
var import__ = require("../");
|
|
11
44
|
async function check(ctx, next) {
|
|
12
45
|
if (ctx.state.currentUser) {
|
|
13
46
|
const user = ctx.state.currentUser.toJSON();
|
|
@@ -23,7 +56,7 @@ async function signin(ctx, next) {
|
|
|
23
56
|
for (const [name, authenticator] of authenticators.getEntities()) {
|
|
24
57
|
branches[name] = authenticator;
|
|
25
58
|
}
|
|
26
|
-
return
|
|
59
|
+
return (0, import_resourcer.branch)(branches, (context) => context.action.params.authenticator ?? "password")(ctx, () => {
|
|
27
60
|
const user = ctx.state.currentUser.toJSON();
|
|
28
61
|
const token = jwtService.sign({ userId: user.id });
|
|
29
62
|
ctx.body = {
|
|
@@ -49,7 +82,7 @@ async function lostpassword(ctx, next) {
|
|
|
49
82
|
values: { email }
|
|
50
83
|
} = ctx.action.params;
|
|
51
84
|
if (!email) {
|
|
52
|
-
ctx.throw(400, { code: "InvalidUserData", message: ctx.t("Please fill in your email address", { ns:
|
|
85
|
+
ctx.throw(400, { code: "InvalidUserData", message: ctx.t("Please fill in your email address", { ns: import__.namespace }) });
|
|
53
86
|
}
|
|
54
87
|
const User = ctx.db.getCollection("users");
|
|
55
88
|
const user = await User.model.findOne({
|
|
@@ -60,10 +93,10 @@ async function lostpassword(ctx, next) {
|
|
|
60
93
|
if (!user) {
|
|
61
94
|
ctx.throw(404, {
|
|
62
95
|
code: "InvalidUserData",
|
|
63
|
-
message: ctx.t("The email is incorrect, please re-enter", { ns:
|
|
96
|
+
message: ctx.t("The email is incorrect, please re-enter", { ns: import__.namespace })
|
|
64
97
|
});
|
|
65
98
|
}
|
|
66
|
-
user.resetToken =
|
|
99
|
+
user.resetToken = import_crypto.default.randomBytes(20).toString("hex");
|
|
67
100
|
await user.save();
|
|
68
101
|
ctx.body = user;
|
|
69
102
|
await next();
|
|
@@ -133,20 +166,22 @@ async function changePassword(ctx, next) {
|
|
|
133
166
|
const pwd = User.getField("password");
|
|
134
167
|
const isValid = await pwd.verify(oldPassword, user.password);
|
|
135
168
|
if (!isValid) {
|
|
136
|
-
ctx.throw(401, ctx.t("The password is incorrect, please re-enter", { ns:
|
|
169
|
+
ctx.throw(401, ctx.t("The password is incorrect, please re-enter", { ns: import__.namespace }));
|
|
137
170
|
}
|
|
138
171
|
user.password = newPassword;
|
|
139
172
|
user.save();
|
|
140
173
|
ctx.body = ctx.state.currentUser.toJSON();
|
|
141
174
|
await next();
|
|
142
175
|
}
|
|
143
|
-
|
|
144
|
-
exports
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
changePassword,
|
|
179
|
+
check,
|
|
180
|
+
getUserByResetToken,
|
|
181
|
+
lostpassword,
|
|
182
|
+
resetpassword,
|
|
183
|
+
signin,
|
|
184
|
+
signout,
|
|
185
|
+
signup,
|
|
186
|
+
updateProfile
|
|
187
|
+
});
|
|
@@ -1,17 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var
|
|
9
|
-
|
|
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 authenticators_exports = {};
|
|
29
|
+
__export(authenticators_exports, {
|
|
30
|
+
default: () => authenticators_default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(authenticators_exports);
|
|
33
|
+
var import_path = __toESM(require("path"));
|
|
34
|
+
var import_utils = require("@nocobase/utils");
|
|
10
35
|
function authenticators_default(plugin, more = {}) {
|
|
11
36
|
const { authenticators } = plugin;
|
|
12
37
|
const natives = ["password"].reduce(
|
|
13
38
|
(result, key) => Object.assign(result, {
|
|
14
|
-
[key]:
|
|
39
|
+
[key]: (0, import_utils.requireModule)(import_path.default.isAbsolute(key) ? key : import_path.default.join(__dirname, key))
|
|
15
40
|
}),
|
|
16
41
|
{}
|
|
17
42
|
);
|
|
@@ -19,5 +44,3 @@ function authenticators_default(plugin, more = {}) {
|
|
|
19
44
|
authenticators.register(name, authenticator);
|
|
20
45
|
}
|
|
21
46
|
}
|
|
22
|
-
|
|
23
|
-
module.exports = authenticators_default;
|
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
|
|
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 password_exports = {};
|
|
19
|
+
__export(password_exports, {
|
|
20
|
+
default: () => password_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(password_exports);
|
|
23
|
+
var import__ = require("..");
|
|
5
24
|
async function password_default(ctx, next) {
|
|
6
25
|
const { uniqueField = "email", values } = ctx.action.params;
|
|
7
26
|
if (!values[uniqueField]) {
|
|
8
27
|
return ctx.throw(400, {
|
|
9
28
|
code: "InvalidUserData",
|
|
10
|
-
message: ctx.t("Please fill in your email address", { ns:
|
|
29
|
+
message: ctx.t("Please fill in your email address", { ns: import__.namespace })
|
|
11
30
|
});
|
|
12
31
|
}
|
|
13
32
|
const User = ctx.db.getCollection("users");
|
|
@@ -17,15 +36,13 @@ async function password_default(ctx, next) {
|
|
|
17
36
|
}
|
|
18
37
|
});
|
|
19
38
|
if (!user) {
|
|
20
|
-
return ctx.throw(404, ctx.t("The email is incorrect, please re-enter", { ns:
|
|
39
|
+
return ctx.throw(404, ctx.t("The email is incorrect, please re-enter", { ns: import__.namespace }));
|
|
21
40
|
}
|
|
22
41
|
const field = User.getField("password");
|
|
23
42
|
const valid = await field.verify(values.password, user.password);
|
|
24
43
|
if (!valid) {
|
|
25
|
-
return ctx.throw(404, ctx.t("The password is incorrect, please re-enter", { ns:
|
|
44
|
+
return ctx.throw(404, ctx.t("The password is incorrect, please re-enter", { ns: import__.namespace }));
|
|
26
45
|
}
|
|
27
46
|
ctx.state.currentUser = user;
|
|
28
47
|
return next();
|
|
29
48
|
}
|
|
30
|
-
|
|
31
|
-
module.exports = password_default;
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 users_exports = {};
|
|
19
|
+
__export(users_exports, {
|
|
20
|
+
default: () => users_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(users_exports);
|
|
3
23
|
var users_default = {
|
|
4
24
|
namespace: "users.users",
|
|
5
25
|
duplicator: {
|
|
@@ -100,5 +120,3 @@ var users_default = {
|
|
|
100
120
|
}
|
|
101
121
|
]
|
|
102
122
|
};
|
|
103
|
-
|
|
104
|
-
module.exports = users_default;
|
package/dist/server/index.js
CHANGED
|
@@ -1,18 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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 name2 in all)
|
|
9
|
+
__defProp(target, name2, { get: all[name2], 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_server.default,
|
|
31
|
+
namespace: () => namespace
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(server_exports);
|
|
34
|
+
var import_package = require("../../package.json");
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
const namespace = import_package.name;
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
namespace
|
|
17
40
|
});
|
|
18
|
-
exports.namespace = namespace;
|