@proteinjs/user-server 1.2.4 → 1.2.6
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.2.6](https://github.com/proteinjs/user/compare/@proteinjs/user-server@1.2.5...@proteinjs/user-server@1.2.6) (2024-08-16)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* password reset logic ([a02cab4](https://github.com/proteinjs/user/commit/a02cab41355f0f4484b3351509ec8a113a775317))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [1.2.4](https://github.com/proteinjs/user/compare/@proteinjs/user-server@1.2.3...@proteinjs/user-server@1.2.4) (2024-08-16)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initiatePasswordReset.d.ts","sourceRoot":"","sources":["../../../src/routes/initiatePasswordReset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAW9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"initiatePasswordReset.d.ts","sourceRoot":"","sources":["../../../src/routes/initiatePasswordReset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAW9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,qBAAqB,EAAE,KA+DnC,CAAC"}
|
|
@@ -94,9 +94,8 @@ exports.initiatePasswordReset = {
|
|
|
94
94
|
}
|
|
95
95
|
currentTime = (0, moment_1.default)();
|
|
96
96
|
if (user.passwordResetToken && user.passwordResetTokenExpiration) {
|
|
97
|
-
tokenAge = (0, moment_1.default)(
|
|
98
|
-
if (tokenAge
|
|
99
|
-
// Token is less than 5 minutes old
|
|
97
|
+
tokenAge = (0, moment_1.default)(currentTime).diff(user.passwordResetTokenExpiration, 'minutes');
|
|
98
|
+
if (tokenAge >= 0 && tokenAge < 5) {
|
|
100
99
|
logger.info({ message: "Password reset requested too soon for user", obj: { email: email } });
|
|
101
100
|
response.send(genericResponse);
|
|
102
101
|
return [2 /*return*/];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initiatePasswordReset.js","sourceRoot":"","sources":["../../../src/routes/initiatePasswordReset.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oCAA8C;AAC9C,wCAA2D;AAC3D,4CAA2C;AAC3C,kDAA4B;AAC5B,wDAGiC;AACjC,uCAAgC;AAEhC;;;;;;;;;;;;GAYG;AACU,QAAA,qBAAqB,GAAU;IAC1C,IAAI,EAAE,aAAM,CAAC,qBAAqB,CAAC,IAAI;IACvC,MAAM,EAAE,aAAM,CAAC,qBAAqB,CAAC,MAAM;IAC3C,SAAS,EAAE,UAAO,OAAO,EAAE,QAAQ;;;;;;oBAC3B,MAAM,GAAG,IAAI,eAAM,CAAC,EAAE,IAAI,EAAE,uBAAuB,EAAE,CAAC,CAAC;oBACrD,KAAK,GAAK,OAAO,CAAC,IAAI,MAAjB,CAAkB;oBACzB,EAAE,GAAG,IAAA,kBAAa,GAAE,CAAC;oBAErB,eAAe,GAAG,EAAE,OAAO,EAAE,2EAA2E,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"initiatePasswordReset.js","sourceRoot":"","sources":["../../../src/routes/initiatePasswordReset.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,oCAA8C;AAC9C,wCAA2D;AAC3D,4CAA2C;AAC3C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KAAK,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,GAAG,EAAE,EAAE,KAAK,OAAA,EAAE,EAAE,KAAK,SAAA,EAAE,CAAC,CAAC;oBACxF,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,8DAA8D,EAAE,CAAC,CAAC;;;;;SAExG;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proteinjs/user-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "User server components",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"watch": "reflection-watch"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@proteinjs/db": "1.5.
|
|
25
|
-
"@proteinjs/email-server": "1.2.
|
|
26
|
-
"@proteinjs/logger": "1.0.
|
|
27
|
-
"@proteinjs/reflection": "1.1.
|
|
28
|
-
"@proteinjs/server": "1.
|
|
29
|
-
"@proteinjs/server-api": "1.4.
|
|
30
|
-
"@proteinjs/user": "^1.1.
|
|
24
|
+
"@proteinjs/db": "1.5.8",
|
|
25
|
+
"@proteinjs/email-server": "1.2.2",
|
|
26
|
+
"@proteinjs/logger": "1.0.5",
|
|
27
|
+
"@proteinjs/reflection": "1.1.9",
|
|
28
|
+
"@proteinjs/server": "1.7.1",
|
|
29
|
+
"@proteinjs/server-api": "1.4.3",
|
|
30
|
+
"@proteinjs/user": "^1.1.5",
|
|
31
31
|
"crypto-js": "4.0.0",
|
|
32
32
|
"express-session": "1.17.1",
|
|
33
33
|
"moment": "2.29.4"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@proteinjs/reflection-build": "1.0.
|
|
36
|
+
"@proteinjs/reflection-build": "1.0.24",
|
|
37
37
|
"@types/crypto-js": "4.0.1",
|
|
38
38
|
"@types/express-session": "1.17.0",
|
|
39
39
|
"@types/node": "14.0.13",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
},
|
|
47
47
|
"main": "./dist/generated/index.js",
|
|
48
48
|
"types": "./dist/generated/index.d.ts",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "20962548213c282bfa5333dd9b662c4cb103e4d7"
|
|
50
50
|
}
|
|
@@ -32,7 +32,6 @@ export const initiatePasswordReset: Route = {
|
|
|
32
32
|
|
|
33
33
|
const genericResponse = { message: 'If an account with that email exists, we have sent a password reset link.' };
|
|
34
34
|
|
|
35
|
-
// Check if user exists
|
|
36
35
|
const user = await db.get(tables.User, { email });
|
|
37
36
|
if (!user) {
|
|
38
37
|
logger.info({ message: `Password reset requested for non-existent user`, obj: { email } });
|
|
@@ -44,9 +43,8 @@ export const initiatePasswordReset: Route = {
|
|
|
44
43
|
// Check if there's an existing token and it's less than 5 minutes old
|
|
45
44
|
const currentTime = moment();
|
|
46
45
|
if (user.passwordResetToken && user.passwordResetTokenExpiration) {
|
|
47
|
-
const tokenAge = moment(
|
|
48
|
-
if (tokenAge
|
|
49
|
-
// Token is less than 5 minutes old
|
|
46
|
+
const tokenAge = moment(currentTime).diff(user.passwordResetTokenExpiration, 'minutes');
|
|
47
|
+
if (tokenAge >= 0 && tokenAge < 5) {
|
|
50
48
|
logger.info({ message: `Password reset requested too soon for user`, obj: { email } });
|
|
51
49
|
response.send(genericResponse);
|
|
52
50
|
return;
|