propro-utils 1.5.11 → 1.5.13
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.
- package/middlewares/account_info.js +13 -5
- package/package.json +1 -1
- package/src/server/index.js +1 -1
|
@@ -66,14 +66,22 @@ const getAccountProfile = async (redisClient, userSchema, accountId) => {
|
|
|
66
66
|
* @returns {Promise<user>} - A promise that resolves once the check/create operation is done.
|
|
67
67
|
*/
|
|
68
68
|
const checkIfUserExists = async (userSchema, accountId) => {
|
|
69
|
+
console.log('accountId', accountId);
|
|
69
70
|
const user = await userSchema.findOne({ accountId });
|
|
71
|
+
console.log('user', user);
|
|
70
72
|
if (!user) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
try {
|
|
74
|
+
const user = await userSchema.create({
|
|
75
|
+
accountId,
|
|
76
|
+
id: uuidv4(),
|
|
77
|
+
verified: false,
|
|
78
|
+
});
|
|
79
|
+
return user;
|
|
80
|
+
} catch (error) {
|
|
81
|
+
throw new Error('Error creating user');
|
|
82
|
+
}
|
|
76
83
|
}
|
|
84
|
+
console.log('user', user);
|
|
77
85
|
return user;
|
|
78
86
|
};
|
|
79
87
|
|
package/package.json
CHANGED
package/src/server/index.js
CHANGED
|
@@ -328,7 +328,7 @@ class AuthMiddleware {
|
|
|
328
328
|
|
|
329
329
|
proxyToAuthServer = async (req, path) => {
|
|
330
330
|
let accessToken = null;
|
|
331
|
-
if (this.pathRequiresAccessToken(path)) {
|
|
331
|
+
if (!this.pathRequiresAccessToken(path)) {
|
|
332
332
|
console.log('path requires access token');
|
|
333
333
|
accessToken = req.cookies['x-access-token'];
|
|
334
334
|
if (!accessToken) {
|