This commit is contained in:
efrilm
2025-10-24 01:16:50 +07:00
parent 5d9197c986
commit ca5d2a58e7
45 changed files with 3820 additions and 50 deletions
+28
View File
@@ -0,0 +1,28 @@
class AppValidator {
static String? validateEmail(String? value) {
if (value == null || value.isEmpty) {
return 'Email wajib diisi';
}
final emailRegex = RegExp(r'^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$');
if (!emailRegex.hasMatch(value)) {
return 'Format email tidak valid';
}
return null;
}
static String? validatePassword(String? value) {
if (value == null || value.isEmpty) {
return 'Password wajib diisi';
}
if (value.length < 8) {
return 'Password minimal 8 karakter';
}
// if (!RegExp(r'[A-Z]').hasMatch(value)) {
// return 'Password harus mengandung huruf besar';
// }
// if (!RegExp(r'[0-9]').hasMatch(value)) {
// return 'Password harus mengandung angka';
// }
return null;
}
}