mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 12:42:44 +01:00
Prevent demo user from editing their profile
This commit is contained in:
parent
c18fe9c0b3
commit
6b8c4c9fa7
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user