mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 12:42:44 +01: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:
parent
ed69bbbe47
commit
5c27b52334
20626
api/assets/schemas.json
20626
api/assets/schemas.json
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,6 @@ const Excluded = [
|
||||
];
|
||||
|
||||
function modify(obj) {
|
||||
delete obj.additionalProperties;
|
||||
for (var k in obj) {
|
||||
if (typeof obj[k] === "object" && obj[k] !== null) {
|
||||
modify(obj[k]);
|
||||
|
@ -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({
|
||||
|
Loading…
Reference in New Issue
Block a user