Abstract
Static
createDefault constructor for PasswordPolicy.
an PasswordPolicy instance.
Abstract
validatePerforms 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.
Synchronous implementation example that requires password to have at least 8 different characters:
validatePasswordForEnrollment(
_password: string,
onSuccess: () => void,
_onError: (error: PasswordEnrollmentCustomValidationError) => void
): void {
if(isAtLeast8CharacterLong(password)) {
const error = new PasswordEnrollmentCustomValidationError(
"The password has less than 8 characters."
);
onError(error);
} else {
onSuccess();
}
}
the password to be validated.
the callback to invoke if the validation is successful.
the callback to invoke with error if the validation fails.
Abstract
validatePerforms validation of the password during a PasswordChange operation.
If validation fails, the implementation must invoke the provided onError
with the error. The error will be the one returned by the
PasswordChangeContext.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.
Synchronous implementation example that requires the password to be the same as a confirmation password provided in another field:
validatePasswordForPasswordChange(
_password: string,
onSuccess: () => void,
_onError: (error: PasswordChangeRecoverableCustomValidationError) => void
): void {
if(isAtLeast8CharacterLong(password)) {
const error = new PasswordChangeRecoverableCustomValidationError(
"The password has less than 8 characters."
);
onError(error);
} else {
onSuccess();
}
}
the password to be validated.
the callback to invoke if the validation is successful.
the callback to invoke with error if the validation fails.
Generated using TypeDoc
The object defining whether the password provided by a user during enrollment or when changing is valid.