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.
Built from https://develop.svn.wordpress.org/trunk@51980


git-svn-id: http://core.svn.wordpress.org/trunk@51569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
johnjamesjacoby 2021-11-02 17:57:03 +00:00
parent 6d451fb64b
commit fae48afc92
2 changed files with 11 additions and 4 deletions

View File

@ -733,11 +733,10 @@ endif;
</table>
<?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
<div class="application-passwords hide-if-no-js" id="application-passwords-section">
<h2><?php _e( 'Application Passwords' ); ?></h2>
<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>
<?php if ( wp_is_application_passwords_available_for_user( $user_id ) ) : ?>
<?php
if ( is_multisite() ) {
$blogs = get_blogs_of_user( $user_id, true );
@ -797,8 +796,16 @@ endif;
$application_passwords_list_table->display();
?>
</div>
<?php else: ?>
<p><?php esc_html_e( 'The application password feature requires HTTPS, which is not enabled on this site.' ); ?></p>
<p><?php
printf(
__( 'If this is a development website you can <a href="%s" target="_blank">set the environment type accordingly</a> to enable application passwords.' ),
__( 'https://wordpress.org/support/article/editing-wp-config-php/#wp_environment_type' )
);
?></p>
<?php endif; ?>
</div>
<?php endif; ?>
<?php
if ( IS_PROFILE_PAGE ) {

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.9-alpha-51979';
$wp_version = '5.9-alpha-51980';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.