Skip to content

Commit ce194ca

Browse files
fix: The default password change in the configuration file did not take effect on the frontend
1 parent e517433 commit ce194ca

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

backend/apps/system/api/user.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,18 @@
1212
from common.core.schemas import PaginatedResponse, PaginationParams
1313
from common.core.security import default_md5_pwd, md5pwd, verify_md5pwd
1414
from common.core.sqlbot_cache import clear_cache
15+
from common.core.config import settings
1516

1617
router = APIRouter(tags=["user"], prefix="/user")
1718

1819
@router.get("/info")
1920
async def user_info(current_user: CurrentUser):
2021
return current_user
2122

23+
@router.get("/defaultPwd")
24+
async def default_pwd() -> str:
25+
return settings.DEFAULT_PWD
26+
2227
@router.get("/pager/{pageNum}/{pageSize}", response_model=PaginatedResponse[UserGrid])
2328
async def pager(
2429
session: SessionDep,

frontend/src/api/user.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,5 @@ export const userApi = {
2626
get: (key: string) => request.get(`/user/${key}`),
2727
pwd: (id: any) => request.patch(`/user/pwd/${id}`),
2828
status: (data: any) => request.patch('/user/status', data),
29+
defaultPwd: () => request.get('/user/defaultPwd'),
2930
}

frontend/src/views/system/user/User.vue

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
<span class="header-span">{{ t('datasource.the_original_one') }}</span>
158158
</div>
159159
<div class="confirm-content">
160-
<span>SQLBot@123456</span>
160+
<span>{{ defaultPwd }}</span>
161161
<el-button style="margin-left: 4px" text @click="copyText">{{
162162
t('datasource.copy')
163163
}}</el-button>
@@ -387,6 +387,7 @@ import { useClipboard } from '@vueuse/core'
387387
const { copy } = useClipboard({ legacy: true })
388388
389389
const { t } = useI18n()
390+
const defaultPwd = ref('SQLBot@123456')
390391
const keyword = ref('')
391392
const dialogFormVisible = ref(false)
392393
const termFormRef = ref()
@@ -511,7 +512,7 @@ const setPopoverRef = (el: any, row: any) => {
511512
}
512513
513514
const copyText = () => {
514-
copy('SQLBot@123456')
515+
copy(defaultPwd.value)
515516
.then(function () {
516517
ElMessage.success(t('embedded.copy_successful'))
517518
})
@@ -793,12 +794,20 @@ const formatSpaceName = (row_oid_list: Array<any>) => {
793794
})
794795
return row_oid_list.map((id: any) => wsMap[id]).join(',')
795796
}
797+
const loadDefaultPwd = () => {
798+
userApi.defaultPwd().then((res) => {
799+
if (res) {
800+
defaultPwd.value = res
801+
}
802+
})
803+
}
796804
onMounted(() => {
797805
workspaceList().then((res) => {
798806
options.value = res || []
799807
filterOption.value[2].option = [...options.value]
800808
})
801809
search()
810+
loadDefaultPwd()
802811
})
803812
</script>
804813

0 commit comments

Comments
 (0)