Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
13afcd42
authored
May 06, 2025
by
creamlike1024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复未输入新密码时提示修改成功
parent
bb596ae8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
12 deletions
+29
-12
controller/user.go
+3
-3
web/src/components/PersonalSetting.js
+26
-9
No files found.
controller/user.go
View file @
13afcd42
...
@@ -616,9 +616,6 @@ func UpdateSelf(c *gin.Context) {
...
@@ -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
...
@@ -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
}
}
...
...
web/src/components/PersonalSetting.js
View file @
13afcd42
...
@@ -244,6 +244,10 @@ const PersonalSetting = () => {
...
@@ -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 = () => {
...
@@ -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 = () => {
...
@@ -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
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment