feat: support first bind update password (#2520)

This commit is contained in:
skynono
2025-12-26 13:59:56 +08:00
committed by GitHub
parent 58db72d459
commit 9aeef6abec
2 changed files with 8 additions and 5 deletions

View File

@@ -763,7 +763,10 @@ func checkUpdatePassword(originalPassword string, newPassword string, userId int
if err != nil { if err != nil {
return return
} }
if !common.ValidatePasswordAndHash(originalPassword, currentUser.Password) {
// 密码不为空,需要验证原密码
// 支持第一次账号绑定时原密码为空的情况
if !common.ValidatePasswordAndHash(originalPassword, currentUser.Password) && currentUser.Password != "" {
err = fmt.Errorf("原密码错误") err = fmt.Errorf("原密码错误")
return return
} }

View File

@@ -314,10 +314,10 @@ const PersonalSetting = () => {
}; };
const changePassword = async () => { const changePassword = async () => {
if (inputs.original_password === '') { // if (inputs.original_password === '') {
showError(t('请输入原密码!')); // showError(t('请输入原密码!'));
return; // return;
} // }
if (inputs.set_new_password === '') { if (inputs.set_new_password === '') {
showError(t('请输入新密码!')); showError(t('请输入新密码!'));
return; return;