1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-31 14:08:06 +08:00

fix: 面板设置校验修改

This commit is contained in:
ssongliu 2022-12-01 19:23:51 +08:00 committed by ssongliu
parent 921eb08dd7
commit 99d329967c
8 changed files with 25 additions and 17 deletions

View File

@ -336,6 +336,7 @@ export default {
last4Hour: 'Last 4 Hours',
lastHour: 'Last Hour',
last10Min: 'Last 10 Minutes',
newName: 'New name',
custom: 'Custom',
emptyUser: 'When empty, you will log in with the default user of container',
@ -618,6 +619,7 @@ export default {
languageHelper:
'By default, it follows the browser language. This parameter takes effect only on the current browser',
sessionTimeout: 'Timeout',
sessionTimeoutError: 'The minimum timeout is 300 seconds',
sessionTimeoutHelper:
'If you do not operate the panel for more than {0} seconds, the panel automatically logs out',
syncTime: 'Synchronization time',
@ -625,6 +627,7 @@ export default {
oldPassword: 'Original password',
newPassword: 'New password',
retryPassword: 'Confirm password',
duplicatePassword: 'The new password cannot be the same as the original password, please re-enter!',
backup: 'Backup',
noTypeForCreate: 'No backup type is currently created',

View File

@ -341,6 +341,7 @@ export default {
last4Hour: '最近 4 小时',
lastHour: '最近 1 小时',
last10Min: '最近 10 分钟',
newName: '新名称',
custom: '自定义',
containerTerminal: '容器终端',
@ -636,12 +637,14 @@ export default {
language: '系统语言',
languageHelper: '默认跟随浏览器语言设置后只对当前浏览器生效更换浏览器后需要重新设置',
sessionTimeout: '超时时间',
sessionTimeoutError: '最小超时时间为 300 ',
sessionTimeoutHelper: '如果用户超过 {0} 秒未操作面板面板将自动退出登录',
syncTime: '同步时间',
changePassword: '密码修改',
oldPassword: '原密码',
newPassword: '新密码',
retryPassword: '确认密码',
duplicatePassword: '新密码不能与原始密码一致请重新输入',
backup: '备份',
noTypeForCreate: '当前无可创建备份类型',

View File

@ -115,7 +115,7 @@
</el-dialog>
<el-dialog
@close="onCloseLog"
@close="search()"
v-model="newNameVisiable"
:destroy-on-close="true"
:close-on-click-modal="false"
@ -127,7 +127,7 @@
</div>
</template>
<el-form ref="newNameRef" :model="renameForm">
<el-form-item label="新名称" :rules="Rules.requiredInput" prop="newName">
<el-form-item :label="$t('container.newName')" :rules="Rules.requiredInput" prop="newName">
<el-input v-model="renameForm.newName"></el-input>
</el-form-item>
</el-form>
@ -296,7 +296,7 @@ const onSubmitName = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.validate(async (valid) => {
if (!valid) return;
ContainerOperator(renameForm);
await ContainerOperator(renameForm);
search();
newNameVisiable.value = false;
ElMessage.success(i18n.global.t('commons.msg.operationSuccess'));

View File

@ -18,12 +18,6 @@
</template>
</el-table-column>
<el-table-column :label="$t('container.driver')" show-overflow-tooltip min-width="40" prop="driver" />
<el-table-column :label="$t('container.attachable')" min-width="40" prop="attachable" fix>
<template #default="{ row }">
<el-icon color="green" v-if="row.attachable"><Select /></el-icon>
<el-icon color="red" v-if="!row.attachable"><CloseBold /></el-icon>
</template>
</el-table-column>
<el-table-column :label="$t('container.subnet')" min-width="80" prop="subnet" fix />
<el-table-column :label="$t('container.gateway')" min-width="80" prop="gateway" fix />
<el-table-column :label="$t('container.tag')" min-width="140" fix>

View File

@ -3,7 +3,7 @@
<el-card style="margin-top: 20px">
<template #header>
<div class="card-header">
<span style="font-size: 14px; font-weight: 500">当前密码已过期请重新修改密码</span>
<span style="font-size: 14px; font-weight: 500">{{ $t('setting.expiredHelper') }}</span>
</div>
</template>
<el-row>
@ -115,6 +115,10 @@ const submitChangePassword = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.validate(async (valid) => {
if (!valid) return;
if (settingForm.complexityVerification === 'disable' && passForm.newPassword === passForm.oldPassword) {
ElMessage.error(i18n.global.t('setting.duplicatePassword'));
return;
}
let password =
settingForm.complexityVerification === 'disable' ? passForm.newPassword : passForm.newPasswordComplexity;
await handleExpired({ oldPassword: passForm.oldPassword, newPassword: password });

View File

@ -90,7 +90,7 @@ const { switchDark } = useTheme();
const SaveSetting = async (formEl: FormInstance | undefined, key: string, val: any) => {
if (!formEl) return;
const result = await formEl.validateField('settingInfo.' + key[0].toLowerCase(), callback);
const result = await formEl.validateField('settingInfo.' + key.replace(key[0], key[0].toLowerCase()), callback);
if (!result) {
return;
}
@ -109,7 +109,6 @@ const SaveSetting = async (formEl: FormInstance | undefined, key: string, val: a
case 'PanelName':
globalStore.setThemeConfig({ ...themeConfig.value, panelName: val });
break;
case 'SessionTimeout':
case 'MonitorStoreDays':
case 'ServerPort':
val = val + '';

View File

@ -13,19 +13,19 @@
<h3>v1.0.0</h3>
<div style="margin-top: 10px">
<el-link @click="toGithub">
<svg-icon style="font-size: 9px; margin-bottom: 8px" iconName="p-huaban88"></svg-icon>
<svg-icon style="font-size: 7px; margin-bottom: 3px" iconName="p-huaban88"></svg-icon>
<span style="line-height: 20px">{{ $t('setting.project') }}</span>
</el-link>
<el-link @click="toIssue" style="margin-left: 15px">
<svg-icon style="font-size: 9px; margin-bottom: 8px" iconName="p-bug"></svg-icon>
<svg-icon style="font-size: 7px; margin-bottom: 3px" iconName="p-bug"></svg-icon>
<span>{{ $t('setting.issue') }}</span>
</el-link>
<el-link @click="toTalk" style="margin-left: 15px">
<svg-icon style="font-size: 9px; margin-bottom: 8px" iconName="p-taolun"></svg-icon>
<svg-icon style="font-size: 7px; margin-bottom: 3px" iconName="p-taolun"></svg-icon>
<span>{{ $t('setting.chat') }}</span>
</el-link>
<el-link @click="toGithubStar" style="margin-left: 15px">
<svg-icon style="font-size: 9px; margin-bottom: 6px" iconName="p-star"></svg-icon>
<svg-icon style="font-size: 7px; margin-bottom: 3px" iconName="p-star"></svg-icon>
<span>{{ $t('setting.star') }}</span>
</el-link>
</div>

View File

@ -95,7 +95,7 @@
<el-form-item
:label="$t('setting.sessionTimeout')"
:rules="Rules.number"
:rules="sessionTimeoutRules"
prop="settingInfo.sessionTimeout"
>
<el-input v-model.number="form.settingInfo.sessionTimeout">
@ -199,6 +199,11 @@ const passForm = reactive({
retryPassword: '',
});
const sessionTimeoutRules = [
Rules.number,
{ min: 300, type: 'number', message: i18n.global.t('setting.sessionTimeoutError'), trigger: 'blur' },
];
interface Props {
settingInfo: any;
}