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
9e552663
authored
Sep 30, 2025
by
Seefs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: personal setting
parent
e26c7947
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
7 deletions
+27
-7
model/passkey.go
+3
-2
web/src/components/settings/personal/cards/AccountManagement.jsx
+17
-4
web/src/i18n/locales/en.json
+3
-0
web/src/i18n/locales/zh.json
+4
-1
No files found.
model/passkey.go
View file @
9e552663
...
@@ -141,9 +141,10 @@ func GetPasskeyByUserID(userID int) (*PasskeyCredential, error) {
...
@@ -141,9 +141,10 @@ func GetPasskeyByUserID(userID int) (*PasskeyCredential, error) {
var
credential
PasskeyCredential
var
credential
PasskeyCredential
if
err
:=
DB
.
Where
(
"user_id = ?"
,
userID
)
.
First
(
&
credential
)
.
Error
;
err
!=
nil
{
if
err
:=
DB
.
Where
(
"user_id = ?"
,
userID
)
.
First
(
&
credential
)
.
Error
;
err
!=
nil
{
if
errors
.
Is
(
err
,
gorm
.
ErrRecordNotFound
)
{
if
errors
.
Is
(
err
,
gorm
.
ErrRecordNotFound
)
{
common
.
SysLog
(
fmt
.
Sprintf
(
"GetPasskeyByUserID: passkey not found for user %d"
,
userID
))
// 未找到记录是正常情况(用户未绑定),返回 ErrPasskeyNotFound 而不记录日志
return
nil
,
Err
Friendly
PasskeyNotFound
return
nil
,
ErrPasskeyNotFound
}
}
// 只有真正的数据库错误才记录日志
common
.
SysLog
(
fmt
.
Sprintf
(
"GetPasskeyByUserID: database error for user %d: %v"
,
userID
,
err
))
common
.
SysLog
(
fmt
.
Sprintf
(
"GetPasskeyByUserID: database error for user %d: %v"
,
userID
,
err
))
return
nil
,
ErrFriendlyPasskeyNotFound
return
nil
,
ErrFriendlyPasskeyNotFound
}
}
...
...
web/src/components/settings/personal/cards/AccountManagement.jsx
View file @
9e552663
...
@@ -525,10 +525,23 @@ const AccountManagement = ({
...
@@ -525,10 +525,23 @@ const AccountManagement = ({
</
div
>
</
div
>
</
div
>
</
div
>
<
Button
<
Button
type=
'primary'
type=
{
passkeyEnabled
?
'danger'
:
'primary'
}
theme=
{
passkeyEnabled
?
'outline'
:
'solid'
}
theme=
{
passkeyEnabled
?
'solid'
:
'solid'
}
onClick=
{
passkeyEnabled
?
onPasskeyDelete
:
onPasskeyRegister
}
onClick=
{
className=
'w-full sm:w-auto'
passkeyEnabled
?
()
=>
{
Modal
.
confirm
({
title
:
t
(
'确认解绑 Passkey'
),
content
:
t
(
'解绑后将无法使用 Passkey 登录,确定要继续吗?'
),
okText
:
t
(
'确认解绑'
),
cancelText
:
t
(
'取消'
),
okType
:
'danger'
,
onOk
:
onPasskeyDelete
,
});
}
:
onPasskeyRegister
}
className=
{
`w-full sm:w-auto ${passkeyEnabled ? '!bg-slate-500 hover:!bg-slate-600' : ''}`
}
icon=
{
<
IconKey
/>
}
icon=
{
<
IconKey
/>
}
disabled=
{
!
passkeySupported
&&
!
passkeyEnabled
}
disabled=
{
!
passkeySupported
&&
!
passkeyEnabled
}
loading=
{
passkeyEnabled
?
passkeyDeleteLoading
:
passkeyRegisterLoading
}
loading=
{
passkeyEnabled
?
passkeyDeleteLoading
:
passkeyRegisterLoading
}
...
...
web/src/i18n/locales/en.json
View file @
9e552663
...
@@ -334,6 +334,9 @@
...
@@ -334,6 +334,9 @@
"允许通过 GitHub 账户登录 & 注册"
:
"Allow login & registration via GitHub account"
,
"允许通过 GitHub 账户登录 & 注册"
:
"Allow login & registration via GitHub account"
,
"允许通过微信登录 & 注册"
:
"Allow login & registration via WeChat"
,
"允许通过微信登录 & 注册"
:
"Allow login & registration via WeChat"
,
"允许通过 Passkey 登录 & 认证"
:
"Allow login & authentication via Passkey"
,
"允许通过 Passkey 登录 & 认证"
:
"Allow login & authentication via Passkey"
,
"确认解绑 Passkey"
:
"Confirm Unbind Passkey"
,
"解绑后将无法使用 Passkey 登录,确定要继续吗?"
:
"After unbinding, you will not be able to login with Passkey. Are you sure you want to continue?"
,
"确认解绑"
:
"Confirm Unbind"
,
"允许新用户注册(此项为否时,新用户将无法以任何方式进行注册"
:
"Allow new user registration (if this option is off, new users will not be able to register in any way"
,
"允许新用户注册(此项为否时,新用户将无法以任何方式进行注册"
:
"Allow new user registration (if this option is off, new users will not be able to register in any way"
,
"启用 Turnstile 用户校验"
:
"Enable Turnstile user verification"
,
"启用 Turnstile 用户校验"
:
"Enable Turnstile user verification"
,
"配置 SMTP"
:
"Configure SMTP"
,
"配置 SMTP"
:
"Configure SMTP"
,
...
...
web/src/i18n/locales/zh.json
View file @
9e552663
...
@@ -91,5 +91,8 @@
...
@@ -91,5 +91,8 @@
"目标用户:{{username}}"
:
"目标用户:{{username}}"
,
"目标用户:{{username}}"
:
"目标用户:{{username}}"
,
"Passkey 已重置"
:
"Passkey 已重置"
,
"Passkey 已重置"
:
"Passkey 已重置"
,
"二步验证已重置"
:
"二步验证已重置"
,
"二步验证已重置"
:
"二步验证已重置"
,
"允许通过 Passkey 登录 & 认证"
:
"允许通过 Passkey 登录 & 认证"
"允许通过 Passkey 登录 & 认证"
:
"允许通过 Passkey 登录 & 认证"
,
"确认解绑 Passkey"
:
"确认解绑 Passkey"
,
"解绑后将无法使用 Passkey 登录,确定要继续吗?"
:
"解绑后将无法使用 Passkey 登录,确定要继续吗?"
,
"确认解绑"
:
"确认解绑"
}
}
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