validatePasswordForEnrollment abstract method
Performs validation of the password for enrollment during a registration.
If validation fails, the implementation must invoke the provided onError
with the error. The error will be the one returned by the PasswordEnrollmentContext.lastRecoverableError
property.
The implementation must guarantee that, one (and only one) of onSuccess
and onError
is invoked, and that the one invoked is invoked only once.
This method will be invoked in the main/UI thread.
Synchronous implementation example that requires password to have at least 8 different characters:
@override
void validatePasswordForEnrollment({
required String password,
required Function onSuccess,
required Function(PasswordEnrollmentCustomValidationError) onError
}) {
if (!isAtLeast8CharacterLong(password)) {
final error = PasswordEnrollmentCustomValidationError.create(
"The password has less than 8 characters.",
);
onError(error)
} else {
onSuccess();
}
}
Params:
Implementation
void validatePasswordForEnrollment({
required String password,
required Function onSuccess,
required Function(PasswordEnrollmentCustomValidationError) onError,
});