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
9fd53d80
authored
Feb 28, 2026
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: show built-in user bindings from user detail API in admin modal
parent
a58c98c4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
8 deletions
+31
-8
web/src/components/table/users/modals/UserBindingManagementModal.jsx
+31
-8
No files found.
web/src/components/table/users/modals/UserBindingManagementModal.jsx
View file @
9fd53d80
...
@@ -56,6 +56,7 @@ const UserBindingManagementModal = ({
...
@@ -56,6 +56,7 @@ const UserBindingManagementModal = ({
const
[
showBoundOnly
,
setShowBoundOnly
]
=
React
.
useState
(
true
);
const
[
showBoundOnly
,
setShowBoundOnly
]
=
React
.
useState
(
true
);
const
[
statusInfo
,
setStatusInfo
]
=
React
.
useState
({});
const
[
statusInfo
,
setStatusInfo
]
=
React
.
useState
({});
const
[
customOAuthBindings
,
setCustomOAuthBindings
]
=
React
.
useState
([]);
const
[
customOAuthBindings
,
setCustomOAuthBindings
]
=
React
.
useState
([]);
const
[
builtInBindings
,
setBuiltInBindings
]
=
React
.
useState
({});
const
[
bindingActionLoading
,
setBindingActionLoading
]
=
React
.
useState
({});
const
[
bindingActionLoading
,
setBindingActionLoading
]
=
React
.
useState
({});
const
loadBindingData
=
React
.
useCallback
(
async
()
=>
{
const
loadBindingData
=
React
.
useCallback
(
async
()
=>
{
...
@@ -63,9 +64,10 @@ const UserBindingManagementModal = ({
...
@@ -63,9 +64,10 @@ const UserBindingManagementModal = ({
setBindingLoading
(
true
);
setBindingLoading
(
true
);
try
{
try
{
const
[
statusRes
,
customBindingRes
]
=
await
Promise
.
all
([
const
[
statusRes
,
customBindingRes
,
userRes
]
=
await
Promise
.
all
([
API
.
get
(
'/api/status'
),
API
.
get
(
'/api/status'
),
API
.
get
(
`/api/user/
${
userId
}
/oauth/bindings`
),
API
.
get
(
`/api/user/
${
userId
}
/oauth/bindings`
),
API
.
get
(
`/api/user/
${
userId
}
`
),
]);
]);
if
(
statusRes
.
data
?.
success
)
{
if
(
statusRes
.
data
?.
success
)
{
...
@@ -79,6 +81,21 @@ const UserBindingManagementModal = ({
...
@@ -79,6 +81,21 @@ const UserBindingManagementModal = ({
}
else
{
}
else
{
showError
(
customBindingRes
.
data
?.
message
||
t
(
'操作失败'
));
showError
(
customBindingRes
.
data
?.
message
||
t
(
'操作失败'
));
}
}
if
(
userRes
.
data
?.
success
)
{
const
userData
=
userRes
.
data
.
data
||
{};
setBuiltInBindings
({
email
:
userData
.
email
||
''
,
github_id
:
userData
.
github_id
||
''
,
discord_id
:
userData
.
discord_id
||
''
,
oidc_id
:
userData
.
oidc_id
||
''
,
wechat_id
:
userData
.
wechat_id
||
''
,
telegram_id
:
userData
.
telegram_id
||
''
,
linux_do_id
:
userData
.
linux_do_id
||
''
,
});
}
else
{
showError
(
userRes
.
data
?.
message
||
t
(
'操作失败'
));
}
}
catch
(
error
)
{
}
catch
(
error
)
{
showError
(
showError
(
error
.
response
?.
data
?.
message
||
error
.
message
||
t
(
'操作失败'
),
error
.
response
?.
data
?.
message
||
error
.
message
||
t
(
'操作失败'
),
...
@@ -118,6 +135,10 @@ const UserBindingManagementModal = ({
...
@@ -118,6 +135,10 @@ const UserBindingManagementModal = ({
showError
(
res
.
data
?.
message
||
t
(
'操作失败'
));
showError
(
res
.
data
?.
message
||
t
(
'操作失败'
));
return
;
return
;
}
}
setBuiltInBindings
((
prev
)
=>
({
...
prev
,
[
bindingItem
.
field
]:
''
,
}));
formApiRef
.
current
?.
setValue
(
bindingItem
.
field
,
''
);
formApiRef
.
current
?.
setValue
(
bindingItem
.
field
,
''
);
showSuccess
(
t
(
'解绑成功'
));
showSuccess
(
t
(
'解绑成功'
));
}
catch
(
error
)
{
}
catch
(
error
)
{
...
@@ -168,6 +189,8 @@ const UserBindingManagementModal = ({
...
@@ -168,6 +189,8 @@ const UserBindingManagementModal = ({
};
};
const
currentValues
=
formApiRef
.
current
?.
getValues
?.()
||
{};
const
currentValues
=
formApiRef
.
current
?.
getValues
?.()
||
{};
const
getBuiltInBindingValue
=
(
field
)
=>
builtInBindings
[
field
]
||
currentValues
[
field
]
||
''
;
const
builtInBindingItems
=
[
const
builtInBindingItems
=
[
{
{
...
@@ -175,7 +198,7 @@ const UserBindingManagementModal = ({
...
@@ -175,7 +198,7 @@ const UserBindingManagementModal = ({
field
:
'email'
,
field
:
'email'
,
name
:
t
(
'邮箱'
),
name
:
t
(
'邮箱'
),
enabled
:
true
,
enabled
:
true
,
value
:
currentValues
.
email
,
value
:
getBuiltInBindingValue
(
'email'
)
,
icon
:
(
icon
:
(
<
IconMail
<
IconMail
size=
'default'
size=
'default'
...
@@ -188,7 +211,7 @@ const UserBindingManagementModal = ({
...
@@ -188,7 +211,7 @@ const UserBindingManagementModal = ({
field
:
'github_id'
,
field
:
'github_id'
,
name
:
'GitHub'
,
name
:
'GitHub'
,
enabled
:
Boolean
(
statusInfo
.
github_oauth
),
enabled
:
Boolean
(
statusInfo
.
github_oauth
),
value
:
currentValues
.
github_id
,
value
:
getBuiltInBindingValue
(
'github_id'
)
,
icon
:
(
icon
:
(
<
IconGithubLogo
<
IconGithubLogo
size=
'default'
size=
'default'
...
@@ -201,7 +224,7 @@ const UserBindingManagementModal = ({
...
@@ -201,7 +224,7 @@ const UserBindingManagementModal = ({
field
:
'discord_id'
,
field
:
'discord_id'
,
name
:
'Discord'
,
name
:
'Discord'
,
enabled
:
Boolean
(
statusInfo
.
discord_oauth
),
enabled
:
Boolean
(
statusInfo
.
discord_oauth
),
value
:
currentValues
.
discord_id
,
value
:
getBuiltInBindingValue
(
'discord_id'
)
,
icon
:
(
icon
:
(
<
SiDiscord
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
<
SiDiscord
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
),
),
...
@@ -211,7 +234,7 @@ const UserBindingManagementModal = ({
...
@@ -211,7 +234,7 @@ const UserBindingManagementModal = ({
field
:
'oidc_id'
,
field
:
'oidc_id'
,
name
:
'OIDC'
,
name
:
'OIDC'
,
enabled
:
Boolean
(
statusInfo
.
oidc_enabled
),
enabled
:
Boolean
(
statusInfo
.
oidc_enabled
),
value
:
currentValues
.
oidc_id
,
value
:
getBuiltInBindingValue
(
'oidc_id'
)
,
icon
:
(
icon
:
(
<
IconLink
<
IconLink
size=
'default'
size=
'default'
...
@@ -224,7 +247,7 @@ const UserBindingManagementModal = ({
...
@@ -224,7 +247,7 @@ const UserBindingManagementModal = ({
field
:
'wechat_id'
,
field
:
'wechat_id'
,
name
:
t
(
'微信'
),
name
:
t
(
'微信'
),
enabled
:
Boolean
(
statusInfo
.
wechat_login
),
enabled
:
Boolean
(
statusInfo
.
wechat_login
),
value
:
currentValues
.
wechat_id
,
value
:
getBuiltInBindingValue
(
'wechat_id'
)
,
icon
:
(
icon
:
(
<
SiWechat
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
<
SiWechat
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
),
),
...
@@ -234,7 +257,7 @@ const UserBindingManagementModal = ({
...
@@ -234,7 +257,7 @@ const UserBindingManagementModal = ({
field
:
'telegram_id'
,
field
:
'telegram_id'
,
name
:
'Telegram'
,
name
:
'Telegram'
,
enabled
:
Boolean
(
statusInfo
.
telegram_oauth
),
enabled
:
Boolean
(
statusInfo
.
telegram_oauth
),
value
:
currentValues
.
telegram_id
,
value
:
getBuiltInBindingValue
(
'telegram_id'
)
,
icon
:
(
icon
:
(
<
SiTelegram
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
<
SiTelegram
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
),
),
...
@@ -244,7 +267,7 @@ const UserBindingManagementModal = ({
...
@@ -244,7 +267,7 @@ const UserBindingManagementModal = ({
field
:
'linux_do_id'
,
field
:
'linux_do_id'
,
name
:
'LinuxDO'
,
name
:
'LinuxDO'
,
enabled
:
Boolean
(
statusInfo
.
linuxdo_oauth
),
enabled
:
Boolean
(
statusInfo
.
linuxdo_oauth
),
value
:
currentValues
.
linux_do_id
,
value
:
getBuiltInBindingValue
(
'linux_do_id'
)
,
icon
:
(
icon
:
(
<
SiLinux
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
<
SiLinux
size=
{
20
}
className=
'text-slate-600 dark:text-slate-300'
/>
),
),
...
...
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