mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-12 21:00:21 +00:00
App Passwords: Prevent conflicts when Basic Auth is already used by the site.
Application Passwords uses Basic Authentication to transfer authentication details. If the site is already using Basic Auth, for instance to implement a private staging environment, then the REST API will treat this as an authentication attempt and would end up generating an error for any REST API request. Now, Application Password authentication will only be attempted if Application Passwords is in use by a site. This is flagged by setting an option whenever an Application Password is created. An upgrade routine is added to set this option if any App Passwords already exist. Lastly, creating an Application Password will be prevented if the site appears to already be using Basic Authentication. Props chexwarrior, georgestephanis, adamsilverstein, helen, Clorith, marybaum, TimothyBlynJacobs. Fixes #51939. git-svn-id: https://develop.svn.wordpress.org/trunk@49752 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
+27
-20
@@ -738,27 +738,34 @@ endif;
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
<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" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" />
|
||||
<p class="description" id="new_application_password_name_desc"><?php _e( 'Required to create an Application Password, but not to update the user.' ); ?></p>
|
||||
|
||||
if ( empty( $_SERVER['PHP_AUTH_USER'] ) && empty( $_SERVER['PHP_AUTH_PW'] ) ) {
|
||||
?>
|
||||
<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" placeholder="<?php esc_attr_e( 'WordPress App on My Phone' ); ?>" class="input" aria-required="true" aria-describedby="new_application_password_name_desc" />
|
||||
<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 $profileuser The current WP_User object.
|
||||
*/
|
||||
do_action( 'wp_create_application_password_form', $profileuser );
|
||||
?>
|
||||
|
||||
<?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
/**
|
||||
* Fires in the create Application Passwords form.
|
||||
*
|
||||
* @since 5.6.0
|
||||
*
|
||||
* @param WP_User $profileuser The current WP_User object.
|
||||
*/
|
||||
do_action( 'wp_create_application_password_form', $profileuser );
|
||||
?>
|
||||
|
||||
<?php submit_button( __( 'Add New Application Password' ), 'secondary', 'do_new_application_password' ); ?>
|
||||
</div>
|
||||
<?php } else { ?>
|
||||
<div class="notice notice-error inline">
|
||||
<p><?php _e( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ); ?></p>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="application-passwords-list-table-wrapper">
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user