@live-change/secret-code-service 0.9.203 → 0.9.205
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 +7 -4
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -53,7 +53,7 @@ definition.event({
|
|
|
53
53
|
definition.event({
|
|
54
54
|
name: 'codeExpired',
|
|
55
55
|
execute({ code }) {
|
|
56
|
-
return Code.update(code, {
|
|
56
|
+
return Code.update(code, { expire: new Date(Date.now() - 1000) })
|
|
57
57
|
}
|
|
58
58
|
})
|
|
59
59
|
|
|
@@ -93,9 +93,12 @@ definition.trigger({
|
|
|
93
93
|
},
|
|
94
94
|
waitForEvents: true,
|
|
95
95
|
async execute({ authentication }, context, emit) {
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
const rows = await Code.indexRangeGet('byAuthentication', authentication) || []
|
|
97
|
+
const nowMs = Date.now()
|
|
98
|
+
for (const row of rows) {
|
|
99
|
+
if (new Date(row.expire).getTime() > nowMs) {
|
|
100
|
+
emit({ type: 'codeExpired', code: row.id })
|
|
101
|
+
}
|
|
99
102
|
}
|
|
100
103
|
const code = app.generateUid()
|
|
101
104
|
const digits = config.digits || 6
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@live-change/secret-code-service",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.205",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,8 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"type": "module",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@live-change/framework": "^0.9.
|
|
25
|
+
"@live-change/framework": "^0.9.205",
|
|
26
26
|
"nodemailer": "^6.7.2"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "ef195e51ea283e56d891b11da5d5f586691507db"
|
|
29
29
|
}
|