Fix bug in Change Password
This commit is contained in:
1 parent
867e7e768d
commit
052706877a
1 file changed
+3
-3
+3
-3
@@ -740,6 +740,9 @@ router.put("/users/:id/password", async (ctx) => {
|
||||
return void (ctx.status = 403);
|
||||
}
|
||||
|
||||
const newPassword = ctx.request.body.newPassword;
|
||||
|
||||
if (ctx.state.user) {
|
||||
const filter = and(authorizer.getFilter("users", 3), [
|
||||
"=",
|
||||
["PARAM", RESOURCE_IDS.users],
|
||||
@@ -747,9 +750,6 @@ router.put("/users/:id/password", async (ctx) => {
|
||||
]);
|
||||
const { value: res } = await db.query("users", filter).next();
|
||||
if (!res) return void (ctx.status = 404);
|
||||
|
||||
const newPassword = ctx.request.body.newPassword;
|
||||
if (ctx.state.user) {
|
||||
const validate = authorizer.getValidator("users", res);
|
||||
if (!validate("password", { password: newPassword })) {
|
||||
logUnauthorizedWarning(log);
|
||||
|
||||
Reference in new issue
Block a user