diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts
index 7ab30f03..902a2e45 100644
--- a/api/src/routes/users/@me/index.ts
+++ b/api/src/routes/users/@me/index.ts
@@ -30,15 +30,15 @@ router.get("/", route({}), async (req: Request, res: Response) => {
});
router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res: Response) => {
- if (req.user_id === "992772978150273216") throw new HTTPError("Demo user, sorry", 400);
-
const body = req.body as UserModifySchema;
+ const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] });
+
+ if (user.email == "demo@maddy.k.vu") throw new HTTPError("Demo user, sorry", 400);
+
if (body.avatar) body.avatar = await handleFile(`/avatars/${req.user_id}`, body.avatar as string);
if (body.banner) body.banner = await handleFile(`/banners/${req.user_id}`, body.banner as string);
- const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] });
-
if (body.password) {
if (user.data?.hash) {
const same_password = await bcrypt.compare(body.password, user.data.hash || "");
|