WordPress.org

Make WordPress Core

Ticket #16833: 16833.diff

File 16833.diff, 2.1 KB (added by solarissmoke, 3 years ago)

Insert maxlength attribute into user_login field to prevent long usernames being truncated silently

  • wp-signup.php

     
    138138        <?php if ( $errmsg = $errors->get_error_message('user_email') ) { ?> 
    139139                <p class="error"><?php echo $errmsg ?></p> 
    140140        <?php } ?> 
    141         <input name="user_email" type="text" id="user_email" value="<?php  echo esc_attr($user_email) ?>" maxlength="200" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?> 
     141        <input name="user_email" type="text" id="user_email" value="<?php  echo esc_attr($user_email) ?>" maxlength="100" /><br /><?php _e('We send your registration email to this address. (Double-check your email address before continuing.)') ?> 
    142142        <?php 
    143143        if ( $errmsg = $errors->get_error_message('generic') ) { 
    144144                echo '<p class="error">' . $errmsg . '</p>'; 
  • wp-login.php

     
    514514<form name="registerform" id="registerform" action="<?php echo site_url('wp-login.php?action=register', 'login_post') ?>" method="post"> 
    515515        <p> 
    516516                <label><?php _e('Username') ?><br /> 
    517                 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label> 
     517                <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(stripslashes($user_login)); ?>" size="20" tabindex="10" maxlength="60" /></label> 
    518518        </p> 
    519519        <p> 
    520520                <label><?php _e('E-mail') ?><br /> 
    521                 <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" tabindex="20" /></label> 
     521                <input type="text" name="user_email" id="user_email" class="input" value="<?php echo esc_attr(stripslashes($user_email)); ?>" size="25" tabindex="20" maxlength="100" /></label> 
    522522        </p> 
    523523<?php do_action('register_form'); ?> 
    524524        <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>