fix(auth): update email validation regex to improve accuracy and support more valid email formats

This commit is contained in:
caxxy 2025-03-02 21:05:06 +03:00
parent 46571852de
commit 3249acde56
3 changed files with 3 additions and 3 deletions

View file

@ -54,7 +54,7 @@ class _ForgotPasswordPageState extends State<ForgotPasswordPage> {
if (value?.isEmpty ?? true) {
return 'Please enter your email';
}
if (!RegExp(r'^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$').hasMatch(value!)) {
if (!RegExp(r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$').hasMatch(value!)) {
return 'Please enter a valid email';
}
return null;

View file

@ -278,7 +278,7 @@ class _SignInPageState extends State<SignInPage>
return 'Please enter your email';
}
if (!RegExp(
r'^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$')
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$')
.hasMatch(value!)) {
return 'Please enter a valid email';
}

View file

@ -320,7 +320,7 @@ class _SignUpPageState extends State<SignUpPage>
return 'Please enter your email';
}
if (!RegExp(
r'^[\w-.]+@([\w-]+\.)+[\w-]{2,4}$')
r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$')
.hasMatch(value!)) {
return 'Please enter a valid email';
}