🐛 fix CORS

This commit is contained in:
Flam3rboy
2021-06-26 19:48:20 +02:00
parent 4a0d4ae909
commit 9b59296af5
3 changed files with 5 additions and 3 deletions
+1
View File
@@ -34,6 +34,7 @@ router.post(
gift_code_sku_id, // ? what is this
captcha_key
} = req.body;
console.log("register", req.body.email, req.body.username, req.headers["cf-connecting-ip"]);
// TODO: automatically join invite
// TODO: gift_code_sku_id?
// TODO: check password strength
+2 -2
View File
@@ -1,5 +1,5 @@
import { Router, Request, Response } from "express";
import { UserModel, toObject } from "@fosscord/server-util";
import { UserModel, toObject, PublicUserProjection } from "@fosscord/server-util";
import { HTTPError } from "lambert-server";
import { getPublicUser } from "../../../util/User";
import { UserModifySchema } from "../../../schema/User";
@@ -28,7 +28,7 @@ router.patch("/", check(UserModifySchema), async (req: Request, res: Response) =
}
}
const user = await UserModel.findOneAndUpdate({ id: req.user_id }, body).exec();
const user = await UserModel.findOneAndUpdate({ id: req.user_id }, body, { projection: PublicUserProjection }).exec();
// TODO: dispatch user update event
res.json(toObject(user));