@riocrypto/common 1.0.408 → 1.0.411

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.
@@ -38,7 +38,6 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
38
38
  catch (err) { }
39
39
  }
40
40
  if ((_c = (_b = req.currentAuth) === null || _b === void 0 ? void 0 : _b.missing) === null || _c === void 0 ? void 0 : _c.includes("password")) {
41
- console.log("hit");
42
41
  throw new missing_password_error_1.MissingPasswordError();
43
42
  }
44
43
  if ((_e = (_d = req.currentAuth) === null || _d === void 0 ? void 0 : _d.missing) === null || _e === void 0 ? void 0 : _e.includes("securityQuestion")) {
@@ -63,9 +62,6 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
63
62
  phoneNumber: req.currentAuth.phoneNumber,
64
63
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
65
64
  });
66
- if (!individualUser) {
67
- throw new missing_user_error_1.MissingUserError();
68
- }
69
65
  }
70
66
  catch (err) {
71
67
  individualUser = null;
@@ -76,9 +72,6 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
76
72
  phoneNumber: req.currentAuth.phoneNumber,
77
73
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
78
74
  });
79
- if (!businessUser) {
80
- throw new missing_user_error_1.MissingUserError();
81
- }
82
75
  }
83
76
  catch (err) {
84
77
  businessUser = null;
@@ -135,7 +128,12 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
135
128
  if (missingKYC) {
136
129
  throw new missing_kyc_approval_error_1.MissingKYCApprovalError();
137
130
  }
138
- if ((_g = req.cookies) === null || _g === void 0 ? void 0 : _g.jwt) {
131
+ console.log(authorizationTypes);
132
+ console.log(req.cookies);
133
+ if ((authorizationTypes.includes(authorization_type_1.AuthorizationType.User) ||
134
+ authorizationTypes.includes(authorization_type_1.AuthorizationType.UserNoKYC)) &&
135
+ ((_g = req.cookies) === null || _g === void 0 ? void 0 : _g.jwt)) {
136
+ console.log("hit");
139
137
  throw new missing_user_error_1.MissingUserError();
140
138
  }
141
139
  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.408",
3
+ "version": "1.0.411",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",