@riocrypto/common 1.0.389 → 1.0.390
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.
|
@@ -33,6 +33,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
33
33
|
}
|
|
34
34
|
if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Admin)) {
|
|
35
35
|
if ((_b = req.cookies) === null || _b === void 0 ? void 0 : _b.adminJwt) {
|
|
36
|
+
console.log("got admin");
|
|
36
37
|
try {
|
|
37
38
|
const payload = jsonwebtoken_1.default.verify(req.cookies.adminJwt, process.env.JWT_KEY_ADMIN);
|
|
38
39
|
req.currentAdminAuth = payload;
|
|
@@ -99,10 +100,15 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
|
|
|
99
100
|
}
|
|
100
101
|
const user = individualUser || businessUser;
|
|
101
102
|
if (user) {
|
|
103
|
+
console.log("got user");
|
|
102
104
|
req.user = user;
|
|
103
105
|
}
|
|
104
106
|
}
|
|
107
|
+
console.log("currentAdminAuth", req.currentAdminAuth);
|
|
108
|
+
console.log("currentAuth", req.currentAuth);
|
|
109
|
+
console.log("user", req.user);
|
|
105
110
|
if (!req.currentAdminAuth && !req.currentAuth && !req.user) {
|
|
111
|
+
console.log("throwing error");
|
|
106
112
|
throw new not_authorized_error_1.NotAuthorizedError();
|
|
107
113
|
}
|
|
108
114
|
next();
|