Make WordPress Core

Ticket #49860: 49860-3.patch

File 49860-3.patch, 1.3 KB (added by ttodua, 12 months ago)
  • wp-includes/functions.php

     
    74417441}
    74427442
    74437443/**
     7444 * Check whether user registration is disabled and password reset is also disabled
     7445 * for existing users, and in this case, redirects to login page.
     7446 *
     7447 * @since Future
     7448 */
     7449function wp_redirect_if_registration_and_reset_disabled() {
     7450        if ( ! get_option( 'users_can_register' ) && apply_filters( 'disable_password_reset', false ) ) {
     7451                wp_safe_redirect( 'wp-login.php' );
     7452                exit();
     7453        }
     7454}
     7455
     7456/**
    74447457 * Returns RegEx body to liberally match an opening HTML tag.
    74457458 *
    74467459 * Matches an opening HTML tag that:
  • wp-login.php

     
    823823
    824824        case 'lostpassword':
    825825        case 'retrievepassword':
     826                wp_redirect_if_registration_and_reset_disabled();
    826827                if ( $http_post ) {
    827828                        $errors = retrieve_password();
    828829
     
    925926
    926927        case 'resetpass':
    927928        case 'rp':
     929                wp_redirect_if_registration_and_reset_disabled();
    928930                list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
    929931                $rp_cookie       = 'wp-resetpass-' . COOKIEHASH;
    930932