@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 +4 -0
- package/package.json +3 -3
- package/routes/auth.js +23 -1
package/CHANGELOG.md
CHANGED
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.
|
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.
|
49
|
-
"@tiledesk/tiledesk-whatsapp-connector": "^0.1.
|
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
|
-
|
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 });
|