@tiledesk/tiledesk-server 2.4.86 → 2.4.87

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.4.87
9
+ - Updated tybot-connector to 0.2.43
10
+ - Updated whatsapp-connector to 0.1.59
11
+
8
12
  # 2.4.86
9
13
  - Updated tybot-connector to 0.2.41
10
14
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.4.86",
4
+ "version": "2.4.87",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -45,8 +45,8 @@
45
45
  "@tiledesk/tiledesk-messenger-connector": "^0.1.13",
46
46
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
47
47
  "@tiledesk/tiledesk-telegram-connector": "^0.1.10",
48
- "@tiledesk/tiledesk-tybot-connector": "^0.2.41",
49
- "@tiledesk/tiledesk-whatsapp-connector": "^0.1.58",
48
+ "@tiledesk/tiledesk-tybot-connector": "^0.2.43",
49
+ "@tiledesk/tiledesk-whatsapp-connector": "^0.1.59",
50
50
  "@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.7",
51
51
  "amqplib": "^0.5.5",
52
52
  "app-root-path": "^3.0.0",
package/routes/auth.js CHANGED
@@ -382,7 +382,29 @@ router.post('/signinWithCustomToken', [
382
382
 
383
383
  if (req.user.role && (req.user.role === RoleConstants.OWNER || req.user.role === RoleConstants.ADMIN || req.user.role === RoleConstants.AGENT)) {
384
384
  let userFromDB = await User.findOne({email: req.user.email , status: 100}).exec();
385
- return res.json({ success: true, token: req.headers["authorization"], user: userFromDB });
385
+
386
+ var signOptions = {
387
+ issuer: 'https://tiledesk.com',
388
+ subject: 'user',
389
+ audience: 'https://tiledesk.com',
390
+ jwtid: uuidv4()
391
+ };
392
+
393
+ var alg = process.env.GLOBAL_SECRET_ALGORITHM;
394
+ if (alg) {
395
+ signOptions.algorithm = alg;
396
+ }
397
+
398
+ //remove password //test it
399
+ let userJson = userFromDB.toObject();
400
+ delete userJson.password;
401
+
402
+ let returnToken = jwt.sign(userJson, configSecret, signOptions); //priv_jwt pp_jwt
403
+
404
+
405
+ return res.json({ success: true, token: "JWT " + returnToken, user: userFromDB });
406
+ // return res.json({ success: true, token: req.headers["authorization"], user: userFromDB });
407
+
386
408
 
387
409
  } else {
388
410
  return res.json({ success: true, token: req.headers["authorization"], user: userToReturn });