@riocrypto/common 1.0.417 → 1.0.419

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.
@@ -86,12 +86,10 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
86
86
  let businessUser;
87
87
  try {
88
88
  const User = yield (0, user_1.buildUser)(mongoose);
89
- console.log(req.currentAuth);
90
89
  individualUser = yield User.findOne({
91
90
  phoneNumber: req.currentAuth.phoneNumber,
92
91
  attributes: { $ne: user_attribute_1.UserAttribute.deleted },
93
92
  });
94
- console.log(individualUser);
95
93
  if (!individualUser) {
96
94
  throw new Error();
97
95
  }
@@ -121,23 +119,22 @@ const authorize = (req, res, next, mongoose, authorizationTypes) => __awaiter(vo
121
119
  businessUser = null;
122
120
  }
123
121
  const user = individualUser || businessUser;
124
- console.log("final user is ", user);
125
122
  if (user) {
126
123
  req.user = user;
127
124
  }
128
125
  }
129
126
  if ((!req.currentAdminAuth && !req.currentAuth && !req.user) ||
130
- (req.currentAuth && !authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth))) {
127
+ (req.currentAuth &&
128
+ !authorizationTypes.includes(authorization_type_1.AuthorizationType.Auth) &&
129
+ !req.user)) {
131
130
  if (missingKYC) {
132
131
  throw new missing_kyc_approval_error_1.MissingKYCApprovalError();
133
132
  }
134
133
  if ((authorizationTypes.includes(authorization_type_1.AuthorizationType.User) ||
135
134
  authorizationTypes.includes(authorization_type_1.AuthorizationType.UserNoKYC)) &&
136
135
  ((_g = req.cookies) === null || _g === void 0 ? void 0 : _g.jwt)) {
137
- console.log("chimichanga");
138
136
  throw new missing_user_error_1.MissingUserError();
139
137
  }
140
- console.log("throwing");
141
138
  throw new not_authorized_error_1.NotAuthorizedError();
142
139
  }
143
140
  next();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riocrypto/common",
3
- "version": "1.0.417",
3
+ "version": "1.0.419",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",