summary refs log tree commit diff
path: root/src/api/routes/users
diff options
context:
space:
mode:
authorCyber <mateusz.hf18@gmail.com>2024-07-25 19:41:56 +0200
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2024-07-28 20:48:06 +1000
commitf047f93b77f04a574380851cda5f361e6efb2310 (patch)
tree450e9bc8b41dbae4784863f69aedbf23eb4156f4 /src/api/routes/users
parentfix: return an error on username change with no password (diff)
downloadserver-ts-f047f93b77f04a574380851cda5f361e6efb2310.tar.xz
fix: check for password only if `username` is present in body
Diffstat (limited to 'src/api/routes/users')
-rw-r--r--src/api/routes/users/@me/index.ts16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts

index 95f572af..cddc3a08 100644 --- a/src/api/routes/users/@me/index.ts +++ b/src/api/routes/users/@me/index.ts
@@ -160,15 +160,15 @@ router.patch( }, }); } - } - if (!body.password) { - throw FieldErrors({ - password: { - message: req.t("auth:login.INVALID_PASSWORD"), - code: "INVALID_PASSWORD", - }, - }); + if (!body.password) { + throw FieldErrors({ + password: { + message: req.t("auth:login.INVALID_PASSWORD"), + code: "INVALID_PASSWORD", + }, + }); + } } if (body.discriminator) {