add auth, format

This commit is contained in:
Phuoc Nguyen
2025-11-07 11:52:06 +07:00
parent 24a8508fce
commit 3803bd26e0
173 changed files with 8505 additions and 7116 deletions

View File

@@ -244,9 +244,7 @@ class Validators {
}
if (double.tryParse(value) == null) {
return fieldName != null
? '$fieldName phải là số'
: 'Giá trị phải là số';
return fieldName != null ? '$fieldName phải là số' : 'Giá trị phải là số';
}
return null;
@@ -351,7 +349,8 @@ class Validators {
);
final today = DateTime.now();
final age = today.year -
final age =
today.year -
birthDate.year -
(today.month > birthDate.month ||
(today.month == birthDate.month && today.day >= birthDate.day)
@@ -456,11 +455,7 @@ class Validators {
// ========================================================================
/// Validate against custom regex pattern
static String? pattern(
String? value,
RegExp pattern,
String errorMessage,
) {
static String? pattern(String? value, RegExp pattern, String errorMessage) {
if (value == null || value.trim().isEmpty) {
return 'Trường này là bắt buộc';
}
@@ -491,12 +486,7 @@ class Validators {
}
/// Password strength enum
enum PasswordStrength {
weak,
medium,
strong,
veryStrong,
}
enum PasswordStrength { weak, medium, strong, veryStrong }
/// Password strength calculator
class PasswordStrengthCalculator {