Make WordPress Core

Ticket #21778: 21778.diff

File 21778.diff, 1.0 KB (added by westi, 12 years ago)

Patch to rework the checking code and add a filter for more pluggable errors.

  • wp-login.php

     
    459459                exit;
    460460        }
    461461
    462         $errors = '';
     462        $errors = new WP_Error();
    463463
    464         if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] ) {
    465                 $errors = new WP_Error('password_reset_mismatch', __('The passwords do not match.'));
    466         } elseif ( isset($_POST['pass1']) && !empty($_POST['pass1']) ) {
     464        if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] )
     465                $errors->add( 'password_reset_mismatch', __('The passwords do not match.') );
     466
     467        do_action_ref_array( 'validate_password_reset' , array( &$errors, $user ) );
     468
     469        if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
    467470                reset_password($user, $_POST['pass1']);
    468471                login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
    469472                login_footer();