Make WordPress Core

Changeset 8454


Ignore:
Timestamp:
07/25/2008 06:32:53 AM (16 years ago)
Author:
azaozz
Message:

Login: keep username when password is incorrect and focus on password field

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r8411 r8454  
    450450
    451451    login_header(__('Login'), '', $errors);
     452
     453    if ( isset($_POST['log']) )
     454        $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? attribute_escape(stripslashes($_POST['log'])) : '';
    452455?>
    453456
     
    456459    <p>
    457460        <label><?php _e('Username') ?><br />
    458         <input type="text" name="log" id="user_login" class="input" value="<?php echo attribute_escape(stripslashes($user_login)); ?>" size="20" tabindex="10" /></label>
     461        <input type="text" name="log" id="user_login" class="input" value="<?php echo $user_login; ?>" size="20" tabindex="10" /></label>
    459462    </p>
    460463    <p>
     
    489492
    490493<script type="text/javascript">
     494<?php if ( $user_login ) { ?>
     495setTimeout( function(){ try{
     496d = document.getElementById('user_pass');
     497d.value = '';
     498d.focus();
     499} catch(e){}
     500}, 200);
     501<?php } else { ?>
    491502try{document.getElementById('user_login').focus();}catch(e){}
     503<?php } ?>
    492504</script>
    493505</body>
Note: See TracChangeset for help on using the changeset viewer.