1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-06 10:52:31 +01:00

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
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47

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") }
});