From ab430d167f52eaddb0ac94b4394769c275441d03 Mon Sep 17 00:00:00 2001 From: Tanner Shaw Date: Sat, 11 Nov 2023 14:09:28 -0600 Subject: [PATCH] fix(endpoints) checkpassword endpoints checks for passwordhash and encryption --- src/endpoints/rooms/rooms.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/endpoints/rooms/rooms.ts b/src/endpoints/rooms/rooms.ts index 3549731..137c740 100644 --- a/src/endpoints/rooms/rooms.ts +++ b/src/endpoints/rooms/rooms.ts @@ -276,10 +276,16 @@ router.post('/checkpasswordhash/:id', limiter, (req: Request, res: Response) => roomId: id }, select: { - passwordHash: true + passwordHash: true, + encrypted: true } }) .then((room) => { + if (room && !room.passwordHash && room.encrypted === 'AES') { + res.status(200).json({ success: false, message: 'Room is not initialized, no password set' }); + return; + } + if (room && room.passwordHash === passwordHash) { res.status(200).json({ success: true }); } else {