summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-07 23:25:46 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-07 23:25:46 +1000
commitbba8ae54d7f166ad4df7e29ec6673aece746c438 (patch)
treed2ae072bff9dadce58111845c4d914f134b0f44f
parentFix role icons not deleting? (diff)
downloadserver-bba8ae54d7f166ad4df7e29ec6673aece746c438.tar.xz
Somehow the ID of demo user changed. Use email of demo instead
-rw-r--r--api/src/routes/users/@me/index.ts8
1 files changed, 4 insertions, 4 deletions
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 || "");