@nocobase/database 1.7.15 → 1.7.17
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/lib/fields/password-field.js +15 -10
- package/package.json +4 -4
|
@@ -72,27 +72,32 @@ const _PasswordField = class _PasswordField extends import_field.Field {
|
|
|
72
72
|
}
|
|
73
73
|
init() {
|
|
74
74
|
const { name } = this.options;
|
|
75
|
-
this.listener = async (
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
75
|
+
this.listener = async (instances) => {
|
|
76
|
+
instances = Array.isArray(instances) ? instances : [instances];
|
|
77
|
+
for (const instance of instances) {
|
|
78
|
+
if (!instance.changed(name)) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const value = instance.get(name);
|
|
82
|
+
if (value) {
|
|
83
|
+
const hash = await this.hash(value);
|
|
84
|
+
instance.set(name, hash);
|
|
85
|
+
} else {
|
|
86
|
+
instance.set(name, instance.previous(name));
|
|
87
|
+
}
|
|
85
88
|
}
|
|
86
89
|
};
|
|
87
90
|
}
|
|
88
91
|
bind() {
|
|
89
92
|
super.bind();
|
|
90
93
|
this.on("beforeCreate", this.listener);
|
|
94
|
+
this.on("beforeBulkCreate", this.listener);
|
|
91
95
|
this.on("beforeUpdate", this.listener);
|
|
92
96
|
}
|
|
93
97
|
unbind() {
|
|
94
98
|
super.unbind();
|
|
95
99
|
this.off("beforeCreate", this.listener);
|
|
100
|
+
this.off("beforeBulkCreate", this.listener);
|
|
96
101
|
this.off("beforeUpdate", this.listener);
|
|
97
102
|
}
|
|
98
103
|
};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/database",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"types": "./lib/index.d.ts",
|
|
7
7
|
"license": "AGPL-3.0",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@nocobase/logger": "1.7.
|
|
10
|
-
"@nocobase/utils": "1.7.
|
|
9
|
+
"@nocobase/logger": "1.7.17",
|
|
10
|
+
"@nocobase/utils": "1.7.17",
|
|
11
11
|
"async-mutex": "^0.3.2",
|
|
12
12
|
"chalk": "^4.1.1",
|
|
13
13
|
"cron-parser": "4.4.0",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"url": "git+https://github.com/nocobase/nocobase.git",
|
|
39
39
|
"directory": "packages/database"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "8ce9059c5ef058528b6af724f4022fe8a6667ddc"
|
|
42
42
|
}
|