Overview
The input validation module provides Kotlin extension functions for validating user input, specifically email addresses and passwords. These validators are used throughout the authentication flow. File Location:com.demodogo.ev_sum_2.domain.validators.Validators
Email Validation
isBasicEmailValid()
Extension function that validates email format with basic checks.The email string to validate
Boolean - true if the email meets basic validation criteria
Validation Rules
The email is considered valid if it:- Contains the ”@” symbol
- Contains at least one ”.” character
- Has a non-blank domain after the ”@” symbol
emailDomain Property
Helper property that extracts the domain portion of an email:Usage Examples
Integration with UI
Used in authentication screens for email validation:Password Validation
isValidPassword()
Extension function that validates password strength requirements.The password string to validate
Boolean - true if the password meets all strength requirements
Validation Rules
The password is considered valid if it:- Is at least 6 characters long
- Contains at least one letter (a-z, A-Z)
- Contains at least one digit (0-9)
- Does not contain any spaces
Usage Examples
Integration with UI
Used in registration screen for password validation:Validation Messages
Common error messages used with these validators:Email validation messages
Email validation messages
- Blank email: “Completa tu email”
- Invalid format: “Email inválido (ej: [email protected])”
Password validation messages
Password validation messages
- Blank password: “Completa tu contraseña”
- Invalid format: “La contraseña debe tener al menos 6 caracteres, 1 letra y 1 número”
Testing
These validators are designed to be easily testable since they’re pure functions:Comparison with Speech Normalization
While speech normalization converts spoken words to typed format, input validation ensures the final result meets security and format requirements:- Speech Normalization
- Input Validation
Converts spoken input to typed format:
Related Components
- Speech Normalization - Converts speech to email/password format
- LoginScreen - Uses email validation
- RegisterScreen - Uses both email and password validation
- RecoverScreen - Uses email validation
Source Code
View the complete implementation in the repository:app/src/main/java/com/demodogo/ev_sum_2/domain/validators/Validators.kt