From d859e3fa645672ca3e38e97654a2de30c6bbd577 Mon Sep 17 00:00:00 2001 From: creamlike1024 Date: Tue, 6 May 2025 22:28:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=9C=AA=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=96=B0=E5=AF=86=E7=A0=81=E6=97=B6=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=88=90=E5=8A=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controller/user.go | 6 ++--- web/src/components/PersonalSetting.js | 35 ++++++++++++++++++++------- 2 files changed, 29 insertions(+), 12 deletions(-) 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( + '当模型没有设置价格时仍接受调用,仅当您信任该网站时使用,可能会产生高额费用', + )}
-