wp_is_site_protected_by_basic_auth example


                'https_status'         => array(
                    'label'             => __( 'HTTPS status' ),
                    'test'              => rest_url( 'wp-site-health/v1/tests/https-status' ),
                    'has_rest'          => true,
                    'async_direct_test' => array( WP_Site_Health::get_instance(), 'get_test_https_status' ),
                ),
            ),
        );

        // Conditionally include Authorization header test if the site isn't protected by Basic Auth.         if ( ! wp_is_site_protected_by_basic_auth() ) {
            $tests['async']['authorization_header'] = array(
                'label'     => __( 'Authorization header' ),
                'test'      => rest_url( 'wp-site-health/v1/tests/authorization-header' ),
                'has_rest'  => true,
                'headers'   => array( 'Authorization' => 'Basic ' . base64_encode( 'user:pwd' ) ),
                'skip_cron' => true,
            );
        }

        // Only check for caches in production environments.         if ( 'production' === wp_get_environment_type() ) {
            
$request  = compact( 'app_name', 'app_id', 'success_url', 'reject_url' );
$is_valid = wp_is_authorize_application_password_request_valid( $request$user );

if ( is_wp_error( $is_valid ) ) {
    wp_die(
        __( 'The Authorize Application request is not allowed.' ) . ' ' . implode( ' ', $is_valid->get_error_messages() ),
        __( 'Cannot Authorize Application' )
    );
}

if ( wp_is_site_protected_by_basic_auth( 'front' ) ) {
    wp_die(
        __( 'Your website appears to use Basic Authentication, which is not currently compatible with application passwords.' ),
        __( 'Cannot Authorize Application' ),
        array(
            'response'  => 501,
            'link_text' => __( 'Go Back' ),
            'link_url'  => $reject_url ? add_query_arg( 'error', 'disabled', $reject_url ) : admin_url(),
        )
    );
}

$message,
                                                admin_url( 'my-sites.php' ),
                                                number_format_i18n( $blogs_count )
                                            );
                                            ?> </p> <?php                                     endif;
                                endif;
                                ?> <?php if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) : ?> <div class="create-application-password form-wrap"> <div class="form-field"> <label for="new_application_password_name"><?php _e( 'New Application Password Name' ); ?></label> <input type="text" size="30" id="new_application_password_name" name="new_application_password_name" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" spellcheck="false" /> <p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p> </div> <?php                                         /** * Fires in the create Application Passwords form. * * @since 5.6.0 * * @param WP_User $profile_user The current WP_User object. */
Home | Imprint | This part of the site doesn't use cookies.