mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-09 20:22:47 +01:00
Add discrim verify in PATCH /users/@me
This commit is contained in:
parent
6fa18fdc89
commit
5b4d7dec35
@ -77,6 +77,14 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (body.discriminator) {
|
||||||
|
if (await User.findOne({ where: { discriminator: body.discriminator, username: body.username || user.username } })) {
|
||||||
|
throw FieldErrors({
|
||||||
|
discriminator: { code: "INVALID_DISCRIMINATOR", message: "This discriminator is already in use." }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
user.assign(body);
|
user.assign(body);
|
||||||
await user.save();
|
await user.save();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user