diff --git a/controller/user.go b/controller/user.go index 567c2aa7..fd53e743 100644 --- a/controller/user.go +++ b/controller/user.go @@ -616,9 +616,6 @@ func UpdateSelf(c *gin.Context) { } func checkUpdatePassword(originalPassword string, newPassword string, userId int) (updatePassword bool, err error) { - if newPassword == "" { - return - } var currentUser *model.User currentUser, err = model.GetUserById(userId, true) if err != nil { @@ -628,6 +625,9 @@ func checkUpdatePassword(originalPassword string, newPassword string, userId int err = fmt.Errorf("原密码错误") return } + if newPassword == "" { + return + } updatePassword = true return } diff --git a/web/src/components/PersonalSetting.js b/web/src/components/PersonalSetting.js index fbd74536..0f52c319 100644 --- a/web/src/components/PersonalSetting.js +++ b/web/src/components/PersonalSetting.js @@ -244,6 +244,10 @@ const PersonalSetting = () => { showError(t('请输入原密码!')); return; } + if (inputs.set_new_password === '') { + showError(t('请输入新密码!')); + return; + } if (inputs.original_password === inputs.set_new_password) { showError(t('新密码需要和原密码不一致!')); return; @@ -826,8 +830,8 @@ const PersonalSetting = () => { - - + +
{t('通知方式')}
@@ -1003,23 +1007,36 @@ const PersonalSetting = () => {
- +
- {t('接受未设置价格模型')} + + {t('接受未设置价格模型')} +
handleNotificationSettingChange('acceptUnsetModelRatioModel', e.target.checked)} + checked={ + notificationSettings.acceptUnsetModelRatioModel + } + onChange={(e) => + handleNotificationSettingChange( + 'acceptUnsetModelRatioModel', + e.target.checked, + ) + } > {t('接受未设置价格模型')} - - {t('当模型没有设置价格时仍接受调用,仅当您信任该网站时使用,可能会产生高额费用')} + + {t( + '当模型没有设置价格时仍接受调用,仅当您信任该网站时使用,可能会产生高额费用', + )}
-