mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-23 10:52:30 +01:00
Somehow the ID of demo user changed. Use email of demo instead
This commit is contained in:
parent
980df82f87
commit
4cb8c08b2c
@ -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 || "");
|
||||
|
Loading…
Reference in New Issue
Block a user