Make WordPress Core

Ticket #32510: 32510.diff

File 32510.diff, 4.3 KB (added by nant82, 6 years ago)

Added attibute required to all mandatory inputs. Including register form, login form and password recovery form.

  • src/wp-login.php

    diff --git a/src/wp-login.php b/src/wp-login.php
    index 1e1ba5cc6a..8940d67f51 100644
    a b switch ( $action ) { 
    836836                <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
    837837                        <p>
    838838                                <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
    839                                 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" />
     839        <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" required />
    840840                        </p>
    841841                        <?php
    842842
    switch ( $action ) { 
    950950                                </p>
    951951
    952952                                <div class="wp-pwd">
    953                                         <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="off" aria-describedby="pass-strength-result" />
     953          <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="off" aria-describedby="pass-strength-result" required />
    954954
    955955                                        <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
    956956                                                <span class="dashicons dashicons-hidden" aria-hidden="true"></span>
    switch ( $action ) { 
    965965
    966966                        <p class="user-pass2-wrap">
    967967                                <label for="pass2"><?php _e( 'Confirm new password' ); ?></label>
    968                                 <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" />
     968                                <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" required />
    969969                        </p>
    970970
    971971                        <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
    switch ( $action ) { 
    10651065                <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate">
    10661066                        <p>
    10671067                                <label for="user_login"><?php _e( 'Username' ); ?></label>
    1068                                 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" />
     1068        <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" required />
    10691069                        </p>
    10701070                        <p>
    10711071                                <label for="user_email"><?php _e( 'Email' ); ?></label>
    1072                                 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" />
     1072                                <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" required />
    10731073                        </p>
    10741074                        <?php
    10751075
    switch ( $action ) { 
    13411341                <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
    13421342                        <p>
    13431343                                <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label>
    1344                                 <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" />
     1344                                <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" required />
    13451345                        </p>
    13461346
    13471347                        <div class="user-pass-wrap">
    13481348                                <label for="user_pass"><?php _e( 'Password' ); ?></label>
    13491349                                <div class="wp-pwd">
    1350                                         <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input password-input" value="" size="20" />
     1350                                        <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input password-input" value="" size="20" required />
    13511351                                        <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>">
    13521352                                                <span class="dashicons dashicons-visibility" aria-hidden="true"></span>
    13531353                                        </button>