Make WordPress Core


Ignore:
Timestamp:
10/22/2020 02:41:33 AM (4 years ago)
Author:
TimothyBlynJacobs
Message:

App Passwords: Fix success=false not being appended to fallback reject url.

Props TimothyBlynJacobs, georgestephanis.
Fixes #51581.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/authorize-application.php

    r49270 r49272  
    2323    if ( isset( $_POST['reject'] ) ) {
    2424        if ( $reject_url ) {
    25             $redirect = add_query_arg( 'success', 'false', $reject_url );
     25            $redirect = $reject_url;
    2626        } else {
    2727            $redirect = admin_url();
     
    5858$app_name    = ! empty( $_REQUEST['app_name'] ) ? $_REQUEST['app_name'] : '';
    5959$success_url = ! empty( $_REQUEST['success_url'] ) ? $_REQUEST['success_url'] : null;
    60 $reject_url  = ! empty( $_REQUEST['reject_url'] ) ? $_REQUEST['reject_url'] : $success_url;
    61 $user        = wp_get_current_user();
     60
     61if ( ! empty( $_REQUEST['reject_url'] ) ) {
     62    $reject_url = $_REQUEST['reject_url'];
     63} elseif ( $success_url ) {
     64    $reject_url = add_query_arg( 'success', 'false', $success_url );
     65} else {
     66    $reject_url = null;
     67}
     68
     69$user = wp_get_current_user();
    6270
    6371$request  = compact( 'app_name', 'success_url', 'reject_url' );
     
    231239                            /* translators: %s: The URL the user is being redirected to. */
    232240                            __( 'You will be sent to %s' ),
    233                             '<strong><kbd>' . esc_html(
    234                                 add_query_arg(
    235                                     array(
    236                                         'success' => 'false',
    237                                     ),
    238                                     $reject_url
    239                                 )
    240                             ) . '</kbd></strong>'
     241                            '<strong><kbd>' . esc_html( $reject_url ) . '</kbd></strong>'
    241242                        );
    242243                    } else {
Note: See TracChangeset for help on using the changeset viewer.