passwordConfirmationValidator function

String? passwordConfirmationValidator(
  1. String? value,
  2. String? value2
)

Validates the confirmation of a password.

Returns an error message if the value is empty or doesn't match value2. Otherwise, returns null.

Implementation

String? passwordConfirmationValidator(String? value, String? value2) {
  if (value == null || value.isEmpty) {
    return getCurrentLocalization() == 'id'
        ? 'Kolom tidak boleh kosong'
        : "Field can't be empty";
  } else if (value != value2) {
    return getCurrentLocalization() == 'id'
        ? 'Kata sandi tidak sesuai'
        : 'Password does not match';
  }
  return null;
}