Domain validation. Filter domain from referrers.

This commit is contained in:
Mike Cao 2020-08-28 21:34:20 -07:00
parent a9765c7ea7
commit 5a4cde854a
13 changed files with 51 additions and 23 deletions

View file

@ -8,7 +8,8 @@ import FormLayout, {
FormMessage,
FormRow,
} from 'components/layout/FormLayout';
import Checkbox from '../common/Checkbox';
import Checkbox from 'components/common/Checkbox';
import { DOMAIN_REGEX } from 'lib/constants';
const initialValues = {
name: '',
@ -24,6 +25,8 @@ const validate = ({ name, domain }) => {
}
if (!domain) {
errors.domain = 'Required';
} else if (!DOMAIN_REGEX.test(domain)) {
errors.domain = 'Invalid domain';
}
return errors;