I am trying to add complexity checks for the password

add_filter(
    'hivepress/v1/models/user',
    function( $model ) {
        $model['fields']['password']['min_length'] = 10; // Set a minimum length of 8 characters

        return $model;
    },
    1000
);

add_filter(
    'hivepress/v1/models/user',
    function( $model ) {
        // Add a custom validation callback for the password field
        $model['fields']['password']['_validate'] = 'validate_password_complexity';

        return $model;
    },
    1000
);

function validate_password_complexity( $value ) {
    $errors = [];

    if (strlen($value) < 8) {
        $errors[] = "Password must be at least 8 characters long.";
    }

    if (!preg_match("#[0-9]+#", $value)) {
        $errors[] = "Password must include at least one number.";
    }

    if (!preg_match("#[a-z]+#", $value)) {
        $errors[] = "Password must include at least one lowercase letter.";
    }

    if (!preg_match("#[A-Z]+#", $value)) {
        $errors[] = "Password must include at least one uppercase letter.";
    }

    if (!preg_match("#\W+#", $value)) {
        $errors[] = "Password must include at least one special character.";
    }

    if ($errors) {
        // Concatenate all errors into a single string separated by '\n'
        $error_message = implode('\n', $errors);

        // Throw an exception with the concatenated errors
        // This will prevent the form from being submitted and display the error message
        throw new \HivePress\Models\Model_Exception($error_message);
    }
}

I need to create a hook called _validate but idk how. Can anyone help with this please

It’s already been a week since I asked this question, please someone from the team reply to me