WordPress.org

Make WordPress Core

Ticket #27740: 27740.diff

File 27740.diff, 1.3 KB (added by izem, 6 years ago)

adding poka-yoke to wp-admin/install.php

  • src/wp-admin/install.php

    diff --git src/wp-admin/install.php src/wp-admin/install.php
    index d363e2d..de5bd4d 100644
    switch($step) { 
    189189                $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : '';
    190190                $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : '';
    191191                $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : '';
     192                $trimmed_admin_password = trim( $admin_password );
    192193                $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : '';
    193194                $admin_email  = isset( $_POST['admin_email']  ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : '';
    194195                $public       = isset( $_POST['blog_public']  ) ? (int) $_POST['blog_public'] : 0;
    switch($step) { 
    205206                        // TODO: poka-yoke
    206207                        display_setup_form( __( 'Your passwords do not match. Please try again.' ) );
    207208                        $error = true;
     209                } elseif ( !empty( $admin_password ) && empty( $trimmed_admin_password ) ) {
     210                        // TODO: poka-yoke
     211                        display_setup_form( __( 'Your password has nothing but whitespace. Please try again.' ) );
     212                        $error = true;
    208213                } else if ( empty( $admin_email ) ) {
    209214                        // TODO: poka-yoke
    210215                        display_setup_form( __( 'You must provide an email address.' ) );