Skip to content

Commit 9aeef6a

Browse files
authored
feat: support first bind update password (#2520)
1 parent 58db72d commit 9aeef6a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

controller/user.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,10 @@ func checkUpdatePassword(originalPassword string, newPassword string, userId int
763763
if err != nil {
764764
return
765765
}
766-
if !common.ValidatePasswordAndHash(originalPassword, currentUser.Password) {
766+
767+
// 密码不为空,需要验证原密码
768+
// 支持第一次账号绑定时原密码为空的情况
769+
if !common.ValidatePasswordAndHash(originalPassword, currentUser.Password) && currentUser.Password != "" {
767770
err = fmt.Errorf("原密码错误")
768771
return
769772
}

web/src/components/settings/PersonalSetting.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,10 @@ const PersonalSetting = () => {
314314
};
315315

316316
const changePassword = async () => {
317-
if (inputs.original_password === '') {
318-
showError(t('请输入原密码!'));
319-
return;
320-
}
317+
// if (inputs.original_password === '') {
318+
// showError(t('请输入原密码!'));
319+
// return;
320+
// }
321321
if (inputs.set_new_password === '') {
322322
showError(t('请输入新密码!'));
323323
return;

0 commit comments

Comments
 (0)