Make WordPress Core


Ignore:
Timestamp:
03/30/2016 02:44:00 PM (10 years ago)
Author:
ocean90
Message:

Multisite: Validate new email address confirmations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-edit.php

    r36695 r37103  
    8484if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
    8585    $new_email = get_user_meta( $current_user->ID, '_new_email', true );
    86     if ( $new_email && $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
     86    if ( $new_email && hash_equals( $new_email[ 'hash' ], $_GET[ 'newuseremail' ] ) ) {
    8787        $user = new stdClass;
    8888        $user->ID = $current_user->ID;
     
    9898        wp_redirect( add_query_arg( array( 'error' => 'new-email' ), self_admin_url( 'profile.php' ) ) );
    9999    }
    100 } elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
     100} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' === $_GET['dismiss'] ) {
     101    check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' );
    101102    delete_user_meta( $current_user->ID, '_new_email' );
    102103    wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
     
    401402            /* translators: %s: new email */
    402403            __( 'There is a pending change of your email to %s.' ),
    403             '<code>' . $new_email['newemail'] . '</code>'
     404            '<code>' . esc_html( $new_email['newemail'] ) . '</code>'
    404405        );
    405406        printf(
    406407            ' <a href="%1$s">%2$s</a>',
    407             esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ),
     408            esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
    408409            __( 'Cancel' )
    409410        );
Note: See TracChangeset for help on using the changeset viewer.