Fixed bug in /users/@me PATCH where username must be present in every request, breaking account claiming

This commit is contained in:
Madeline
2022-02-17 20:32:47 +11:00
parent c9fdfe196d
commit c23ec4acee
+2 -1
View File
@@ -58,7 +58,8 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
}
var check_username = body?.username?.replace(/\s/g, '');
if(!check_username) {
//claiming an account does not provide username so check if username in body before throw
if (!check_username && body.username) {
throw FieldErrors({
username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") }
});