fix: 修复未输入新密码时提示修改成功
This commit is contained in:
@@ -616,9 +616,6 @@ func UpdateSelf(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkUpdatePassword(originalPassword string, newPassword string, userId int) (updatePassword bool, err error) {
|
func checkUpdatePassword(originalPassword string, newPassword string, userId int) (updatePassword bool, err error) {
|
||||||
if newPassword == "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
var currentUser *model.User
|
var currentUser *model.User
|
||||||
currentUser, err = model.GetUserById(userId, true)
|
currentUser, err = model.GetUserById(userId, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -628,6 +625,9 @@ func checkUpdatePassword(originalPassword string, newPassword string, userId int
|
|||||||
err = fmt.Errorf("原密码错误")
|
err = fmt.Errorf("原密码错误")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if newPassword == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
updatePassword = true
|
updatePassword = true
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -244,6 +244,10 @@ const PersonalSetting = () => {
|
|||||||
showError(t('请输入原密码!'));
|
showError(t('请输入原密码!'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (inputs.set_new_password === '') {
|
||||||
|
showError(t('请输入新密码!'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (inputs.original_password === inputs.set_new_password) {
|
if (inputs.original_password === inputs.set_new_password) {
|
||||||
showError(t('新密码需要和原密码不一致!'));
|
showError(t('新密码需要和原密码不一致!'));
|
||||||
return;
|
return;
|
||||||
@@ -826,8 +830,8 @@ const PersonalSetting = () => {
|
|||||||
</div>
|
</div>
|
||||||
</Card>
|
</Card>
|
||||||
<Card style={{ marginTop: 10 }}>
|
<Card style={{ marginTop: 10 }}>
|
||||||
<Tabs type="line" defaultActiveKey="notification">
|
<Tabs type='line' defaultActiveKey='notification'>
|
||||||
<TabPane tab={t('通知设置')} itemKey="notification">
|
<TabPane tab={t('通知设置')} itemKey='notification'>
|
||||||
<div style={{ marginTop: 20 }}>
|
<div style={{ marginTop: 20 }}>
|
||||||
<Typography.Text strong>{t('通知方式')}</Typography.Text>
|
<Typography.Text strong>{t('通知方式')}</Typography.Text>
|
||||||
<div style={{ marginTop: 10 }}>
|
<div style={{ marginTop: 10 }}>
|
||||||
@@ -1003,23 +1007,36 @@ const PersonalSetting = () => {
|
|||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane tab={t('价格设置')} itemKey="price">
|
<TabPane tab={t('价格设置')} itemKey='price'>
|
||||||
<div style={{ marginTop: 20 }}>
|
<div style={{ marginTop: 20 }}>
|
||||||
<Typography.Text strong>{t('接受未设置价格模型')}</Typography.Text>
|
<Typography.Text strong>
|
||||||
|
{t('接受未设置价格模型')}
|
||||||
|
</Typography.Text>
|
||||||
<div style={{ marginTop: 10 }}>
|
<div style={{ marginTop: 10 }}>
|
||||||
<Checkbox
|
<Checkbox
|
||||||
checked={notificationSettings.acceptUnsetModelRatioModel}
|
checked={
|
||||||
onChange={e => handleNotificationSettingChange('acceptUnsetModelRatioModel', e.target.checked)}
|
notificationSettings.acceptUnsetModelRatioModel
|
||||||
|
}
|
||||||
|
onChange={(e) =>
|
||||||
|
handleNotificationSettingChange(
|
||||||
|
'acceptUnsetModelRatioModel',
|
||||||
|
e.target.checked,
|
||||||
|
)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{t('接受未设置价格模型')}
|
{t('接受未设置价格模型')}
|
||||||
</Checkbox>
|
</Checkbox>
|
||||||
<Typography.Text type="secondary" style={{ marginTop: 8, display: 'block' }}>
|
<Typography.Text
|
||||||
{t('当模型没有设置价格时仍接受调用,仅当您信任该网站时使用,可能会产生高额费用')}
|
type='secondary'
|
||||||
|
style={{ marginTop: 8, display: 'block' }}
|
||||||
|
>
|
||||||
|
{t(
|
||||||
|
'当模型没有设置价格时仍接受调用,仅当您信任该网站时使用,可能会产生高额费用',
|
||||||
|
)}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
|
|
||||||
</Tabs>
|
</Tabs>
|
||||||
<div style={{ marginTop: 20 }}>
|
<div style={{ marginTop: 20 }}>
|
||||||
<Button type='primary' onClick={saveNotificationSettings}>
|
<Button type='primary' onClick={saveNotificationSettings}>
|
||||||
|
|||||||
Reference in New Issue
Block a user