Skip to content
Snippets Groups Projects
Verified Commit 606ccef1 authored by Defendi Alberto's avatar Defendi Alberto
Browse files

Clean email validation

Validation is still not working properly and will be improved in next versions
parent cd80f4f6
No related branches found
No related tags found
2 merge requests!15Clean email validation,!13Basic form api and implement cookie entrypoint
Pipeline #11606 failed
...@@ -33,13 +33,11 @@ export const SignInForm: FC = () => { ...@@ -33,13 +33,11 @@ export const SignInForm: FC = () => {
}; };
const { control, register, errors, handleSubmit } = useForm<FormData>({ const { control, register, errors, handleSubmit } = useForm<FormData>({
mode: 'onChange',
reValidateMode: 'onChange',
defaultValues, defaultValues,
}); });
const onSubmit: any = (values: FormData) => { const onSubmit: any = (values: FormData) => {
// Send data alert(JSON.stringify(values));
}; };
const classes = useStyles(); const classes = useStyles();
return ( return (
...@@ -54,8 +52,9 @@ export const SignInForm: FC = () => { ...@@ -54,8 +52,9 @@ export const SignInForm: FC = () => {
control={control} control={control}
defaultValues defaultValues
rules={{ rules={{
required: true, validate: (value) =>
pattern: /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i, /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i.test(value),
required: { value: true, message: 'You must enter your email' },
}} }}
render={() => ( render={() => (
<TextField <TextField
...@@ -79,9 +78,9 @@ export const SignInForm: FC = () => { ...@@ -79,9 +78,9 @@ export const SignInForm: FC = () => {
control={control} control={control}
defaultValues defaultValues
rules={{ rules={{
required: true, minLength: 8,
min: 8, maxLength: 60,
max: 60, required: { value: true, message: 'You must enter your name' },
}} }}
render={() => ( render={() => (
<TextField <TextField
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment