@riocrypto/common 1.0.400 → 1.0.401
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.
|
@@ -30,22 +30,19 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
30
30
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth) ||
|
|
31
31
|
authorizationTypes.includes(authorization_type_1.AuthorizationType.UserNoKYC) ||
|
|
32
32
|
authorizationTypes.includes(authorization_type_1.AuthorizationType.User)) {
|
|
33
|
-
|
|
34
|
-
if ((_b = (_a = req.currentAuth) === null || _a === void 0 ? void 0 : _a.missing) === null || _b === void 0 ? void 0 : _b.includes("password")) {
|
|
35
|
-
throw new missing_password_error_1.MissingPasswordError();
|
|
36
|
-
}
|
|
37
|
-
if ((_d = (_c = req.currentAuth) === null || _c === void 0 ? void 0 : _c.missing) === null || _d === void 0 ? void 0 : _d.includes("securityQuestion")) {
|
|
38
|
-
throw new missing_security_question_error_1.MissingSecurityQuestionError();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth)) {
|
|
42
|
-
if ((_e = req.cookies) === null || _e === void 0 ? void 0 : _e.jwt) {
|
|
33
|
+
if ((_a = req.cookies) === null || _a === void 0 ? void 0 : _a.jwt) {
|
|
43
34
|
try {
|
|
44
35
|
const payload = jsonwebtoken_1.default.verify(req.cookies.jwt, process.env.JWT_KEY);
|
|
45
36
|
req.currentAuth = payload;
|
|
46
37
|
}
|
|
47
38
|
catch (err) { }
|
|
48
39
|
}
|
|
40
|
+
if ((_c = (_b = req.currentAuth) === null || _b === void 0 ? void 0 : _b.missing) === null || _c === void 0 ? void 0 : _c.includes("password")) {
|
|
41
|
+
throw new missing_password_error_1.MissingPasswordError();
|
|
42
|
+
}
|
|
43
|
+
if ((_e = (_d = req.currentAuth) === null || _d === void 0 ? void 0 : _d.missing) === null || _e === void 0 ? void 0 : _e.includes("securityQuestion")) {
|
|
44
|
+
throw new missing_security_question_error_1.MissingSecurityQuestionError();
|
|
45
|
+
}
|
|
49
46
|
}
|
|
50
47
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Admin)) {
|
|
51
48
|
if ((_f = req.cookies) === null || _f === void 0 ? void 0 : _f.adminJwt) {
|