propro-utils 1.3.48 → 1.4.0

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.
@@ -72,7 +72,6 @@ const authValidation = (redisClient, userSchema, requiredPermissions = []) => {
72
72
  if (!user) {
73
73
  return res.status(403).json({ error: 'User not found' });
74
74
  }
75
- console.log('user', user);
76
75
  req.user = user.id;
77
76
  next();
78
77
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.3.48",
3
+ "version": "1.4.0",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -115,7 +115,7 @@ function proproAuthMiddleware(options = {}, userSchema) {
115
115
  redirectUri
116
116
  );
117
117
 
118
- await checkIfUserExists(userSchema, account.accountId);
118
+ const user = await checkIfUserExists(userSchema, account.accountId);
119
119
 
120
120
  const currentDateTime = new Date();
121
121
 
@@ -138,6 +138,10 @@ function proproAuthMiddleware(options = {}, userSchema) {
138
138
  maxAge: accessMaxAge,
139
139
  });
140
140
 
141
+ res.cookie('user', JSON.stringify(user));
142
+
143
+ res.cookie('account', JSON.stringify(account));
144
+
141
145
  const urlToRedirect = `http://${redirectUrl}/`;
142
146
 
143
147
  return res.redirect(urlToRedirect);