WordPress.org

Make WordPress Core

Ticket #39110: 39110.patch

File 39110.patch, 1.3 KB (added by neelpatel7295, 10 months ago)

Patch related to display error message instead of die

  • wp-login.php

     
    4242                $wp_error = new WP_Error();
    4343
    4444        // Shake it!
    45         $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
     45        $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'email_disabled' );
    4646        /**
    4747         * Filters the error codes array for shaking the login form.
    4848         *
     
    386386         */
    387387        $message = apply_filters( 'retrieve_password_message', $message, $key, $user_login, $user_data );
    388388
    389         if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )
    390                 wp_die( __('The email could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') );
    391 
     389        if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) {
     390                $errors->add('email_disabled', __('<strong>ERROR</strong>: The email could not be sent. Please check your hosting server have enabled the mail() function.') );
     391                return $errors;
     392        }
     393       
    392394        return true;
    393395}
    394396