From e50611666ef731a903d7bdd8eb62333b97e2cc5b Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 13 Mar 2026 19:39:27 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E4=B8=AA=E4=BA=BA?= =?UTF-8?q?=E8=B4=A6=E6=88=B7=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib-server/src/basic/base-controller.ts | 12 +- .../src/locales/langs/en-US/authentication.ts | 1 + .../src/locales/langs/en-US/certd.ts | 5 +- .../src/locales/langs/zh-CN/authentication.ts | 3 +- .../src/locales/langs/zh-CN/certd.ts | 5 +- .../src/store/settings/api.basic.ts | 1 + .../ui/certd-client/src/style/common.less | 3 + .../src/views/certd/mine/user-profile.vue | 533 ++++++++++++++++-- .../src/views/sys/settings/tabs/oauth.vue | 6 + .../controller/sys/addon/addon-controller.ts | 2 +- 10 files changed, 516 insertions(+), 55 deletions(-) diff --git a/packages/libs/lib-server/src/basic/base-controller.ts b/packages/libs/lib-server/src/basic/base-controller.ts index e09f30b32..dbbeb4927 100644 --- a/packages/libs/lib-server/src/basic/base-controller.ts +++ b/packages/libs/lib-server/src/basic/base-controller.ts @@ -115,11 +115,17 @@ export abstract class BaseController { if (projectId) { await authService.checkProjectId(service, id, projectId); }else{ - if(allowAdmin){ - await authService.checkUserIdButAllowAdmin(this.ctx, service, id); + + if(userId === 0){ + //系统级别,不检查权限 }else{ - await authService.checkUserId( service, id, userId); + if(allowAdmin){ + await authService.checkUserIdButAllowAdmin(this.ctx, service, id); + }else{ + await authService.checkUserId( service, id, userId); + } } + } return {projectId,userId} } diff --git a/packages/ui/certd-client/src/locales/langs/en-US/authentication.ts b/packages/ui/certd-client/src/locales/langs/en-US/authentication.ts index ce6c2bde9..039ec30bf 100644 --- a/packages/ui/certd-client/src/locales/langs/en-US/authentication.ts +++ b/packages/ui/certd-client/src/locales/langs/en-US/authentication.ts @@ -102,4 +102,5 @@ export default { deviceName: "Device Name", deviceNameHelper: "Please enter the device name, used to identify the device", passkeyRegisterHelper: "Site domain change will invalidate passkey", + userInfo: "User Info", }; diff --git a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts index e43de9c36..e8e032598 100644 --- a/packages/ui/certd-client/src/locales/langs/en-US/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/en-US/certd.ts @@ -727,7 +727,7 @@ export default { paymentSetting: "Payment Settings", captchaSetting: "Captcha Setting", pipelineSetting: "Pipeline Settings", - oauthSetting: "OAuth2 Settings", + oauthSetting: "Login Settings", networkSetting: "Network Settings", adminModeSetting: "Admin Mode Settings", adminModeHelper: "enterprise mode : allow to create and manage pipelines, roles, users, etc.\n saas mode : only allow to create and manage pipelines", @@ -769,7 +769,8 @@ export default { oauthAutoRedirectHelper: "Whether to auto redirect to OAuth2 login when login (using the first enabled OAuth2 login type)", oauthOnly: "OAuth2 Login Only", oauthOnlyHelper: "Whether to only allow OAuth2 login, disable password login", - + enablePasskey: "Enable Passkey Login", + passkeyEnabledHelper: "Whether to enable Passkey login", email: { templates: "Email Templates", templateType: "Template Type", diff --git a/packages/ui/certd-client/src/locales/langs/zh-CN/authentication.ts b/packages/ui/certd-client/src/locales/langs/zh-CN/authentication.ts index ff24a1e3c..00c51d942 100644 --- a/packages/ui/certd-client/src/locales/langs/zh-CN/authentication.ts +++ b/packages/ui/certd-client/src/locales/langs/zh-CN/authentication.ts @@ -96,7 +96,7 @@ export default { nickName: "昵称", phoneNumber: "手机号", changePassword: "修改密码", - updateProfile: "修改个人信息", + updateProfile: "修改信息", oauthLoginTitle: "其他登录方式", oauthOnlyLoginTitle: "登录", @@ -104,4 +104,5 @@ export default { deviceName: "设备名称", deviceNameHelper: "请输入当前设备名称,绑定多个时好做区分", passkeyRegisterHelper: "1、站点域名变更会导致passkey失效;\n2、同一设备同一个用户绑定多次只有最后一次的有效,之前绑定的会失效,需要手动删除", + userInfo: "账号信息", }; diff --git a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts index cb3a5b48a..5110b53cd 100644 --- a/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts +++ b/packages/ui/certd-client/src/locales/langs/zh-CN/certd.ts @@ -728,7 +728,7 @@ export default { paymentSetting: "支付设置", captchaSetting: "验证码设置", pipelineSetting: "流水线设置", - oauthSetting: "第三方登录", + oauthSetting: "登录设置", networkSetting: "网络设置", adminModeSetting: "管理模式", adminModeHelper: "企业管理模式: 企业内部使用,通过项目来隔离权限,流水线、授权数据属于项目。\nsaas模式:供外部用户注册使用,各个用户之间数据隔离,流水线、授权数据属于用户。", @@ -780,7 +780,8 @@ export default { oauthAutoRedirectHelper: "是否自动跳转第三方登录(使用第一个已启用的第三方登录类型)", oauthOnly: "仅使用第三方登录", oauthOnlyHelper: "是否仅使用第三方登录,关闭密码登录(注意:请务必在测试第三方登录功能正常后再开启,否则会导致无法登录)\n 如果无法登录,请访问 http://你的certd地址/#/login?oauthOnly=false 来临时关闭此模式", - + enablePasskey: "启用Passkey", + passkeyEnabledHelper: "是否启用Passkey登录", email: { templates: "邮件模板", templateType: "模板类型", diff --git a/packages/ui/certd-client/src/store/settings/api.basic.ts b/packages/ui/certd-client/src/store/settings/api.basic.ts index 2a17ba294..10cae7ca3 100644 --- a/packages/ui/certd-client/src/store/settings/api.basic.ts +++ b/packages/ui/certd-client/src/store/settings/api.basic.ts @@ -38,6 +38,7 @@ export type SysPublicSetting = { passwordLoginEnabled?: boolean; smsLoginEnabled?: boolean; defaultLoginType?: string; + passkeyEnabled?: boolean; selfServicePasswordRetrievalEnabled?: boolean; limitUserPipelineCount?: number; diff --git a/packages/ui/certd-client/src/style/common.less b/packages/ui/certd-client/src/style/common.less index fe0cc9c53..95587342c 100644 --- a/packages/ui/certd-client/src/style/common.less +++ b/packages/ui/certd-client/src/style/common.less @@ -299,6 +299,9 @@ h6 { font-size: 12px; margin-top: 3px; margin-bottom: 3px; + white-space: pre-wrap; + word-wrap: break-word; + word-break: break-word; &.error { color: #ff4d4f; diff --git a/packages/ui/certd-client/src/views/certd/mine/user-profile.vue b/packages/ui/certd-client/src/views/certd/mine/user-profile.vue index 378249a17..aa121337c 100644 --- a/packages/ui/certd-client/src/views/certd/mine/user-profile.vue +++ b/packages/ui/certd-client/src/views/certd/mine/user-profile.vue @@ -3,58 +3,122 @@ -
- - {{ userInfo.username }} - {{ userInfo.nickName }} - - - - {{ userInfo.username }} - - - {{ userInfo.email }} - {{ userInfo.phoneCode }}{{ userInfo.mobile }} - - - - +
+
+
+
+
+
+ + + {{ userInfo.username }} + + +
+ +
+ + {{ t("authentication.updateProfile") }} + + +
+
+
+
+ +
+
+ + 第三方账号绑定 +
+
- - -
-
- - {{ passkey.deviceName }} - -
注册时间:{{ formatDate(passkey.registeredAt) }}
-
最后使用:{{ formatDate(passkey.updateTime) }}
-
+
暂无可用的第三方账号绑定
+
+
- 解绑 +
+
+ + Passkey 安全密钥 +
+
+
+
+
+
+
{{ passkey.deviceName }}
+
+ + + {{ formatDate(passkey.registeredAt) }} + + + + 最近使用: + +
+
+ + + 移除 +
-
暂无Passkey
- 注册Passkey -
- {{ t("authentication.passkeyNotSupported") }} -
-
{{ t("authentication.passkeyRegisterHelper") }}
-          
- - - {{ t("authentication.updateProfile") }} - - - +
+
+ +

暂无Passkey

+
+
+ + {{ t("authentication.passkeyNotSupported") }} +
+ + + 注册新的Passkey + +
{{ t("authentication.passkeyRegisterHelper") }}
+
@@ -278,3 +342,380 @@ onMounted(async () => { checkPasskeySupport(); }); + + diff --git a/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue b/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue index 1a2ec6309..7d9a2ed35 100644 --- a/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue +++ b/packages/ui/certd-client/src/views/sys/settings/tabs/oauth.vue @@ -1,6 +1,12 @@