@misalon/common 1.0.16 → 1.0.17

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.
@@ -7,21 +7,19 @@ exports.currentUser = void 0;
7
7
  var jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
8
8
  var currentUser = function (req, res, next) {
9
9
  var _a, _b;
10
- console.log('Session JWT:', (_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt); // Log the JWT from session
10
+ console.log('[auth] Session JWT:', (_a = req.session) === null || _a === void 0 ? void 0 : _a.jwt); // Log session JWT
11
11
  if (!((_b = req.session) === null || _b === void 0 ? void 0 : _b.jwt)) {
12
- console.log('No JWT in session, skipping user authentication');
13
- return next(); // No JWT in session, move to the next middleware
12
+ console.log('[auth] No JWT in session, skipping user authentication');
13
+ return next();
14
14
  }
15
15
  try {
16
- // Log before decoding
17
- console.log('Attempting to decode JWT...');
18
16
  var payload = jsonwebtoken_1.default.verify(req.session.jwt, process.env.JWT_KEY);
19
- console.log('Decoded JWT Payload:', payload); // Log the decoded payload
20
- req.currentUser = payload; // Attach user information to request
17
+ req.currentUser = payload;
18
+ console.log('[auth] Current User:', req.currentUser);
21
19
  }
22
20
  catch (err) {
23
- console.error('Error decoding JWT:', err); // Log any decoding errors
21
+ console.error('[auth] Error decoding JWT:', err);
24
22
  }
25
- next(); // Proceed to the next middleware or route handler
23
+ next();
26
24
  };
27
25
  exports.currentUser = currentUser;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misalon/common",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "main": "./build/index.js",
5
5
  "types": "./build/index.d.ts",
6
6
  "files": [