@@ -33,10 +34,11 @@
+
{{ $t('database.localhostHelper') }}
@@ -69,7 +71,6 @@ import { deleteCheckMysqlDB, updateMysqlAccess, updateMysqlPassword } from '@/ap
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 changeVisible = ref(false);
@@ -92,20 +93,10 @@ const changeForm = reactive({
const confirmDialogRef = ref();
const rules = reactive({
- password: [Rules.paramComplexity],
- privilegeIPs: [{ validator: checkIPs, trigger: 'blur', required: true }],
+ password: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
+ privilegeIPs: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
});
-function checkIPs(rule: any, value: any, callback: any) {
- let ips = changeForm.privilegeIPs.split(',');
- for (const item of ips) {
- if (checkIp(item)) {
- return callback(new Error(i18n.global.t('commons.rule.ip')));
- }
- }
- callback();
-}
-
interface DialogProps {
id: number;
from: string;
diff --git a/frontend/src/views/database/postgresql/conn/index.vue b/frontend/src/views/database/postgresql/conn/index.vue
index 64515cfe4..01ad5839f 100644
--- a/frontend/src/views/database/postgresql/conn/index.vue
+++ b/frontend/src/views/database/postgresql/conn/index.vue
@@ -9,7 +9,7 @@
-
+
@@ -68,7 +68,13 @@
-
+
@@ -76,11 +82,7 @@
-
+
+ {{ $t('commons.rule.illegalChar') }}
@@ -110,8 +113,6 @@
-
-
+ {{ $t('commons.rule.illegalChar') }}
{{ $t('database.pgSuperUser') }}
@@ -81,7 +82,7 @@ const form = reactive({
const rules = reactive({
name: [Rules.requiredInput, Rules.dbName],
username: [Rules.requiredInput, Rules.name],
- password: [Rules.paramComplexity],
+ password: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
});
type FormInstance = InstanceType;
diff --git a/frontend/src/views/database/postgresql/password/index.vue b/frontend/src/views/database/postgresql/password/index.vue
index 0af30a303..4e15277e2 100644
--- a/frontend/src/views/database/postgresql/password/index.vue
+++ b/frontend/src/views/database/postgresql/password/index.vue
@@ -24,6 +24,7 @@
show-password
v-model="changeForm.password"
>
+ {{ $t('commons.rule.illegalChar') }}
@@ -71,7 +72,7 @@ const changeForm = reactive({
});
const confirmDialogRef = ref();
const rules = reactive({
- password: [Rules.paramComplexity],
+ password: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
});
interface DialogProps {
diff --git a/frontend/src/views/database/redis/conn/index.vue b/frontend/src/views/database/redis/conn/index.vue
index a453ad1b7..30b711d51 100644
--- a/frontend/src/views/database/redis/conn/index.vue
+++ b/frontend/src/views/database/redis/conn/index.vue
@@ -80,6 +80,7 @@
{{ $t('commons.button.random') }}
+ {{ $t('commons.rule.illegalChar') }}
@@ -118,6 +119,7 @@ import { MsgSuccess } from '@/utils/message';
import DrawerHeader from '@/components/drawer-header/index.vue';
import { getRandomStr } from '@/utils/util';
import { getSettingInfo } from '@/api/modules/setting';
+import { Rules } from '@/global/form-rules';
const loading = ref(false);
@@ -135,21 +137,9 @@ const form = reactive({
remoteIP: '',
});
const rules = reactive({
- password: [{ validator: checkPassword, trigger: 'blur' }],
+ password: [Rules.requiredInput, Rules.noSpace, Rules.illegal],
});
-function checkPassword(rule: any, value: any, callback: any) {
- if (form.password !== '') {
- const reg = /^[a-zA-Z0-9]{1}[a-zA-Z0-9.%@!~_-]{4,126}[a-zA-Z0-9]{1}$/;
- if (!reg.test(value) && value !== '') {
- callback(new Error(i18n.global.t('commons.rule.paramComplexity', ['.%@!~_-'])));
- } else {
- callback();
- }
- }
- callback();
-}
-
const confirmDialogRef = ref();
const emit = defineEmits(['checkExist', 'closeTerminal']);