summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorCyber <mateusz.hf18@gmail.com>2024-07-21 20:00:14 +0200
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2024-07-28 20:48:06 +1000
commitb682f170b9e6156d7db66fc1527f451b734300db (patch)
tree6a376746b6e58601fdd0764e71c2c26e0fcc0ad9 /src/api
parentFix sort order when using ?around (diff)
downloadserver-ts-b682f170b9e6156d7db66fc1527f451b734300db.tar.xz
fix: return an error on username change with no password
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/users/@me/index.ts11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/api/routes/users/@me/index.ts b/src/api/routes/users/@me/index.ts

index ad11a428..95f572af 100644 --- a/src/api/routes/users/@me/index.ts +++ b/src/api/routes/users/@me/index.ts
@@ -120,7 +120,7 @@ router.patch( if (!body.password) throw FieldErrors({ password: { - message: req.t("auth:register.INVALID_PASSWORD"), + message: req.t("auth:login.INVALID_PASSWORD"), code: "INVALID_PASSWORD", }, }); @@ -162,6 +162,15 @@ router.patch( } } + if (!body.password) { + throw FieldErrors({ + password: { + message: req.t("auth:login.INVALID_PASSWORD"), + code: "INVALID_PASSWORD", + }, + }); + } + if (body.discriminator) { if ( await User.findOne({