@tiledesk/tiledesk-server 2.7.5 → 2.7.7

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -5,6 +5,14 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.7.7
9
+ - Fix update user verifiedEmail with signup from Admin
10
+ - Updated WhatsApp listener to reduce mongodb connections
11
+ - Fix duplicated intents
12
+
13
+ # 2.7.6
14
+ - Fix auth with admin token
15
+
8
16
  # 2.7.5
9
17
  - Added support for bot PRIVATE and PUB ket in auth.js
10
18
 
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.7.5",
4
+ "version": "2.7.7",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -49,7 +49,7 @@
49
49
  "@tiledesk/tiledesk-telegram-connector": "^0.1.10",
50
50
  "@tiledesk/tiledesk-train-jobworker": "^0.0.7",
51
51
  "@tiledesk/tiledesk-tybot-connector": "^0.2.60",
52
- "@tiledesk/tiledesk-whatsapp-connector": "^0.1.64",
52
+ "@tiledesk/tiledesk-whatsapp-connector": "^0.1.65",
53
53
  "@tiledesk/tiledesk-whatsapp-jobworker": "^0.0.7",
54
54
  "amqplib": "^0.5.5",
55
55
  "app-root-path": "^3.0.0",
@@ -1,10 +1,13 @@
1
1
  const whatsapp = require("@tiledesk/tiledesk-whatsapp-connector");
2
2
  var winston = require('../../config/winston');
3
3
  var configGlobal = require('../../config/global');
4
+ const mongoose = require("mongoose");
4
5
 
5
6
  const apiUrl = process.env.API_URL || configGlobal.apiUrl;
6
7
  winston.info('Whatsapp apiUrl: ' + apiUrl);
7
8
 
9
+ const dbConnection = mongoose.connection;
10
+
8
11
  class Listener {
9
12
 
10
13
  listen(config) {
@@ -38,6 +41,7 @@ class Listener {
38
41
 
39
42
  whatsapp.startApp({
40
43
  MONGODB_URL: config.databaseUri,
44
+ dbconnection: dbConnection,
41
45
  API_URL: apiUrl,
42
46
  BASE_FILE_URL: baseFileUrl,
43
47
  GRAPH_URL: graph_url,
package/routes/auth.js CHANGED
@@ -36,7 +36,7 @@ if (pKey) {
36
36
  let pubConfigSecret = process.env.GLOBAL_SECRET || config.secret;
37
37
  var pubKey = process.env.GLOBAL_SECRET_OR_PUB_KEY;
38
38
  if (pubKey) {
39
- pubConfigSecret = pKey.replace(/\\n/g, '\n');
39
+ pubConfigSecret = pubKey.replace(/\\n/g, '\n');
40
40
  }
41
41
 
42
42
  var recaptcha = require('../middleware/recaptcha');
@@ -77,7 +77,7 @@ router.post('/signup',
77
77
  return res.json({ success: false, msg: 'Please pass email and password.' });
78
78
  } else {
79
79
  return userService.signup(req.body.email, req.body.password, req.body.firstname, req.body.lastname, false)
80
- .then(function (savedUser) {
80
+ .then( async function (savedUser) {
81
81
 
82
82
  winston.debug('-- >> -- >> savedUser ', savedUser.toObject());
83
83
 
@@ -87,6 +87,8 @@ router.post('/signup',
87
87
  let token = req.headers.authorization.split(" ")[1];
88
88
  let decode = jwt.verify(token, pubConfigSecret)
89
89
  if (decode && (decode.email === process.env.ADMIN_EMAIL)) {
90
+ let updatedUser = await User.findByIdAndUpdate(savedUser._id, { emailverified: true }, { new: true }).exec();
91
+ winston.debug("updatedUser: ", updatedUser);
90
92
  skipVerificationEmail = true;
91
93
  winston.verbose("skip sending verification email")
92
94
  }