From f44a64ddd3a6d45e88a5e0a8e984a4d7bd56b2b9 Mon Sep 17 00:00:00 2001 From: zheng05jess <151481647+zheng05jess@users.noreply.github.com> Date: Thu, 12 Mar 2026 14:41:05 +0000 Subject: [PATCH] changeed changePassword --- src/user/profile.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/user/profile.js b/src/user/profile.js index 3009d0a3d5..11ce88290f 100644 --- a/src/user/profile.js +++ b/src/user/profile.js @@ -362,11 +362,10 @@ module.exports = function (User) { if (isSelf && hasPassword) { const correct = await User.isPasswordCorrect(data.uid, data.currentPassword, data.ip); - if (!correct) { - throw new Error('[[user:change-password-error-wrong-current]]'); - } - if (data.currentPassword === data.newPassword) { - throw new Error('[[user:change-password-error-same-password]]'); + if (!correct || data.currentPassword === data.newPassword) { + throw new Error(!correct + ? '[[user:change-password-error-wrong-current]]' + : '[[user:change-password-error-same-password]]'); } }