mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Application Passwords: Allow plain HTTP success and reject URLs when using a local environment type.
It's not uncommon for local environments to run over HTTP due to the relative complexity of configuring HTTPS for a local environment. This change allows HTTP URLs for application password responses when that is the case. Props peterwilsoncc, wppunk, cadic, viralsampat Fixes #52617 git-svn-id: https://develop.svn.wordpress.org/trunk@55283 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -612,6 +612,7 @@ Please click the following link to activate your user account:
|
||||
* Checks if the Authorize Application Password request is valid.
|
||||
*
|
||||
* @since 5.6.0
|
||||
* @since 6.2.0 Allow insecure HTTP connections for the local environment.
|
||||
*
|
||||
* @param array $request {
|
||||
* The array of request data. All arguments are optional and may be empty.
|
||||
@@ -625,12 +626,13 @@ Please click the following link to activate your user account:
|
||||
* @return true|WP_Error True if the request is valid, a WP_Error object contains errors if not.
|
||||
*/
|
||||
function wp_is_authorize_application_password_request_valid( $request, $user ) {
|
||||
$error = new WP_Error();
|
||||
$error = new WP_Error();
|
||||
$is_local = 'local' === wp_get_environment_type();
|
||||
|
||||
if ( ! empty( $request['success_url'] ) ) {
|
||||
$scheme = wp_parse_url( $request['success_url'], PHP_URL_SCHEME );
|
||||
|
||||
if ( 'http' === $scheme ) {
|
||||
if ( 'http' === $scheme && ! $is_local ) {
|
||||
$error->add(
|
||||
'invalid_redirect_scheme',
|
||||
__( 'The success URL must be served over a secure connection.' )
|
||||
@@ -641,7 +643,7 @@ function wp_is_authorize_application_password_request_valid( $request, $user ) {
|
||||
if ( ! empty( $request['reject_url'] ) ) {
|
||||
$scheme = wp_parse_url( $request['reject_url'], PHP_URL_SCHEME );
|
||||
|
||||
if ( 'http' === $scheme ) {
|
||||
if ( 'http' === $scheme && ! $is_local ) {
|
||||
$error->add(
|
||||
'invalid_redirect_scheme',
|
||||
__( 'The rejection URL must be served over a secure connection.' )
|
||||
|
||||
Reference in New Issue
Block a user