Fixed bug in /users/@me PATCH where username must be present in every request, breaking account claiming
This commit is contained in:
parent
8ed310e0d3
commit
dbbe0037d0
@ -58,7 +58,8 @@ router.patch("/", route({ body: "UserModifySchema" }), async (req: Request, res:
|
|||||||
}
|
}
|
||||||
|
|
||||||
var check_username = body?.username?.replace(/\s/g, '');
|
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({
|
throw FieldErrors({
|
||||||
username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") }
|
username: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") }
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user