Created
December 4, 2020 00:41
-
-
Save edwvilla/1c66e50f3a456c623a959c15e6ff8968 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthValidator { | |
String validatePassword(String value) { | |
if (value.length < 6) | |
return 'Contraseña debe ser mayor a 6 caracteres'; | |
else | |
return null; | |
} | |
String validateEmail(String value) { | |
const String pattern = | |
r'^(([^<>()[\]\\.,;:\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,}))$'; | |
final RegExp regex = RegExp(pattern); | |
if (!regex.hasMatch(value)) | |
return 'Ingresa un email valido'; | |
else | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment