free-be-account 0.0.10 → 0.0.11
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.
- package/index.js +14 -12
- package/package.json +1 -1
- package/sms/index.js +2 -2
package/index.js
CHANGED
|
@@ -1121,18 +1121,20 @@ module.exports = (app) => ({
|
|
|
1121
1121
|
const phone = crypto.encoder.desDecode(req.body.PhoneNumber, m.config.desKey);
|
|
1122
1122
|
|
|
1123
1123
|
// check user existance if necessary
|
|
1124
|
-
|
|
1125
|
-
{
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1124
|
+
if (req.body.exists !== 'all') {
|
|
1125
|
+
const existsCount = await res.app.models.account.countDocuments({$or: [
|
|
1126
|
+
{ PhoneNumber: phone },
|
|
1127
|
+
{ 'Profile.Email': phone },
|
|
1128
|
+
]});
|
|
1129
|
+
|
|
1130
|
+
if (req.body.exists && existsCount <= 0) {
|
|
1131
|
+
res.makeError(409, 'User not exists!', m);
|
|
1132
|
+
return next('route');
|
|
1133
|
+
}
|
|
1134
|
+
if (!req.body.exists && existsCount > 0) {
|
|
1135
|
+
res.makeError(410, 'User aleady exists!', m);
|
|
1136
|
+
return next('route');
|
|
1137
|
+
}
|
|
1136
1138
|
}
|
|
1137
1139
|
|
|
1138
1140
|
const result = await m.sms.sendRandom(phone, undefined, true, req.body.smsTemp || 'register');
|
package/package.json
CHANGED
package/sms/index.js
CHANGED
|
@@ -5,8 +5,8 @@ const nodemailer = require('nodemailer');
|
|
|
5
5
|
|
|
6
6
|
let global;
|
|
7
7
|
|
|
8
|
-
if (fs.existsSync(path.resolve(__dirname, '
|
|
9
|
-
global = require('
|
|
8
|
+
if (fs.existsSync(path.resolve(__dirname, '../../../global.js'))) {
|
|
9
|
+
global = require('../../../global');
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
let MAIL_TRANS = undefined;
|