@riocrypto/common 1.0.403 → 1.0.405

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.
@@ -25,7 +25,7 @@ const missing_user_error_1 = require("../errors/missing-user-error");
25
25
  const missing_password_error_1 = require("../errors/missing-password-error");
26
26
  const missing_security_question_error_1 = require("../errors/missing-security-question-error");
27
27
  const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(void 0, void 0, void 0, function* () {
28
- var _a, _b, _c, _d, _e, _f, _g;
28
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
29
29
  let missingKYC = false;
30
30
  if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth) ||
31
31
  authorizationTypes.includes(authorization_type_1.AuthorizationType.UserNoKYC) ||
@@ -37,15 +37,20 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
37
37
  }
38
38
  catch (err) { }
39
39
  }
40
- if ((_c = (_b = req.currentAuth) === null || _b === void 0 ? void 0 : _b.missing) === null || _c === void 0 ? void 0 : _c.includes("password")) {
40
+ console.log("req.currentAuth");
41
+ console.log(req.currentAuth);
42
+ console.log((_b = req.currentAuth) === null || _b === void 0 ? void 0 : _b.missing);
43
+ console.log((_d = (_c = req.currentAuth) === null || _c === void 0 ? void 0 : _c.missing) === null || _d === void 0 ? void 0 : _d.includes("password"));
44
+ if ((_f = (_e = req.currentAuth) === null || _e === void 0 ? void 0 : _e.missing) === null || _f === void 0 ? void 0 : _f.includes("password")) {
45
+ console.log("hit");
41
46
  throw new missing_password_error_1.MissingPasswordError();
42
47
  }
43
- if ((_e = (_d = req.currentAuth) === null || _d === void 0 ? void 0 : _d.missing) === null || _e === void 0 ? void 0 : _e.includes("securityQuestion")) {
48
+ if ((_h = (_g = req.currentAuth) === null || _g === void 0 ? void 0 : _g.missing) === null || _h === void 0 ? void 0 : _h.includes("securityQuestion")) {
44
49
  throw new missing_security_question_error_1.MissingSecurityQuestionError();
45
50
  }
46
51
  }
47
52
  if (authorizationTypes.includes(authorization_type_1.AuthorizationType.Admin)) {
48
- if ((_f = req.cookies) === null || _f === void 0 ? void 0 : _f.adminJwt) {
53
+ if ((_j = req.cookies) === null || _j === void 0 ? void 0 : _j.adminJwt) {
49
54
  try {
50
55
  const payload = jsonwebtoken_1.default.verify(req.cookies.adminJwt, process.env.JWT_KEY_ADMIN);
51
56
  req.currentAdminAuth = payload;
@@ -134,7 +139,7 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
134
139
  if (missingKYC) {
135
140
  throw new missing_kyc_approval_error_1.MissingKYCApprovalError();
136
141
  }
137
- if ((_g = req.cookies) === null || _g === void 0 ? void 0 : _g.jwt) {
142
+ if ((_k = req.cookies) === null || _k === void 0 ? void 0 : _k.jwt) {
138
143
  throw new missing_user_error_1.MissingUserError();
139
144
  }
140
145
  throw new not_authorized_error_1.NotAuthorizedError();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.403",
3
+ "version": "1.0.405",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",