free-be-account 0.0.11 → 0.0.13

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 CHANGED
@@ -1070,7 +1070,7 @@ module.exports = (app) => ({
1070
1070
  let access_token = req.cookies.token || req.header('Authorization');
1071
1071
 
1072
1072
  // call logout of the passport
1073
- req.logout();
1073
+ req.logout(() => {});
1074
1074
 
1075
1075
  // clear the cached token
1076
1076
  res.clearCookie('token');
@@ -1144,7 +1144,7 @@ module.exports = (app) => ({
1144
1144
  return next('route');
1145
1145
  }
1146
1146
  } catch (ex) {
1147
- res.makeError(500, ex.message || 'Failed to send sms!', m);
1147
+ res.makeError(502, ex.message || 'Failed to send sms!', m);
1148
1148
  return next('route');
1149
1149
  }
1150
1150
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-be-account",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "main": "index.js",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -9,14 +9,14 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "@alicloud/pop-core": "^1.7.12",
12
- "axios": "^1.3.4",
13
- "bcrypt": "^5.0.1",
12
+ "axios": "^1.3.5",
13
+ "bcrypt": "^5.1.0",
14
14
  "crypto-js": "^4.1.1",
15
15
  "js-md5": "^0.7.3",
16
16
  "nodemailer": "^6.9.1",
17
- "passport": "^0.5.0",
17
+ "passport": "^0.6.0",
18
18
  "passport-local": "^1.0.0",
19
19
  "svg-captcha": "^1.4.0",
20
- "uuid": "^8.3.2"
20
+ "uuid": "^9.0.0"
21
21
  }
22
22
  }
package/sms/index.js CHANGED
@@ -132,10 +132,12 @@ module.exports = (app) => ({
132
132
  const keys = (global && global.sms && global.sms[t]) || app.modules.account.config.sms.keys[t] || app.modules.account.config.sms.keys;
133
133
 
134
134
  if (keys.platform) {
135
- // if the cached code still there, we should not re-send!
136
- if (await app.cache.get(p)) {
135
+ // should not send too frequent!
136
+ const lastSentTime = await app.cache.get(`${p}_lastSentTime`);
137
+ if (lastSentTime && (Date.now() - lastSentTime) < (keys.resentGap || (60 * 1000))) {
137
138
  throw new Error('Cannot send too frequently!');
138
139
  }
140
+
139
141
  if (_sms_lib[keys.platform]) {
140
142
  let sent = true;
141
143
  const v = keys.fixedCode || value;
@@ -150,6 +152,7 @@ module.exports = (app) => ({
150
152
  if (c) {
151
153
  const cTime = keys.cacheTime || (5 * 60 * 1000)
152
154
  await app.cache.put(p, v, cTime);
155
+ await app.cache.put(`${p}_lastSentTime`, Date.now(), cTime);
153
156
  }
154
157
  return true;
155
158
  } else {