From 083fc9a283bf9240f4290dc264a7249bf45cb8d3 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 17 Oct 2025 15:10:01 +0800 Subject: [PATCH] fix: The default password change in the configuration file did not take effect on the frontend --- backend/apps/system/api/user.py | 5 +++++ frontend/src/api/user.ts | 1 + frontend/src/views/system/user/User.vue | 13 +++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/backend/apps/system/api/user.py b/backend/apps/system/api/user.py index 7453e94e..e4dcd3fe 100644 --- a/backend/apps/system/api/user.py +++ b/backend/apps/system/api/user.py @@ -12,6 +12,7 @@ from common.core.schemas import PaginatedResponse, PaginationParams from common.core.security import default_md5_pwd, md5pwd, verify_md5pwd from common.core.sqlbot_cache import clear_cache +from common.core.config import settings router = APIRouter(tags=["user"], prefix="/user") @@ -19,6 +20,10 @@ async def user_info(current_user: CurrentUser): return current_user +@router.get("/defaultPwd") +async def default_pwd() -> str: + return settings.DEFAULT_PWD + @router.get("/pager/{pageNum}/{pageSize}", response_model=PaginatedResponse[UserGrid]) async def pager( session: SessionDep, diff --git a/frontend/src/api/user.ts b/frontend/src/api/user.ts index ed2e32c0..7722ceb2 100644 --- a/frontend/src/api/user.ts +++ b/frontend/src/api/user.ts @@ -26,4 +26,5 @@ export const userApi = { get: (key: string) => request.get(`/user/${key}`), pwd: (id: any) => request.patch(`/user/pwd/${id}`), status: (data: any) => request.patch('/user/status', data), + defaultPwd: () => request.get('/user/defaultPwd'), } diff --git a/frontend/src/views/system/user/User.vue b/frontend/src/views/system/user/User.vue index 1446f385..b63798b9 100644 --- a/frontend/src/views/system/user/User.vue +++ b/frontend/src/views/system/user/User.vue @@ -157,7 +157,7 @@ {{ t('datasource.the_original_one') }}
- SQLBot@123456 + {{ defaultPwd }} {{ t('datasource.copy') }} @@ -387,6 +387,7 @@ import { useClipboard } from '@vueuse/core' const { copy } = useClipboard({ legacy: true }) const { t } = useI18n() +const defaultPwd = ref('SQLBot@123456') const keyword = ref('') const dialogFormVisible = ref(false) const termFormRef = ref() @@ -511,7 +512,7 @@ const setPopoverRef = (el: any, row: any) => { } const copyText = () => { - copy('SQLBot@123456') + copy(defaultPwd.value) .then(function () { ElMessage.success(t('embedded.copy_successful')) }) @@ -793,12 +794,20 @@ const formatSpaceName = (row_oid_list: Array) => { }) return row_oid_list.map((id: any) => wsMap[id]).join(',') } +const loadDefaultPwd = () => { + userApi.defaultPwd().then((res) => { + if (res) { + defaultPwd.value = res + } + }) +} onMounted(() => { workspaceList().then((res) => { options.value = res || [] filterOption.value[2].option = [...options.value] }) search() + loadDefaultPwd() })