summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-03 00:02:01 +1000
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-07-03 00:02:01 +1000
commit6e333f9696bd7557bebc6ba947172ab6a2df8938 (patch)
treecc40a8ed798c513ab43ca18247ffac3d4e691c5d
parentRevert RateLimit.ts (diff)
downloadserver-6e333f9696bd7557bebc6ba947172ab6a2df8938.tar.xz
Prevent demo user from editing their profile
-rw-r--r--api/src/routes/users/@me/index.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/api/src/routes/users/@me/index.ts b/api/src/routes/users/@me/index.ts
index 122080f2..7ab30f03 100644
--- a/api/src/routes/users/@me/index.ts
+++ b/api/src/routes/users/@me/index.ts
@@ -2,6 +2,7 @@ import { Router, Request, Response } from "express";
 import { User, PrivateUserProjection, emitEvent, UserUpdateEvent, handleFile, FieldErrors, adjustEmail } from "@fosscord/util";
 import { route } from "@fosscord/api";
 import bcrypt from "bcrypt";
+import { HTTPError } from "lambert-server";
 
 const router: Router = Router();
 
@@ -29,6 +30,8 @@ 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;
 
 	if (body.avatar) body.avatar = await handleFile(`/avatars/${req.user_id}`, body.avatar as string);