From 871586be5c5400fc9ba1fccfd7f29f31ab4fc84c Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Tue, 27 Oct 2026 18:16:50 +0800 Subject: [PATCH] fix: update authentication handling to use accessToken parameter and improve conflict message formatting in user import --- apps/system_manage/serializers/chat_user_serializer.py | 5 ++++- ui/src/api/chat/README.md | 4 ++-- ui/src/api/chat/auth.ts | 4 ++-- .../overview/display-setting/XpackDisplaySettingDialog.vue | 4 ++-- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/apps/system_manage/serializers/chat_user_serializer.py b/apps/system_manage/serializers/chat_user_serializer.py index c96b1173851..4a650ff8345 100644 --- a/apps/system_manage/serializers/chat_user_serializer.py +++ b/apps/system_manage/serializers/chat_user_serializer.py @@ -60,7 +60,10 @@ def create_token_and_cache(access_token, user, request): if not is_authorized: raise AppApiException(1005, _("The user does not have permission to access the application")) token = ChatToken( - user.id, AuthenticationType.CHAT_USER, str(Operate.LOCAL).lower(), application_id=application_id + str(user.id), + AuthenticationType.CHAT_USER, + str(Operate.LOCAL).lower(), + application_id=str(application_id), ).to_token() status = 200 return token diff --git a/ui/src/api/chat/README.md b/ui/src/api/chat/README.md index e96779e854e..47748919cbe 100644 --- a/ui/src/api/chat/README.md +++ b/ui/src/api/chat/README.md @@ -22,5 +22,5 @@ Chat 业务接口统一调用后端 v3 路由(`/chat/api/v3/...`);文件 `auth.ts` 维护门户与单应用的认证:`getApplicationAuthProfile(accessToken)` 请求 `/profile`, `getPortalAuthProfile()` 请求 `/portal/profile`,两者返回结构相同的 `AuthProfile`,差异字段在 `meta`。 `postAnonymousAuth(accessToken?)` 与 `postLogin(loginRequest, accessToken?)` 传入 accessToken 时为应用认证, -否则为门户认证。`getCaptcha(username, accessToken)` 获取应用登录验证码,后端目前以 `application_id` -查询参数接收 accessToken,暂不支持门户。`chat-user.ts` 的 `getChatUserProfile()` 获取当前对话用户。 +否则为门户认证。`getCaptcha(username, accessToken)` 获取应用登录验证码,后端以 `accessToken` +查询参数接收应用令牌,暂不支持门户。`chat-user.ts` 的 `getChatUserProfile()` 获取当前对话用户。 diff --git a/ui/src/api/chat/auth.ts b/ui/src/api/chat/auth.ts index ea77baa88f9..67e857ef413 100644 --- a/ui/src/api/chat/auth.ts +++ b/ui/src/api/chat/auth.ts @@ -69,10 +69,10 @@ const getDingTalkCallback = (code: string, accessToken?: string) => { /** * 获取应用登录验证码;无需验证码时返回空字符串。 - * 后端当前以 `application_id` 查询参数接收 accessToken,且仅支持应用场景。 + * 后端以 `accessToken` 查询参数接收应用令牌,且仅支持应用场景。 */ const getCaptcha = (username: string, accessToken: string) => { - return get('/v3/captcha', { username, application_id: accessToken }) + return get('/v3/captcha', { username, accessToken }) } /** 退出当前对话用户登录状态。 */ diff --git a/ui/src/views/application-detail/overview/display-setting/XpackDisplaySettingDialog.vue b/ui/src/views/application-detail/overview/display-setting/XpackDisplaySettingDialog.vue index 73aaea740a9..04ef417021a 100644 --- a/ui/src/views/application-detail/overview/display-setting/XpackDisplaySettingDialog.vue +++ b/ui/src/views/application-detail/overview/display-setting/XpackDisplaySettingDialog.vue @@ -7,6 +7,7 @@ import { MsgError, MsgSuccess } from '@/utils/message' import { useApplicationDetailContext } from '../../context' import DisplaySettingPreview from './components/DisplaySettingPreview.vue' import { APPLICATION_DISPLAY_SETTING_DEFAULT } from '@/constants/application' +import ApplicationApi from '@/api/admin/workspace/application/application' defineOptions({ name: 'XpackDisplaySettingDialog' }) @@ -46,8 +47,7 @@ const languageOptions = [ function loadSetting() { if (loading.value) return loading.value = true - return resourceApi.application - .getAccessToken(applicationId.value) + return ApplicationApi.getDisplaySetting(applicationId.value) .then((config) => { // 旧版接口可能省略展示字段,嵌套配置分别补齐默认值。 const setting: ApplicationDisplaySetting = cloneDeep(APPLICATION_DISPLAY_SETTING_DEFAULT)