mirror of
https://github.com/spacebarchat/server.git
synced 2026-07-29 16:09:23 +00:00
Fixed ability for user to edit any property of themselves, including rights, flags. Note to self: schemas.json is a GENERATED file. npm run generate:schema in api/
This commit is contained in:
@@ -34,6 +34,7 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
|
||||
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"] });
|
||||
user.assign(body);
|
||||
|
||||
if (body.password) {
|
||||
if (user.data?.hash) {
|
||||
@@ -46,8 +47,6 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
|
||||
}
|
||||
}
|
||||
|
||||
user.assign(body);
|
||||
|
||||
if (body.new_password) {
|
||||
if (!body.password && !user.email) {
|
||||
throw FieldErrors({
|
||||
|
||||
Reference in New Issue
Block a user