@drax/identity-back 0.22.0 → 0.24.0
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/controllers/UserController.js +9 -2
- package/package.json +8 -8
- package/src/controllers/UserController.ts +9 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/types/controllers/UserController.d.ts +1 -1
- package/types/controllers/UserController.d.ts.map +1 -1
- package/types/graphql/resolvers/user.resolvers.d.ts +1 -1
- package/types/schemas/RegisterSchema.d.ts +2 -2
- package/types/schemas/RoleSchema.d.ts +7 -7
- package/types/schemas/TenantSchema.d.ts +2 -2
- package/types/schemas/UserApiKeySchema.d.ts +4 -4
- package/types/schemas/UserSchema.d.ts +6 -6
- package/types/services/UserService.d.ts +2 -2
- package/types/utils/AuthUtils.d.ts +2 -3
- package/types/utils/AuthUtils.d.ts.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractFastifyController } from "@drax/crud-back";
|
|
2
2
|
import RegistrationCompleteHtml from "../html/RegistrationCompleteHtml.js";
|
|
3
|
-
import { CommonConfig, DraxConfig, StoreManager, ValidationError, UnauthorizedError, } from "@drax/common-back";
|
|
3
|
+
import { CommonConfig, DraxConfig, StoreManager, ValidationError, UnauthorizedError, SecuritySensitiveError, } from "@drax/common-back";
|
|
4
4
|
import UserServiceFactory from "../factory/UserServiceFactory.js";
|
|
5
5
|
import RoleServiceFactory from "../factory/RoleServiceFactory.js";
|
|
6
6
|
import UserPermissions from "../permissions/UserPermissions.js";
|
|
@@ -217,13 +217,20 @@ class UserController extends AbstractFastifyController {
|
|
|
217
217
|
}
|
|
218
218
|
const userService = UserServiceFactory();
|
|
219
219
|
const code = await userService.recoveryCode(email);
|
|
220
|
+
console.log("CODE", code);
|
|
220
221
|
if (code) {
|
|
221
222
|
await UserEmailService.recoveryCode(code, email);
|
|
222
223
|
}
|
|
223
224
|
reply.send({ message });
|
|
224
225
|
}
|
|
225
226
|
catch (e) {
|
|
226
|
-
|
|
227
|
+
console.error("ERROR RECOVERY", e);
|
|
228
|
+
if (e instanceof SecuritySensitiveError) {
|
|
229
|
+
reply.send({ message });
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
this.handleError(e, reply);
|
|
233
|
+
}
|
|
227
234
|
}
|
|
228
235
|
}
|
|
229
236
|
async recoveryPasswordComplete(request, reply) {
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.24.0",
|
|
7
7
|
"description": "Identity module for user management, authentication and authorization.",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "types/index.d.ts",
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
"author": "Cristian Incarnato & Drax Team",
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@drax/common-back": "^0.
|
|
32
|
-
"@drax/crud-back": "^0.
|
|
33
|
-
"@drax/crud-share": "^0.
|
|
34
|
-
"@drax/email-back": "^0.
|
|
35
|
-
"@drax/identity-share": "^0.
|
|
31
|
+
"@drax/common-back": "^0.24.0",
|
|
32
|
+
"@drax/crud-back": "^0.24.0",
|
|
33
|
+
"@drax/crud-share": "^0.24.0",
|
|
34
|
+
"@drax/email-back": "^0.24.0",
|
|
35
|
+
"@drax/identity-share": "^0.24.0",
|
|
36
36
|
"bcryptjs": "^2.4.3",
|
|
37
37
|
"graphql": "^16.8.2",
|
|
38
38
|
"jsonwebtoken": "^9.0.2"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/node": "^20.12.10",
|
|
51
51
|
"copyfiles": "^2.4.1",
|
|
52
52
|
"glob": "^10.2.6",
|
|
53
|
-
"mongodb-memory-server": "^
|
|
53
|
+
"mongodb-memory-server": "^10.1.4",
|
|
54
54
|
"nodemon": "^3.1.0",
|
|
55
55
|
"ts-node": "^10.9.2",
|
|
56
56
|
"tsc-alias": "^1.8.10",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"debug": "0"
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "3e6de6c6155a2a0f2e0dae36849dec7db6eb0b09"
|
|
67
67
|
}
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
DraxConfig,
|
|
7
7
|
StoreManager,
|
|
8
8
|
ValidationError,
|
|
9
|
-
UnauthorizedError,
|
|
9
|
+
UnauthorizedError, SecuritySensitiveError,
|
|
10
10
|
} from "@drax/common-back";
|
|
11
11
|
|
|
12
12
|
import UserServiceFactory from "../factory/UserServiceFactory.js";
|
|
@@ -253,6 +253,8 @@ class UserController extends AbstractFastifyController<IUser, IUserCreate, IUser
|
|
|
253
253
|
const userService = UserServiceFactory()
|
|
254
254
|
const code = await userService.recoveryCode(email)
|
|
255
255
|
|
|
256
|
+
console.log("CODE", code)
|
|
257
|
+
|
|
256
258
|
if (code) {
|
|
257
259
|
await UserEmailService.recoveryCode(code, email)
|
|
258
260
|
}
|
|
@@ -260,7 +262,12 @@ class UserController extends AbstractFastifyController<IUser, IUserCreate, IUser
|
|
|
260
262
|
reply.send({message})
|
|
261
263
|
|
|
262
264
|
} catch (e) {
|
|
263
|
-
|
|
265
|
+
console.error("ERROR RECOVERY", e)
|
|
266
|
+
if(e instanceof SecuritySensitiveError){
|
|
267
|
+
reply.send({message})
|
|
268
|
+
}else{
|
|
269
|
+
this.handleError(e,reply)
|
|
270
|
+
}
|
|
264
271
|
}
|
|
265
272
|
}
|
|
266
273
|
|