From 9aeef6abecc209d076cf357cd4dc6200524ed861 Mon Sep 17 00:00:00 2001 From: skynono Date: Fri, 26 Dec 2025 13:59:56 +0800 Subject: [PATCH] feat: support first bind update password (#2520) --- controller/user.go | 5 ++++- web/src/components/settings/PersonalSetting.jsx | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/controller/user.go b/controller/user.go index cc3049c61..1fc83c99e 100644 --- a/controller/user.go +++ b/controller/user.go @@ -763,7 +763,10 @@ func checkUpdatePassword(originalPassword string, newPassword string, userId int if err != nil { return } - if !common.ValidatePasswordAndHash(originalPassword, currentUser.Password) { + + // 密码不为空,需要验证原密码 + // 支持第一次账号绑定时原密码为空的情况 + if !common.ValidatePasswordAndHash(originalPassword, currentUser.Password) && currentUser.Password != "" { err = fmt.Errorf("原密码错误") return } diff --git a/web/src/components/settings/PersonalSetting.jsx b/web/src/components/settings/PersonalSetting.jsx index 18d374801..6a889356d 100644 --- a/web/src/components/settings/PersonalSetting.jsx +++ b/web/src/components/settings/PersonalSetting.jsx @@ -314,10 +314,10 @@ const PersonalSetting = () => { }; const changePassword = async () => { - if (inputs.original_password === '') { - showError(t('请输入原密码!')); - return; - } + // if (inputs.original_password === '') { + // showError(t('请输入原密码!')); + // return; + // } if (inputs.set_new_password === '') { showError(t('请输入新密码!')); return;