Skip to:
Content

BuddyPress.org

Changeset 8686


Ignore:
Timestamp:
07/24/2014 01:11:02 AM (10 years ago)
Author:
boonebgorges
Message:

Add password strength meters to registration and settings panels.

See #5775

Props SGr33n

Location:
trunk/src/bp-templates/bp-legacy
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-legacy/buddypress-functions.php

    r8662 r8686  
    254254            wp_enqueue_script( 'comment-reply' );
    255255        }
     256
     257        // Maybe enqueue password verify JS (register page or user settings page)
     258        if ( bp_is_register_page() || ( function_exists( 'bp_is_user_settings_general' ) && bp_is_user_settings_general() ) ) {
     259            $min      = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
     260            $filename = "password-verify{$min}.js";
     261
     262            // Locate the Register Page JS file
     263            $asset = $this->locate_asset_in_stack( $filename, 'js' );
     264
     265            // Enqueue script
     266            $dependencies = array_merge( bp_core_get_js_dependencies(), array(
     267                'password-strength-meter',
     268            ) );
     269            wp_enqueue_script( $asset['handle'] . '-password-verify', $asset['location'], $dependencies, $this->version);
     270        }
    256271    }
    257272
  • trunk/src/bp-templates/bp-legacy/buddypress/members/register.php

    r8683 r8686  
    4040                <label for="signup_password"><?php _e( 'Choose a Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    4141                <?php do_action( 'bp_signup_password_errors' ); ?>
    42                 <input type="password" name="signup_password" id="signup_password" value="" />
     42                <input type="password" name="signup_password" id="signup_password" value="" class="password-entry" />
     43                <div id="pass-strength-result"></div>
    4344
    4445                <label for="signup_password_confirm"><?php _e( 'Confirm Password', 'buddypress' ); ?> <?php _e( '(required)', 'buddypress' ); ?></label>
    4546                <?php do_action( 'bp_signup_password_confirm_errors' ); ?>
    46                 <input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" />
     47                <input type="password" name="signup_password_confirm" id="signup_password_confirm" value="" class="password-entry-confirm" />
    4748
    4849                <?php do_action( 'bp_account_details_fields' ); ?>
  • trunk/src/bp-templates/bp-legacy/buddypress/members/single/settings/general.php

    r7965 r8686  
    1414
    1515    <label for="pass1"><?php _e( 'Change Password <span>(leave blank for no change)</span>', 'buddypress' ); ?></label>
    16     <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'New Password', 'buddypress' ); ?><br />
    17     <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small" /> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ); ?>
     16    <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small password-entry" /> &nbsp;<?php _e( 'New Password', 'buddypress' ); ?><br />
     17    <div id="pass-strength-result"></div>
     18    <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small password-entry-confirm" /> &nbsp;<?php _e( 'Repeat New Password', 'buddypress' ); ?>
    1819
    1920    <?php do_action( 'bp_core_general_settings_before_submit' ); ?>
  • trunk/src/bp-templates/bp-legacy/css/buddypress.css

    r8471 r8686  
    530530    border: 1px solid #591;
    531531    color: #250;
     532}
     533#buddypress #pass-strength-result {
     534    background-color: #eee;
     535    border-color: #ddd;
     536    border-style: solid;
     537    border-width: 1px;
     538    display: none;
     539    margin: 5px 5px 5px 0;
     540    padding: 5px;
     541    text-align: center;
     542    width: 150px;
     543}
     544#buddypress .standard-form #basic-details-section #pass-strength-result {
     545    width: 35%;
     546}
     547#buddypress #pass-strength-result.error,
     548#buddypress #pass-strength-result.bad {
     549    background-color: #ffb78c;
     550    border-color: #ff853c !important;
     551    display: block;
     552}
     553#buddypress #pass-strength-result.good {
     554    background-color: #ffec8b;
     555    border-color: #fc0 !important;
     556    display: block;
     557}
     558#buddypress #pass-strength-result.short {
     559    background-color: #ffa0a0;
     560    border-color: #f04040 !important;
     561    display: block;
     562}
     563#buddypress #pass-strength-result.strong {
     564    background-color: #c3ff88;
     565    border-color: #8dff1c !important;
     566    display: block;
    532567}
    533568#buddypress .standard-form#signup_form div div.error {
Note: See TracChangeset for help on using the changeset viewer.