mirror of
https://github.com/QuantumNous/new-api.git
synced 2026-03-30 02:25:00 +00:00
feat: support first bind update password (#2520)
This commit is contained in:
@@ -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
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user