Commit 42ba937b authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

fixed incorrect email validation for - and several dot separated domains

Made all errors of inputs use red color
parent 911b30ba
......@@ -23,7 +23,7 @@ const styles = (theme) => {
return ({
helper: {
paddingTop: '0.5rem',
color: theme.palette.error.A400,
color: '#FF0000',
},
});
};
......
......@@ -14,7 +14,7 @@ export default class Validators {
public static maxLength100 = Validators.maxLength(100);
public static emailAddress = (value) => !value || value.match(/^(?:[A-Za-z0-9!#$%&'*+\/=?^_\`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_\`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@[a-z]+\.([a-z]{2,4})$/) ? undefined : 'public.validate.invalidEmail';// tslint:disable-line
public static emailAddress = (value) => !value || value.match(/^(?:[A-Za-z0-9!#$%&'*+\/=?^_\`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+\/=?^_\`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@([a-z0-9\-_]+\.)+([a-z]{2,4})$/) ? undefined : 'public.validate.invalidEmail';// tslint:disable-line
public static phoneNumber = (value) => !value || value.match(/^\+[\d\-\. ]+( ext\. \d+)?$/gi) ? undefined : 'public.validate.invalidNumber';
public static uuid = (value) => !value || value.match(/^[a-f0-9]{8}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{4}\-[a-f0-9]{12}$/gi) ? undefined : 'public.validate.invalidUUID';
public static url = (value) => !value || value.match(/^(\w+:)\/\//g) ? undefined : 'public.validate.invalidUrl';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment