From 2322e38f0c9a3533e86e06e431fdeeeb709b5b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E7=9F=A5=E7=81=AB=20Shiranui?= Date: Mon, 14 Oct 2024 15:26:51 +0000 Subject: [PATCH] fix(tokens.js): bugs in create_token --- src/routes/tokens.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/tokens.js b/src/routes/tokens.js index d9f9183..d70e4bf 100644 --- a/src/routes/tokens.js +++ b/src/routes/tokens.js @@ -82,7 +82,7 @@ router.post("/", // Handle code and metadata const metadata = { - userId: user._id, + userId: user._id.toString(), email: req.body.email, }; const {code, sessionId} = utilCodeSession. @@ -181,7 +181,7 @@ router.patch("/", } // Check metadata user id - if (user._id !== metadata.userId) { + if (user._id.toString() !== metadata.userId) { res.sendStatus(StatusCodes.FORBIDDEN); return; }