Skip to content

Commit

Permalink
fix: return an error on username change with no password
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberL1 committed Jul 21, 2024
1 parent d3ece93 commit f249916
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/api/routes/users/@me/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
});
Expand Down Expand Up @@ -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({
Expand Down

0 comments on commit f249916

Please sign in to comment.