Changeset 50044
- Timestamp:
- 01/28/2021 12:27:13 AM (4 years ago)
- Location:
- branches/5.6
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/5.6
-
branches/5.6/src/wp-admin/authorize-application.php
r50004 r50044 89 89 } 90 90 91 if ( ! empty( $_SERVER['PHP_AUTH_USER'] ) || ! empty( $_SERVER['PHP_AUTH_PW']) ) {91 if ( wp_is_site_protected_by_basic_auth( 'front' ) ) { 92 92 wp_die( 93 93 __( 'Your website appears to use Basic Authentication, which is not currently compatible with Application Passwords.' ), -
branches/5.6/src/wp-admin/user-edit.php
r49754 r50044 740 740 } 741 741 742 if ( empty( $_SERVER['PHP_AUTH_USER'] ) && empty( $_SERVER['PHP_AUTH_PW']) ) {742 if ( ! wp_is_site_protected_by_basic_auth( 'front' ) ) { 743 743 ?> 744 744 <div class="create-application-password form-wrap"> -
branches/5.6/src/wp-includes/load.php
r49635 r50044 1686 1686 return false; 1687 1687 } 1688 1689 /** 1690 * Checks if this site is protected by HTTP Basic Auth. 1691 * 1692 * At the moment, this merely checks for the present of Basic Auth credentials. Therefore, calling this function 1693 * with a context different from the current context may give inaccurate results. In a future release, this 1694 * evaluation may be made more robust. 1695 * 1696 * Currently, this is only used by Application Passwords to prevent a conflict since it also utilizes Basic Auth. 1697 * 1698 * @since 5.6.1 1699 * 1700 * @global string $pagenow The current page. 1701 * 1702 * @param string $context The context to check for protection. Accepts 'login', 'admin', and 'front'. Defaults to the current context. 1703 * 1704 * @return bool 1705 */ 1706 function wp_is_site_protected_by_basic_auth( $context = '' ) { 1707 global $pagenow; 1708 1709 if ( ! $context ) { 1710 if ( 'wp-login.php' === $pagenow ) { 1711 $context = 'login'; 1712 } elseif ( is_admin() ) { 1713 $context = 'admin'; 1714 } else { 1715 $context = 'front'; 1716 } 1717 } 1718 1719 $is_protected = ! empty( $_SERVER['PHP_AUTH_USER'] ) || ! empty( $_SERVER['PHP_AUTH_PW'] ); 1720 1721 /** 1722 * Filters whether a site is protected by HTTP Basic Auth. 1723 * 1724 * @since 5.6.1 1725 * 1726 * @param bool $is_protected Whether the site is protected by Basic Auth. 1727 * @param string $context The context to check for protection. One of 'login', 'admin', or 'front'. 1728 */ 1729 return apply_filters( 'wp_is_site_protected_by_basic_auth', $is_protected, $context ); 1730 }
Note: See TracChangeset
for help on using the changeset viewer.