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
266e9c4739
commit
7e7a2d3619
20624
api/assets/schemas.json
20624
api/assets/schemas.json
File diff suppressed because it is too large
Load Diff
@ -31,7 +31,6 @@ const Excluded = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
function modify(obj) {
|
function modify(obj) {
|
||||||
delete obj.additionalProperties;
|
|
||||||
for (var k in obj) {
|
for (var k in obj) {
|
||||||
if (typeof obj[k] === "object" && obj[k] !== null) {
|
if (typeof obj[k] === "object" && obj[k] !== null) {
|
||||||
modify(obj[k]);
|
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);
|
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"] });
|
const user = await User.findOneOrFail({ where: { id: req.user_id }, select: [...PrivateUserProjection, "data"] });
|
||||||
|
user.assign(body);
|
||||||
|
|
||||||
if (body.password) {
|
if (body.password) {
|
||||||
if (user.data?.hash) {
|
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.new_password) {
|
||||||
if (!body.password && !user.email) {
|
if (!body.password && !user.email) {
|
||||||
throw FieldErrors({
|
throw FieldErrors({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user