@growy/strapi-plugin-encrypted-field 1.7.3 → 1.8.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.
- package/package.json +1 -1
- package/server/bootstrap.js +12 -6
package/package.json
CHANGED
package/server/bootstrap.js
CHANGED
|
@@ -2,11 +2,14 @@ const { encrypt, decrypt, validateValue, isEncryptedField } = require('./utils/c
|
|
|
2
2
|
|
|
3
3
|
module.exports = ({ strapi }) => {
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
// Obtener tanto content types como componentes
|
|
6
|
+
const contentTypes = Object.values(strapi.contentTypes);
|
|
7
|
+
const components = Object.values(strapi.components);
|
|
8
|
+
const allModels = [...contentTypes, ...components];
|
|
6
9
|
|
|
7
|
-
strapi.log.info(`Total de
|
|
10
|
+
strapi.log.info(`Total de content types: ${contentTypes.length}, componentes: ${components.length}`);
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
allModels.forEach((model) => {
|
|
10
13
|
const attributes = model.attributes || {};
|
|
11
14
|
|
|
12
15
|
// Debug: mostrar todos los campos del modelo
|
|
@@ -110,8 +113,9 @@ module.exports = ({ strapi }) => {
|
|
|
110
113
|
if (Object.prototype.hasOwnProperty.call(result, key)) {
|
|
111
114
|
const value = result[key];
|
|
112
115
|
if (typeof value === 'string' && value) {
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
const decrypted = decrypt(value, strapi);
|
|
117
|
+
strapi.log.info(`Descifrando campo ${key} en ${event.model.uid}: ${value.substring(0, 20)}... -> ${decrypted}`);
|
|
118
|
+
result[key] = decrypted;
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
}
|
|
@@ -132,7 +136,9 @@ module.exports = ({ strapi }) => {
|
|
|
132
136
|
if (Object.prototype.hasOwnProperty.call(item, key)) {
|
|
133
137
|
const value = item[key];
|
|
134
138
|
if (typeof value === 'string' && value) {
|
|
135
|
-
|
|
139
|
+
const decrypted = decrypt(value, strapi);
|
|
140
|
+
strapi.log.info(`Descifrando campo ${key}: ${value.substring(0, 20)}... -> ${decrypted}`);
|
|
141
|
+
item[key] = decrypted;
|
|
136
142
|
}
|
|
137
143
|
}
|
|
138
144
|
}
|