validatePassword function
Implementation
String? validatePassword(String? password) {
if (password == null || password.isEmpty) {
return "lbl_password_required";
} else if (password.length < 6) {
return "lbl_password_must_be_at_least_6_characters";
} else if (!password.contains(RegExp(r'[A-Z]+'))) {
return "lbl_password_must_contain_at_least_one_uppercase_letter";
} else if (!password.contains(RegExp(r'[a-z]+'))) {
return "lbl_password_must_contain_at_least_one_lowercase_letter";
} else if (!password.contains(RegExp(r'[0-9]+'))) {
return "lbl_password_must_contain_at_least_one_number";
} else if (!password.contains(RegExp(r'[!@#$%^&*()-+\/]+'))) {
return "lbl_password_must_contain_at_least_one_special_character";
}
return null;
}