Improve overall domain input validation
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { ref, computed, useTemplateRef, onMounted, inject } from 'vue';
|
||||
import { marked } from 'marked';
|
||||
import { Button, Dialog, SingleSelect, FormGroup, TextInput, InputGroup } from 'pankow';
|
||||
import { prettyDate, prettyBinarySize } from 'pankow/utils';
|
||||
import { prettyDate, prettyBinarySize, isValidDomain } from 'pankow/utils';
|
||||
import AccessControl from './AccessControl.vue';
|
||||
import PortBindings from './PortBindings.vue';
|
||||
import DomainsModel from '../models/DomainsModel.js';
|
||||
@@ -36,12 +36,7 @@ const domains = ref([]);
|
||||
const formValid = computed(() => {
|
||||
if (!domain.value) return false;
|
||||
|
||||
if (location.value) {
|
||||
// label validation
|
||||
if (location.value.split('.').some(function (p) { return p.length > 63 || p.length < 1; })) return false;
|
||||
if (location.value.match(/^[A-Za-z0-9-.]+$/) === null) return false;
|
||||
if (/^[-.]/.test(location.value)) return false;
|
||||
}
|
||||
if (location.value && !isValidDomain(location.value + '.' + domain.value)) return false;
|
||||
|
||||
if (accessRestrictionOption.value === ACL_OPTIONS.RESTRICTED && (accessRestrictionAcl.value.users.length === 0 && accessRestrictionAcl.value.groups.length === 0)) return false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user