Make WordPress Core

Changeset 51980


Ignore:
Timestamp:
11/02/2021 05:55:07 PM (3 years ago)
Author:
johnjamesjacoby
Message:

Application Passwords: display guiding text & link in user-edit.php when unavailable.

This change intends to avoid confusion around the requirements of the Application Passwords feature, specific to it requiring HTTPS and the WP_ENVIRONMENT_TYPE constant.

It does this by conditionally hiding the traditional UI and showing some insightful explanations instead, including a translatable link to the WP_ENVIRONMENT_TYPE documentation on the "Editing wp-config.php" support page.

Props ashfame, audrasjb, iluy, johnbillion.

Fixes #53658.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-edit.php

    r51878 r51980  
    734734    </table>
    735735
    736 
    737         <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
    738736    <div class="application-passwords hide-if-no-js" id="application-passwords-section">
    739737        <h2><?php _e( 'Application Passwords' ); ?></h2>
    740738        <p><?php _e( 'Application passwords allow authentication via non-interactive systems, such as XML-RPC or the REST API, without providing your actual password. Application passwords can be easily revoked. They cannot be used for traditional logins to your website.' ); ?></p>
     739        <?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
    741740            <?php
    742741            if ( is_multisite() ) {
     
    798797            ?>
    799798        </div>
     799        <?php else: ?>
     800            <p><?php esc_html_e( 'The application password feature requires HTTPS, which is not enabled on this site.' ); ?></p>
     801            <p><?php
     802            printf(
     803                __( 'If this is a development website you can <a href="%s" target="_blank">set the environment type accordingly</a> to enable application passwords.' ),
     804                __( 'https://wordpress.org/support/article/editing-wp-config-php/#wp_environment_type' )
     805            );
     806            ?></p>
     807        <?php endif; ?>
    800808    </div>
    801 <?php endif; ?>
    802809
    803810        <?php
Note: See TracChangeset for help on using the changeset viewer.