diff --git a/ui/src/api/admin/system/platform-source.ts b/ui/src/api/admin/system/auth-scan-setting.ts similarity index 71% rename from ui/src/api/admin/system/platform-source.ts rename to ui/src/api/admin/system/auth-scan-setting.ts index 4e716020c81..501a7261d8f 100644 --- a/ui/src/api/admin/system/platform-source.ts +++ b/ui/src/api/admin/system/auth-scan-setting.ts @@ -1,25 +1,25 @@ import { get, post, put } from '../core/request' import type { QrLoginPlatform, QrLoginPlatformRequest } from '@/api/types' -const prefix = '/platform' +const prefix = '/platform/source' /** 获取扫码登录平台配置。 */ const getQrLoginPlatforms = () => { return get(prefix) } -/** 校验扫码登录平台配置是否可用。 */ -const postQrLoginPlatformConnection = (platform: QrLoginPlatformRequest) => { - return post(`${prefix}/connection`, platform) -} - /** 保存扫码登录平台配置。 */ const putQrLoginPlatform = (platform: QrLoginPlatformRequest) => { return put(prefix, platform) } +/** 校验扫码登录平台配置是否可用。 */ +const postValidateQrLoginPlatform = (platform: QrLoginPlatformRequest) => { + return post(`${prefix}`, platform) +} + export default { getQrLoginPlatforms, - postQrLoginPlatformConnection, + postValidateQrLoginPlatform, putQrLoginPlatform, } diff --git a/ui/src/api/admin/system/chat-user-auth-scan.ts b/ui/src/api/admin/system/chat-user-auth-scan.ts new file mode 100644 index 00000000000..7fdfc9c55b2 --- /dev/null +++ b/ui/src/api/admin/system/chat-user-auth-scan.ts @@ -0,0 +1,25 @@ +import { get, post, put } from '../core/request' +import type { QrLoginPlatform, QrLoginPlatformRequest } from '@/api/types' + +const prefix = '/chat_user/auth/platform/source' + +/** 获取对话用户扫码登录平台配置。 */ +const getQrLoginPlatforms = () => { + return get(prefix) +} + +/** 保存对话用户扫码登录平台配置。 */ +const postQrLoginPlatform = (platform: QrLoginPlatformRequest) => { + return post(prefix, platform) +} + +/** 校验对话用户扫码登录平台配置是否可用。 */ +const putValidateQrLoginPlatform = (platform: QrLoginPlatformRequest) => { + return put(prefix, platform) +} + +export default { + getQrLoginPlatforms, + postQrLoginPlatform, + putValidateQrLoginPlatform, +} diff --git a/ui/src/api/admin/system/chat-user-auth.ts b/ui/src/api/admin/system/chat-user-auth.ts new file mode 100644 index 00000000000..993e23c666d --- /dev/null +++ b/ui/src/api/admin/system/chat-user-auth.ts @@ -0,0 +1,37 @@ +import { get, post, put } from '../core/request' +import type { AuthProviderSetting, AuthProviderType, LoginAuthSetting } from '@/api/types' + +const prefix = '/chat_user/auth' + +/** 获取对话用户指定认证源配置。 */ +const getAuthSetting = (authType: AuthProviderType) => { + return get>(`${prefix}/${authType}/detail`) +} + +/** 测试对话用户认证源连接。 */ +const postAuthSettingConnection = (setting: AuthProviderSetting) => { + return post(`${prefix}/connection`, setting) +} + +/** 保存对话用户指定认证源配置。 */ +const putAuthSetting = (authType: AuthProviderType, setting: AuthProviderSetting) => { + return put(`${prefix}/${authType}/info`, setting) +} + +/** 获取对话用户登录设置。 */ +const getLoginSetting = () => { + return get(`${prefix}/setting`) +} + +/** 保存对话用户登录设置。 */ +const putLoginSetting = (setting: LoginAuthSetting) => { + return put(`${prefix}/setting`, setting) +} + +export default { + getAuthSetting, + getLoginSetting, + postAuthSettingConnection, + putAuthSetting, + putLoginSetting, +} diff --git a/ui/src/api/types/system-authentication.ts b/ui/src/api/types/system-authentication.ts index 60be9315c83..57196ccbed0 100644 --- a/ui/src/api/types/system-authentication.ts +++ b/ui/src/api/types/system-authentication.ts @@ -1,3 +1,6 @@ +import type { OptionItem } from '@/api/types/common' +import type { QrCodeProvider } from '@/api/types/login' + export type AuthProviderType = 'LDAP' | 'CAS' | 'OIDC' | 'OAuth2' | 'SAML2' export interface AuthProviderSetting { @@ -7,13 +10,8 @@ export interface AuthProviderSetting { is_active: boolean } -export interface LoginMethodOption { - label: string - value: string -} - export interface LoginAuthSetting { - auth_types?: LoginMethodOption[] + auth_types?: OptionItem[] default_value: string failed_attempts: number group_id?: string @@ -22,14 +20,12 @@ export interface LoginAuthSetting { max_attempts: number permission?: string role_id?: string - system_options?: LoginMethodOption[] + system_options?: OptionItem[] workspace_id?: string } -export type QrLoginPlatformType = 'wecom' | 'dingtalk' | 'lark' - export interface QrLoginPlatform { - auth_type: QrLoginPlatformType + auth_type: QrCodeProvider config: Record is_active: boolean is_valid: boolean @@ -38,5 +34,5 @@ export interface QrLoginPlatform { export interface QrLoginPlatformRequest { config: Record isActive: boolean - key: QrLoginPlatformType + key: QrCodeProvider } diff --git a/ui/src/assets/logo/logo_enterprise-wechat.svg b/ui/src/assets/logo/logo_enterprise-wechat.svg new file mode 100644 index 00000000000..ea860124957 --- /dev/null +++ b/ui/src/assets/logo/logo_enterprise-wechat.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/ui/src/constants/auth.ts b/ui/src/constants/auth.ts index 4534baa832a..96b409fe69b 100644 --- a/ui/src/constants/auth.ts +++ b/ui/src/constants/auth.ts @@ -11,3 +11,11 @@ export const LOGIN_METHOD_LABELS: Record = { lark: '飞书', wecom: '企业微信', } + +export const SCAN_FIELD_LABELS: Record = { + agent_id: 'Agent ID', + app_key: 'App Key', + app_secret: 'App Secret', + callback_url: '回调地址', + corp_id: 'Corp ID', +} diff --git a/ui/src/router/admin/system/index.ts b/ui/src/router/admin/system/index.ts index b2c9e544f69..8c0b228e6dc 100644 --- a/ui/src/router/admin/system/index.ts +++ b/ui/src/router/admin/system/index.ts @@ -142,7 +142,8 @@ export const systemRoutes: RouteRecordRaw = { { path: 'authentication', name: 'system-chat-authentication', - component: () => import('@/views/system/SystemView.vue'), + component: () => + import('@/views/system/chat/authentication/AuthenticationView.vue'), meta: { title: '对话用户认证', order: 30 }, }, { @@ -163,7 +164,7 @@ export const systemRoutes: RouteRecordRaw = { path: 'authentication', name: 'system-login-authentication', component: () => - import('@/views/system/settings/authentication/AuthenticationSettingsView.vue'), + import('@/views/system/settings/authentication/AuthenticationView.vue'), meta: { title: '系统用户认证', order: 10 }, }, { diff --git a/ui/src/styles/element-plus.scss b/ui/src/styles/element-plus.scss index c1dccaadb61..2ab58a2c05a 100644 --- a/ui/src/styles/element-plus.scss +++ b/ui/src/styles/element-plus.scss @@ -17,7 +17,18 @@ --el-color-danger-light-7: color-mix(in srgb, var(--mk-danger) 30%, white); --el-color-danger-light-8: color-mix(in srgb, var(--mk-danger) 20%, white); --el-color-danger-light-9: color-mix(in srgb, var(--mk-danger) 10%, white); + --el-color-danger-dark-1: color-mix(in srgb, var(--mk-danger) 85%, black); --el-color-success: var(--mk-success); + --el-color-success-light-1: color-mix(in srgb, var(--mk-success) 85%, white); + --el-color-success-light-3: color-mix(in srgb, var(--mk-success) 70%, white); + --el-color-success-light-4: color-mix(in srgb, var(--mk-success) 60%, white); + --el-color-success-light-5: color-mix(in srgb, var(--mk-success) 50%, white); + --el-color-success-light-6: color-mix(in srgb, var(--mk-success) 40%, white); + --el-color-success-light-7: color-mix(in srgb, var(--mk-success) 30%, white); + --el-color-success-light-8: color-mix(in srgb, var(--mk-success) 20%, white); + --el-color-success-light-9: color-mix(in srgb, var(--mk-success) 10%, white); + --el-color-success-dark-1: color-mix(in srgb, var(--mk-success) 85%, black); + --el-color-warning: var(--mk-warning); --el-border-color: var(--mk-N350); --el-border-radius-base: 6px; @@ -134,12 +145,21 @@ /* card */ .el-card { --el-card-border-radius: 12px; + overflow: visible; + &__body { + overflow: inherit; + } &.is-always-shadow { border: none; } &.is-never-shadow { border: none; } + &.is-never-shadow { + &:hover { + border-color: var(--el-color-primary); + } + } } .el-card.is-always-shadow, @@ -565,6 +585,7 @@ /* switch */ .el-switch { --el-switch-off-color: var(--mk-N400); + height: 22px; } .el-switch--small { .el-switch__core { @@ -644,10 +665,12 @@ /* tag */ .el-tag { - --el-tag-font-size: 14px; max-width: 115px; border: none; padding: 0 6px; + &:not(&--small) { + --el-tag-font-size: 14px; + } &__content { overflow: hidden; @@ -658,6 +681,14 @@ --el-tag-text-color: var(--el-text-color-primary) !important; --el-tag-bg-color: var(--mk-N900-transparent-10) !important; } + &--success { + --el-tag-text-color: var(--el-color-success-dark-1) !important; + --el-tag-bg-color: rgb(var(--mk-success-rgb) / 20%) !important; + } + &--danger { + --el-tag-text-color: var(--el-color-danger-dark-1) !important; + --el-tag-bg-color: rgb(var(--mk-danger-rgb) / 20%) !important; + } &__close { .el-icon { color: var(--el-text-color-regular); diff --git a/ui/src/views/system/settings/authentication/AuthenticationSettingsView.vue b/ui/src/views/system/chat/authentication/AuthenticationView.vue similarity index 95% rename from ui/src/views/system/settings/authentication/AuthenticationSettingsView.vue rename to ui/src/views/system/chat/authentication/AuthenticationView.vue index a033a7a3b03..de7f6789136 100644 --- a/ui/src/views/system/settings/authentication/AuthenticationSettingsView.vue +++ b/ui/src/views/system/chat/authentication/AuthenticationView.vue @@ -3,7 +3,7 @@ import { ref, type Component } from 'vue' import LDAP from './components/LDAP.vue' import CAS from './components/CAS.vue' import OIDC from './components/OIDC.vue' -import SCAN from './components/SCAN.vue' +import SCAN from './components/SCANLogin.vue' import OAuth2 from './components/OAuth2.vue' import Saml2 from './components/Saml2.vue' import LoginSetting from './components/LoginSetting.vue' @@ -14,7 +14,7 @@ interface AuthenticationTab { name: string } -const activeName = ref('LoginSetting') +const activeName = ref('SCAN') const authenticationTabs: AuthenticationTab[] = [ { label: '登录设置', name: 'LoginSetting', component: LoginSetting }, { label: 'LDAP', name: 'LDAP', component: LDAP }, diff --git a/ui/src/views/system/chat/authentication/EditSCANDrawer.vue b/ui/src/views/system/chat/authentication/EditSCANDrawer.vue new file mode 100644 index 00000000000..66ee18725b6 --- /dev/null +++ b/ui/src/views/system/chat/authentication/EditSCANDrawer.vue @@ -0,0 +1,105 @@ + + + diff --git a/ui/src/views/system/chat/authentication/components/CAS.vue b/ui/src/views/system/chat/authentication/components/CAS.vue new file mode 100644 index 00000000000..0d3214a5109 --- /dev/null +++ b/ui/src/views/system/chat/authentication/components/CAS.vue @@ -0,0 +1,85 @@ + + + diff --git a/ui/src/views/system/chat/authentication/components/LDAP.vue b/ui/src/views/system/chat/authentication/components/LDAP.vue new file mode 100644 index 00000000000..15fac93b1fe --- /dev/null +++ b/ui/src/views/system/chat/authentication/components/LDAP.vue @@ -0,0 +1,106 @@ + + + diff --git a/ui/src/views/system/chat/authentication/components/LoginSetting.vue b/ui/src/views/system/chat/authentication/components/LoginSetting.vue new file mode 100644 index 00000000000..f62de530dda --- /dev/null +++ b/ui/src/views/system/chat/authentication/components/LoginSetting.vue @@ -0,0 +1,274 @@ + + + diff --git a/ui/src/views/system/chat/authentication/components/OAuth2.vue b/ui/src/views/system/chat/authentication/components/OAuth2.vue new file mode 100644 index 00000000000..79fb094ec63 --- /dev/null +++ b/ui/src/views/system/chat/authentication/components/OAuth2.vue @@ -0,0 +1,111 @@ + + + diff --git a/ui/src/views/system/chat/authentication/components/OIDC.vue b/ui/src/views/system/chat/authentication/components/OIDC.vue new file mode 100644 index 00000000000..7ad89b3c23b --- /dev/null +++ b/ui/src/views/system/chat/authentication/components/OIDC.vue @@ -0,0 +1,117 @@ + + + diff --git a/ui/src/views/system/chat/authentication/components/SCANLogin.vue b/ui/src/views/system/chat/authentication/components/SCANLogin.vue new file mode 100644 index 00000000000..a0c39f47187 --- /dev/null +++ b/ui/src/views/system/chat/authentication/components/SCANLogin.vue @@ -0,0 +1,146 @@ + + + diff --git a/ui/src/views/system/chat/authentication/components/Saml2.vue b/ui/src/views/system/chat/authentication/components/Saml2.vue new file mode 100644 index 00000000000..067be40ec54 --- /dev/null +++ b/ui/src/views/system/chat/authentication/components/Saml2.vue @@ -0,0 +1,123 @@ + + + diff --git a/ui/src/views/system/settings/authentication/AuthenticationView.vue b/ui/src/views/system/settings/authentication/AuthenticationView.vue new file mode 100644 index 00000000000..de7f6789136 --- /dev/null +++ b/ui/src/views/system/settings/authentication/AuthenticationView.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/ui/src/views/system/settings/authentication/EditSCANDrawer.vue b/ui/src/views/system/settings/authentication/EditSCANDrawer.vue new file mode 100644 index 00000000000..fb517447768 --- /dev/null +++ b/ui/src/views/system/settings/authentication/EditSCANDrawer.vue @@ -0,0 +1,105 @@ + + + diff --git a/ui/src/views/system/settings/authentication/components/AuthProviderForm.vue b/ui/src/views/system/settings/authentication/components/AuthProviderForm.vue deleted file mode 100644 index e65e60ab2dd..00000000000 --- a/ui/src/views/system/settings/authentication/components/AuthProviderForm.vue +++ /dev/null @@ -1,130 +0,0 @@ - - - diff --git a/ui/src/views/system/settings/authentication/components/CAS.vue b/ui/src/views/system/settings/authentication/components/CAS.vue index 09b591b8e8d..581c5c422af 100644 --- a/ui/src/views/system/settings/authentication/components/CAS.vue +++ b/ui/src/views/system/settings/authentication/components/CAS.vue @@ -1,14 +1,85 @@ diff --git a/ui/src/views/system/settings/authentication/components/EditModal.vue b/ui/src/views/system/settings/authentication/components/EditModal.vue deleted file mode 100644 index 1e29ed2633d..00000000000 --- a/ui/src/views/system/settings/authentication/components/EditModal.vue +++ /dev/null @@ -1,115 +0,0 @@ - - - diff --git a/ui/src/views/system/settings/authentication/components/LDAP.vue b/ui/src/views/system/settings/authentication/components/LDAP.vue index 00287244405..ec9f47deb1f 100644 --- a/ui/src/views/system/settings/authentication/components/LDAP.vue +++ b/ui/src/views/system/settings/authentication/components/LDAP.vue @@ -1,21 +1,106 @@ diff --git a/ui/src/views/system/settings/authentication/components/OAuth2.vue b/ui/src/views/system/settings/authentication/components/OAuth2.vue index b2c604f10c6..ee781828c29 100644 --- a/ui/src/views/system/settings/authentication/components/OAuth2.vue +++ b/ui/src/views/system/settings/authentication/components/OAuth2.vue @@ -1,19 +1,111 @@ diff --git a/ui/src/views/system/settings/authentication/components/OIDC.vue b/ui/src/views/system/settings/authentication/components/OIDC.vue index f8bf18ca522..924baa67a21 100644 --- a/ui/src/views/system/settings/authentication/components/OIDC.vue +++ b/ui/src/views/system/settings/authentication/components/OIDC.vue @@ -1,25 +1,117 @@ diff --git a/ui/src/views/system/settings/authentication/components/SCAN.vue b/ui/src/views/system/settings/authentication/components/SCAN.vue deleted file mode 100644 index 95ef5bf2961..00000000000 --- a/ui/src/views/system/settings/authentication/components/SCAN.vue +++ /dev/null @@ -1,137 +0,0 @@ - - - diff --git a/ui/src/views/system/settings/authentication/components/SCANLogin.vue b/ui/src/views/system/settings/authentication/components/SCANLogin.vue new file mode 100644 index 00000000000..43af77dc69d --- /dev/null +++ b/ui/src/views/system/settings/authentication/components/SCANLogin.vue @@ -0,0 +1,146 @@ + + + diff --git a/ui/src/views/system/settings/authentication/components/Saml2.vue b/ui/src/views/system/settings/authentication/components/Saml2.vue index 77d9b2c19c9..433d16975ff 100644 --- a/ui/src/views/system/settings/authentication/components/Saml2.vue +++ b/ui/src/views/system/settings/authentication/components/Saml2.vue @@ -1,33 +1,123 @@ diff --git a/ui/src/views/system/settings/email/EmailSettingsView.vue b/ui/src/views/system/settings/email/EmailSettingsView.vue index 58814b441d2..6354cfbf880 100644 --- a/ui/src/views/system/settings/email/EmailSettingsView.vue +++ b/ui/src/views/system/settings/email/EmailSettingsView.vue @@ -54,7 +54,7 @@ function submitEmailSetting(action: 'save' | 'test') { }) } -onMounted(loadEmailSetting) +onMounted(() => loadEmailSetting())