Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions backend/apps/system/api/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@
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")

@router.get("/info")
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,
Expand Down
1 change: 1 addition & 0 deletions frontend/src/api/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
}
13 changes: 11 additions & 2 deletions frontend/src/views/system/user/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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'))
})
Expand Down Expand Up @@ -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>

Expand Down