validatePasswords method
Implementation
List<String?> validatePasswords(
String password,
String confirmPassword, {
bool withOldPassword = false,
String? oldPassword,
}) {
if (withOldPassword) {
if (oldPassword != null && oldPassword.isEmpty) {
return ['Please enter Password', null, null];
}
if (oldPassword!.length < 8) {
return ['Password length should be atleast 8 characters', null, null];
}
if (password.isEmpty) {
return [null, 'Please enter Password', null];
}
if (confirmPassword.isEmpty) {
return [null, null, 'Please confirm password'];
}
if (password.length < 8) {
return [null, 'Password length should be atleast 8 characters', null];
}
if (password != confirmPassword) {
return [null, 'Passwords do not match', 'Passwords do not match'];
}
return [null, null, null];
}
if (password.isEmpty) {
return ['Please enter Password', null];
}
if (confirmPassword.isEmpty) {
return [null, 'Please confirm password'];
}
if (password.length < 8) {
return ['Password length should be atleast 8 characters', null];
}
if (password != confirmPassword) {
return ['Passwords do not match', 'Passwords do not match'];
}
return [null, null];
}