fix: return an error on username change with no password
This commit is contained in:
parent
481cf38373
commit
b682f170b9
@ -120,7 +120,7 @@ router.patch(
|
|||||||
if (!body.password)
|
if (!body.password)
|
||||||
throw FieldErrors({
|
throw FieldErrors({
|
||||||
password: {
|
password: {
|
||||||
message: req.t("auth:register.INVALID_PASSWORD"),
|
message: req.t("auth:login.INVALID_PASSWORD"),
|
||||||
code: "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 (body.discriminator) {
|
||||||
if (
|
if (
|
||||||
await User.findOne({
|
await User.findOne({
|
||||||
|
Loading…
x
Reference in New Issue
Block a user