Make WordPress Core

Changeset 45404


Ignore:
Timestamp:
05/24/2019 10:13:11 PM (7 years ago)
Author:
johnbillion
Message:

Mail: Improve the user experience when the password reset email cannot be sent.

This introduces a link to the support page for resetting your password, and improves the error by bringing it into the login page instead of a wp_die().

Props neelpatel7295, estelaris, desrosj

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-login.php

    r45298 r45404  
    4646
    4747        // Shake it!
    48         $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
     48        $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'retrieve_password_email_failure' );
    4949        /**
    5050         * Filters the error codes array for shaking the login form.
    … …  
    427427
    428428        if ( $message && ! wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) ) {
    429                 wp_die( __( 'The email could not be sent. Possible reason: your host may have disabled the mail() function.' ) );
     429                /* translators: URL to support page for resetting your password */
     430                $support = __( 'https://wordpress.org/support/article/resetting-your-password/' );
     431                $errors->add(
     432                        'retrieve_password_email_failure',
     433                        sprintf(
     434                                __( '<strong>ERROR</strong>: The e-mail could not be sent. Your site may not be correctly configured to send e-mails. <a href="%s">Get support for resetting your password</a>.' ),
     435                                esc_url( $support )
     436                        )
     437                );
     438                return $errors;
    430439        }
    431440
Note: See TracChangeset for help on using the changeset viewer.