mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 00:09:16 +08:00
feat: 支持自定义概览页安全入口提示是否显示 (#2257)
This commit is contained in:
parent
ac91480987
commit
d1d0ca92ca
@ -1052,6 +1052,7 @@ const message = {
|
||||
|
||||
safe: 'Security',
|
||||
entrance: 'Entrance',
|
||||
showEntrance: 'Enable Home Page Notification Not Enabled',
|
||||
entranceHelper: 'Enabling secure entry will only allow logging in to the panel through specified secure entry.',
|
||||
entranceError:
|
||||
'Please enter a secure login entry point of 6-10 characters, only numbers or letters are supported.',
|
||||
|
@ -1052,6 +1052,7 @@ const message = {
|
||||
|
||||
safe: '安全',
|
||||
entrance: '安全入口',
|
||||
showEntrance: '啟用概覽頁未開啟提醒',
|
||||
entranceHelper: '開啟安全入口後只能通過指定安全入口登錄面板',
|
||||
entranceError: '請輸入 6-10 位安全登錄入口,僅支持輸入數字或字母',
|
||||
entranceInputHelper: '安全入口設置為空時,則取消安全入口',
|
||||
|
@ -1052,6 +1052,7 @@ const message = {
|
||||
|
||||
safe: '安全',
|
||||
entrance: '安全入口',
|
||||
showEntrance: '启用概览页未开启提醒',
|
||||
entranceHelper: '开启安全入口后只能通过指定安全入口登录面板',
|
||||
entranceError: '请输入 6-10 位安全登录入口,仅支持输入数字或字母',
|
||||
entranceInputHelper: '安全入口设置为空时,则取消安全入口',
|
||||
|
@ -28,6 +28,7 @@ export const GlobalStore = defineStore({
|
||||
device: DeviceType.Desktop,
|
||||
lastFilePath: '',
|
||||
currentDB: '',
|
||||
showEntranceWarn: true,
|
||||
}),
|
||||
getters: {},
|
||||
actions: {
|
||||
@ -68,6 +69,9 @@ export const GlobalStore = defineStore({
|
||||
setCurrentDB(name: string) {
|
||||
this.currentDB = name;
|
||||
},
|
||||
setShowEntranceWarn(show: boolean) {
|
||||
this.showEntranceWarn = show;
|
||||
},
|
||||
},
|
||||
persist: piniaPersistConfig('GlobalState'),
|
||||
});
|
||||
|
@ -23,6 +23,7 @@ export interface GlobalState {
|
||||
device: DeviceType;
|
||||
lastFilePath: string;
|
||||
currentDB: string;
|
||||
showEntranceWarn: boolean;
|
||||
}
|
||||
|
||||
export interface MenuState {
|
||||
|
@ -8,7 +8,12 @@
|
||||
},
|
||||
]"
|
||||
/>
|
||||
<el-alert v-if="!isSafety" :closable="false" style="margin-top: 20px" type="warning">
|
||||
<el-alert
|
||||
v-if="!isSafety && globalStore.showEntranceWarn"
|
||||
style="margin-top: 20px"
|
||||
type="warning"
|
||||
@close="hideEntrance"
|
||||
>
|
||||
<template #default>
|
||||
<span>
|
||||
<span>{{ $t('home.entranceHelper') }}</span>
|
||||
@ -504,6 +509,10 @@ const loadData = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
const hideEntrance = () => {
|
||||
globalStore.setShowEntranceWarn(false);
|
||||
};
|
||||
|
||||
const loadUpgradeStatus = async () => {
|
||||
const res = await loadUpgradeInfo();
|
||||
if (res.data) {
|
||||
|
@ -24,6 +24,9 @@
|
||||
{{ $t('setting.entranceInputHelper') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-checkbox v-model="show" :label="$t('setting.showEntrance')" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@ -56,6 +59,7 @@ interface DialogProps {
|
||||
}
|
||||
const drawerVisiable = ref();
|
||||
const loading = ref();
|
||||
const show = ref();
|
||||
|
||||
const form = reactive({
|
||||
securityEntrance: '',
|
||||
@ -78,6 +82,7 @@ function checkSecurityEntrance(rule: any, value: any, callback: any) {
|
||||
|
||||
const acceptParams = (params: DialogProps): void => {
|
||||
form.securityEntrance = params.securityEntrance;
|
||||
show.value = globalStore.showEntranceWarn;
|
||||
drawerVisiable.value = true;
|
||||
};
|
||||
|
||||
@ -96,6 +101,7 @@ const submitEntrance = async (formEl: FormInstance | undefined) => {
|
||||
loading.value = true;
|
||||
await updateSetting(param)
|
||||
.then(() => {
|
||||
globalStore.setShowEntranceWarn(show.value);
|
||||
globalStore.entrance = form.securityEntrance;
|
||||
loading.value = false;
|
||||
drawerVisiable.value = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user