powr-sdk-api 4.15.1 → 4.15.2
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/dist/routes/auth.js +4 -3
- package/package.json +1 -1
package/dist/routes/auth.js
CHANGED
|
@@ -32,15 +32,16 @@ const {
|
|
|
32
32
|
decideImpersonation
|
|
33
33
|
} = require("../utils/impersonate");
|
|
34
34
|
const jwt = require("jsonwebtoken");
|
|
35
|
+
const PASSWORD_RESET_TTL_MS = 24 * 60 * 60 * 1000;
|
|
35
36
|
async function issuePasswordResetLink(db, user, appUrl) {
|
|
37
|
+
const expiresAt = new Date(Date.now() + PASSWORD_RESET_TTL_MS);
|
|
36
38
|
const resetPayload = {
|
|
37
39
|
userId: user._id.toString(),
|
|
38
40
|
type: "reset",
|
|
39
41
|
iat: Math.floor(Date.now() / 1000),
|
|
40
|
-
exp: Math.floor(
|
|
42
|
+
exp: Math.floor(expiresAt.getTime() / 1000)
|
|
41
43
|
};
|
|
42
44
|
const resetToken = jwt.sign(resetPayload, config.jwtToken);
|
|
43
|
-
const expiresAt = new Date(Date.now() + 3600000);
|
|
44
45
|
await db.collection("users").updateOne({
|
|
45
46
|
_id: user._id
|
|
46
47
|
}, {
|
|
@@ -484,7 +485,7 @@ router.post("/forgot-password", async (req, res) => {
|
|
|
484
485
|
}
|
|
485
486
|
});
|
|
486
487
|
|
|
487
|
-
/** Ops / WhatsApp: mint a one-
|
|
488
|
+
/** Ops / WhatsApp: mint a one-day reset link. Service key only — never expose to browsers. */
|
|
488
489
|
router.post("/password-reset-link", verifyTokenOrServiceKey, async (req, res) => {
|
|
489
490
|
if (!req.serviceCall) {
|
|
490
491
|
return res.status(403).json({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "powr-sdk-api",
|
|
3
|
-
"version": "4.15.
|
|
3
|
+
"version": "4.15.2",
|
|
4
4
|
"description": "Shared API core library for PowrStack projects. Zero dependencies - works with Express, Next.js API routes, and other frameworks. All features are optional and install only what you need.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|