fix: The default password change in the configuration file did not take effect on the frontend

This commit is contained in:
fit2cloud-chenyw
2025-10-17 15:11:33 +08:00
committed by fit2cloud-chenyw
parent e517433ff0
commit ce194ca991
3 changed files with 17 additions and 2 deletions
+5
View File
@@ -12,6 +12,7 @@ from common.core.pagination import Paginator
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 @@ router = APIRouter(tags=["user"], prefix="/user")
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,
+1
View File
@@ -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'),
}
+11 -2
View File
@@ -157,7 +157,7 @@
<span class="header-span">{{ t('datasource.the_original_one') }}</span>
</div>
<div class="confirm-content">
<span>SQLBot@123456</span>
<span>{{ defaultPwd }}</span>
<el-button style="margin-left: 4px" text @click="copyText">{{
t('datasource.copy')
}}</el-button>
@@ -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<any>) => {
})
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()
})
</script>