From 983c582f43ab0f83d78f067c88f52adeea58367c Mon Sep 17 00:00:00 2001
From: elit04 <elit04@fu-berlin.de>
Date: Sat, 15 Jan 2022 08:33:25 -0500
Subject: [PATCH] check if Id exists again(previous version was not right/full)

---
 server/src/controllers/accounts.controllers.ts | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/server/src/controllers/accounts.controllers.ts b/server/src/controllers/accounts.controllers.ts
index 4d8f165..31b3e09 100644
--- a/server/src/controllers/accounts.controllers.ts
+++ b/server/src/controllers/accounts.controllers.ts
@@ -127,6 +127,10 @@ const updateAccount = async (req: Request, res: Response) => {
       },
     });
 
+    if (checkIfIdExists === null) {
+      return res.status(404).json({ success: false, error: "accountNotFound" });
+    }
+
     //hash given password
     if (input.password !== undefined) {
       input.password = await bcrypt.hash(input.password, 10);
-- 
GitLab