WordPress.org

Make WordPress Core

Changeset 15782 for trunk/wp-login.php


Ignore:
Timestamp:
10/12/2010 09:37:01 PM (11 years ago)
Author:
scribu
Message:

first pass at strength indicator on password reset. see #5919

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-login.php

    r15781 r15782  
    335335}
    336336
     337// TODO: Eliminate duplicated code from wp_default_scripts()
     338function load_password_strength_meter() {
     339    if ( !$guessurl = site_url() )
     340        $guessurl = wp_guess_url();
     341
     342    $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
     343
     344    wp_enqueue_script( 'user-profile', $guessurl . "/wp-admin/js/user-profile$suffix.js", array('jquery'), '20100331' );
     345    wp_localize_script( 'user-profile', 'pwsL10n', array(
     346        'empty' => __('Strength indicator'),
     347        'short' => __('Very weak'),
     348        'bad' => __('Weak'),
     349        /* translators: password strength */
     350        'good' => _x('Medium', 'password strength'),
     351        'strong' => __('Strong'),
     352        'mismatch' => __('Mismatch'),
     353        'l10n_print_after' => 'try{convertEntities(pwsL10n);}catch(e){};'
     354    ) );
     355
     356    wp_print_scripts( array('user-profile') );
     357}
     358
    337359//
    338360// Main
     
    446468    }
    447469
    448     login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Reset your password') . '</p>', $errors );
     470    login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
     471
     472    load_password_strength_meter();
    449473
    450474?>
    451475<form name="resetpassform" id="resetpassform" action="<?php echo site_url('wp-login.php?action=resetpass&key=' . urlencode($_GET['key']) . '&login=' . urlencode($_GET['login']), 'login_post') ?>" method="post">
     476    <input type="hidden" id="user_login" value="<?php echo esc_attr( $_GET['login'] ); ?>" autocomplete="off" />
     477
    452478    <p>
    453         <label><?php _e('New Password') ?><br />
    454         <input type="password" name="pass1" id="user_pass" class="input" size="20" value="" autocomplete="off" /></label>
     479        <label><?php _e('New password') ?><br />
     480        <input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" /></label>
    455481    </p>
    456482    <p>
    457         <label><?php _e('New Password Again') ?><br />
    458         <input type="password" name="pass2" id="user_pass" class="input" size="20" value="" autocomplete="off" /></label>
     483        <label><?php _e('Confirm new password') ?><br />
     484        <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /></label>
    459485    </p>
     486
     487    <div id="pass-strength-result" class="hide-if-no-js"><?php _e('Strength indicator'); ?></div>
     488    <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
    460489
    461490    <br class="clear" />
Note: See TracChangeset for help on using the changeset viewer.