Make WordPress Core

Ticket #40605: 40605.5.diff

File 40605.5.diff, 2.5 KB (added by bmartinent, 5 years ago)

This new patch do not interfere with the other checkemail cases. "wp-login.php?checkemail=newpass" and "wp-login.php?checkemail=registered"

  • src/wp-login.php

    diff --git a/src/wp-login.php b/src/wp-login.php
    index ce9cf2e857..b3714a5d24 100644
    a b if ( ! in_array( $action, $default_actions, true ) && false === has_filter( 'log 
    511511        $action = 'login';
    512512}
    513513
     514if ( isset( $_GET['checkemail'] ) && in_array( $_GET['checkemail'], array( 'confirm' ), true ) ) {
     515        $action = 'checkemailconfirm';
     516}
     517
    514518nocache_headers();
    515519
    516520header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) );
    switch ( $action ) { 
    11681172                login_footer();
    11691173                exit;
    11701174
     1175        case 'checkemailconfirm':
     1176                $secure_cookie = '';
     1177                $redirect_to   = admin_url();
     1178                $errors        = new WP_Error();
     1179
     1180                $errors->add(
     1181                        'confirm',
     1182                        sprintf(
     1183                                /* Translators: 1 is a link to the login url. */
     1184                                __( 'Check your email for the confirmation link. Then go to <a href="%1$s">Login Page</a>' ),
     1185                                wp_login_url()
     1186                        ),
     1187                        'message'
     1188                );
     1189
     1190                /**
     1191                 * Filters the login page errors.
     1192                 *
     1193                 * @since 3.6.0
     1194                 *
     1195                 * @param object $errors      WP Error object.
     1196                 * @param string $redirect_to Redirect destination URL.
     1197                 */
     1198                $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
     1199                login_header( __( 'Log In' ), '', $errors );
     1200                login_footer();
     1201                break;
     1202
    11711203        case 'login':
    11721204        default:
    11731205                $secure_cookie   = '';
    switch ( $action ) { 
    13281360                                $errors->add( 'loggedout', __( 'You are now logged out.' ), 'message' );
    13291361                        } elseif ( isset( $_GET['registration'] ) && 'disabled' === $_GET['registration'] ) {
    13301362                                $errors->add( 'registerdisabled', __( 'User registration is currently not allowed.' ) );
    1331                         } elseif ( isset( $_GET['checkemail'] ) && 'confirm' === $_GET['checkemail'] ) {
    1332                                 $errors->add( 'confirm', __( 'Check your email for the confirmation link.' ), 'message' );
    13331363                        } elseif ( isset( $_GET['checkemail'] ) && 'newpass' === $_GET['checkemail'] ) {
    13341364                                $errors->add( 'newpass', __( 'Check your email for your new password.' ), 'message' );
    13351365                        } elseif ( isset( $_GET['checkemail'] ) && 'registered' === $_GET['checkemail'] ) {
    switch ( $action ) { 
    14311461                        <p id="nav">
    14321462                                <?php
    14331463
    1434                                 if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ), true ) ) {
     1464                                if ( ! isset( $_GET['checkemail'] ) || 'newpass' !== $_GET['checkemail'] ) {
    14351465                                        if ( get_option( 'users_can_register' ) ) {
    14361466                                                $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
    14371467