mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-08-18 06:26:28 +00:00
validations: adds restrictions to allowed subdomain names
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
[
|
||||
"help",
|
||||
"support",
|
||||
"no-reply",
|
||||
"noreply",
|
||||
"notifications",
|
||||
"notification",
|
||||
"ww1",
|
||||
"ww2",
|
||||
"ww3",
|
||||
"ww4"
|
||||
]
|
||||
@@ -1,6 +1,7 @@
|
||||
const R = require('ramda');
|
||||
const { VALID_RECORD_TYPES } = require('./constants');
|
||||
const { or, and, validate, between, testRegex, withLengthEq, withLengthGte } = require('./helpers');
|
||||
const INVALID_NAMES = require('./invalid-domains.json');
|
||||
|
||||
const isValidURL = testRegex(/^https?:\/\//ig);
|
||||
|
||||
@@ -41,6 +42,7 @@ const validateDomainData = validate({
|
||||
and([
|
||||
R.compose(between(2, 100), R.length),
|
||||
testRegex(/^[a-z0-9-]+$/g),
|
||||
R.complement(R.includes(R.__, INVALID_NAMES)),
|
||||
])
|
||||
]),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user