diff --git a/docs/src/pages/premium-themes/onepirate/modules/form/validation.js b/docs/src/pages/premium-themes/onepirate/modules/form/validation.js index 1d3ab7615b166a..4ce5465f1a30b7 100644 --- a/docs/src/pages/premium-themes/onepirate/modules/form/validation.js +++ b/docs/src/pages/premium-themes/onepirate/modules/form/validation.js @@ -1,6 +1,12 @@ -// Simplified method of validator/lib/isEmail +/** + * This is a simplified logic. + * Consider using `import isEmail from 'validator/lib/isEmail'` from + * https://github.com/validatorjs/validator.js/blob/7376945b4ce028b65955ae57b8fccbbf3fe58467/src/lib/isEmail.js + * for a more robust version. + */ function isEmail(string) { - const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFaa-zA-Z\-0-9]+\.)+[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEFaa-zA-Z]{2,}))$/; + const re = + /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i; return re.test(string); } diff --git a/docs/src/pages/premium-themes/onepirate/modules/form/validation.ts b/docs/src/pages/premium-themes/onepirate/modules/form/validation.ts index 0b2afa791ad905..bc7d3d7f555b0f 100644 --- a/docs/src/pages/premium-themes/onepirate/modules/form/validation.ts +++ b/docs/src/pages/premium-themes/onepirate/modules/form/validation.ts @@ -1,7 +1,12 @@ -// Simplified method of validator/lib/isEmail +/** + * This is a simplified logic. + * Consider using `import isEmail from 'validator/lib/isEmail'` from + * https://github.com/validatorjs/validator.js/blob/7376945b4ce028b65955ae57b8fccbbf3fe58467/src/lib/isEmail.js + * for a more robust version. + */ function isEmail(string: string) { const re = - /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; + /^(([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,})$/i; return re.test(string); }