mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-12-26 17:28:48 +08:00
fix: Modify database verification rules (#8342)
This commit is contained in:
parent
097a33c68f
commit
170bd22062
5 changed files with 22 additions and 35 deletions
|
|
@ -122,7 +122,9 @@ func (u *CronjobService) CleanRecord(req dto.CronjobClean) error {
|
|||
}
|
||||
}
|
||||
cronjob.RetainCopies = 0
|
||||
u.removeExpiredBackup(cronjob, accountMap, model.BackupRecord{})
|
||||
if len(accountMap) != 0 {
|
||||
u.removeExpiredBackup(cronjob, accountMap, model.BackupRecord{})
|
||||
}
|
||||
} else {
|
||||
u.removeExpiredLog(cronjob)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.login.password')" prop="password">
|
||||
<el-input type="password" clearable show-password v-model="form.password"></el-input>
|
||||
<span class="input-help">{{ $t('commons.rule.illegalChar') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('database.permission')" prop="permission">
|
||||
<el-select v-model="form.permission">
|
||||
|
|
@ -25,10 +26,13 @@
|
|||
<el-option
|
||||
v-if="form.from !== 'local'"
|
||||
value="localhost"
|
||||
:label="$t('terminal.localhost')"
|
||||
:label="$t('terminal.localhost') + '(localhost)'"
|
||||
/>
|
||||
<el-option value="ip" :label="$t('database.permissionForIP')" />
|
||||
</el-select>
|
||||
<span v-if="form.from !== 'local'" class="input-help">
|
||||
{{ $t('database.localhostHelper') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.permission === 'ip'" prop="permissionIPs">
|
||||
<el-input clearable :rows="3" type="textarea" v-model="form.permissionIPs" />
|
||||
|
|
@ -60,7 +64,6 @@ import { bindUser } from '@/api/modules/database';
|
|||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { Rules } from '@/global/form-rules';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { checkIp } from '@/utils/util';
|
||||
|
||||
const loading = ref();
|
||||
const bindVisible = ref(false);
|
||||
|
|
@ -79,21 +82,11 @@ const confirmDialogRef = ref();
|
|||
|
||||
const rules = reactive({
|
||||
username: [Rules.requiredInput, Rules.name],
|
||||
password: [Rules.paramComplexity],
|
||||
password: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
|
||||
permission: [Rules.requiredSelect],
|
||||
permissionIPs: [{ validator: checkIPs, trigger: 'blur', required: true }],
|
||||
permissionIPs: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
|
||||
});
|
||||
|
||||
function checkIPs(rule: any, value: any, callback: any) {
|
||||
let ips = form.permissionIPs.split(',');
|
||||
for (const item of ips) {
|
||||
if (checkIp(item)) {
|
||||
return callback(new Error(i18n.global.t('commons.rule.ip')));
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
interface DialogProps {
|
||||
from: string;
|
||||
database: string;
|
||||
|
|
|
|||
|
|
@ -43,10 +43,13 @@
|
|||
<el-option
|
||||
v-if="form.from !== 'local'"
|
||||
value="localhost"
|
||||
:label="$t('terminal.localhost')"
|
||||
:label="$t('terminal.localhost') + '(localhost)'"
|
||||
/>
|
||||
<el-option value="ip" :label="$t('database.permissionForIP')" />
|
||||
</el-select>
|
||||
<span v-if="form.from !== 'local'" class="input-help">
|
||||
{{ $t('database.localhostHelper') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.permission === 'ip'" prop="permissionIPs">
|
||||
<el-input clearable :rows="3" type="textarea" v-model="form.permissionIPs" />
|
||||
|
|
@ -86,7 +89,7 @@ import { ElForm } from 'element-plus';
|
|||
import { addMysqlDB } from '@/api/modules/database';
|
||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||
import { MsgSuccess } from '@/utils/message';
|
||||
import { checkIp, getRandomStr } from '@/utils/util';
|
||||
import { getRandomStr } from '@/utils/util';
|
||||
|
||||
const loading = ref();
|
||||
const createVisible = ref(false);
|
||||
|
|
@ -107,17 +110,8 @@ const rules = reactive({
|
|||
username: [Rules.requiredInput, Rules.name],
|
||||
password: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
|
||||
permission: [Rules.requiredSelect],
|
||||
permissionIPs: [{ validator: checkIPs, trigger: 'blur', required: true }],
|
||||
permissionIPs: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
|
||||
});
|
||||
function checkIPs(rule: any, value: any, callback: any) {
|
||||
let ips = form.permissionIPs.split(',');
|
||||
for (const item of ips) {
|
||||
if (checkIp(item)) {
|
||||
return callback(new Error(i18n.global.t('commons.rule.ip')));
|
||||
}
|
||||
}
|
||||
callback();
|
||||
}
|
||||
|
||||
type FormInstance = InstanceType<typeof ElForm>;
|
||||
const formRef = ref<FormInstance>();
|
||||
|
|
|
|||
|
|
@ -18,12 +18,7 @@
|
|||
<el-input disabled v-model="changeForm.userName"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.login.password')" prop="password">
|
||||
<el-input
|
||||
type="password"
|
||||
clearable
|
||||
show-password
|
||||
v-model="changeForm.password"
|
||||
></el-input>
|
||||
<el-input type="password" clearable show-password v-model="changeForm.password" />
|
||||
<span class="input-help">{{ $t('commons.rule.illegalChar') }}</span>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
|
@ -38,7 +33,9 @@
|
|||
/>
|
||||
<el-option value="ip" :label="$t('database.permissionForIP')" />
|
||||
</el-select>
|
||||
<span class="input-help">{{ $t('database.localhostHelper') }}</span>
|
||||
<span v-if="changeForm.from !== 'local'" class="input-help">
|
||||
{{ $t('database.localhostHelper') }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="changeForm.privilege === 'ip'" prop="privilegeIPs">
|
||||
<el-input clearable :rows="3" type="textarea" v-model="changeForm.privilegeIPs" />
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
</el-form-item>
|
||||
<el-form-item :label="$t('commons.login.password')" prop="password">
|
||||
<el-input type="password" clearable show-password v-model="form.password" />
|
||||
<span class="input-help">{{ $t('commons.rule.illegalChar') }}</span>
|
||||
</el-form-item>
|
||||
<el-form-item :label="$t('database.permission')" prop="superUser">
|
||||
<el-checkbox v-model="form.superUser">{{ $t('database.pgSuperUser') }}</el-checkbox>
|
||||
|
|
@ -65,7 +66,7 @@ const confirmDialogRef = ref();
|
|||
|
||||
const rules = reactive({
|
||||
username: [Rules.requiredInput, Rules.name],
|
||||
password: [Rules.paramComplexity],
|
||||
password: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
|
||||
});
|
||||
|
||||
interface DialogProps {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue