Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/18/2019 06:57:54 AM (5 years ago)
Author:
imath
Message:

BP Nouveau: use the same control than WP to set the user password

On the BuddyPress registration page and on the general settings user’s page, BP Nouveau is now using the same control WordPress is using to let users choose their password. By default it generates a strong password to make the user aware of the importance of its robustness. The user can still edit it and if the password is too weak, the submit button is disabled until the user activates the checkbox to force the use of a weak password.

Developers, please note the src/bp-templates/bp-nouveau/js/password-verify.js is now deprecated and will be deleted in version 6.0.0. If you were using the bp-nouveau-password-verify script handle as a dependency of your script(s), please stop doing so before the 6.0.0 release.

Fixes #8092

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-templates/bp-nouveau/buddypress/members/single/settings/general.php

    r12156 r12397  
    44 *
    55 * @since 3.0.0
    6  * @version 3.1.0
     6 * @version 5.0.0
    77 */
    88
     
    1010
    1111<h2 class="screen-heading general-settings-screen">
    12     <?php _e( 'Email & Password', 'buddypress' ); ?>
     12    <?php esc_html_e( 'Email & Password', 'buddypress' ); ?>
    1313</h2>
    1414
    1515<p class="info email-pwd-info">
    16     <?php _e( 'Update your email and or password.', 'buddypress' ); ?>
     16    <?php esc_html_e( 'Update your email and or password.', 'buddypress' ); ?>
    1717</p>
    1818
    19 <form action="<?php echo esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/general' ); ?>" method="post" class="standard-form" id="settings-form">
     19<form action="<?php echo esc_url( bp_displayed_user_domain() . bp_get_settings_slug() . '/general' ); ?>" method="post" class="standard-form" id="your-profile">
    2020
    2121    <?php if ( ! is_super_admin() ) : ?>
    2222
    23         <label for="pwd"><?php _e( 'Current Password <span>(required to update email or change current password)</span>', 'buddypress' ); ?></label>
    24         <input type="password" name="pwd" id="pwd" size="16" value="" class="settings-input small" <?php bp_form_field_attributes( 'password' ); ?>/> &nbsp;<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php esc_html_e( 'Lost your password?', 'buddypress' ); ?></a>
     23        <label for="pwd"><?php printf( esc_html__( 'Current Password %s', 'buddypress' ), '<span>' . esc_html__( '(required to update email or change current password)', 'buddypress' ) . '</span>' ); ?></label>
     24        <input type="password" name="pwd" id="pwd" value="" size="24" class="settings-input small" <?php bp_form_field_attributes( 'password' ); ?>/> &nbsp;<a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php esc_html_e( 'Lost your password?', 'buddypress' ); ?></a>
    2525
    2626    <?php endif; ?>
    2727
    28     <label for="email"><?php _e( 'Account Email', 'buddypress' ); ?></label>
     28    <label for="email"><?php esc_html_e( 'Account Email', 'buddypress' ); ?></label>
    2929    <input type="email" name="email" id="email" value="<?php echo esc_attr( bp_get_displayed_user_email() ); ?>" class="settings-input" <?php bp_form_field_attributes( 'email' ); ?>/>
    3030
    3131    <div class="info bp-feedback">
    3232        <span class="bp-icon" aria-hidden="true"></span>
    33         <p class="text"><?php esc_html_e( 'Leave password fields blank for no change', 'buddypress' ); ?></p>
     33        <p class="text"><?php esc_html_e( 'Click on the "Generate Password" button to change your password.', 'buddypress' ); ?></p>
    3434    </div>
    3535
    36     <label for="pass1"><?php esc_html_e( 'Add Your New Password', 'buddypress' ); ?></label>
    37     <input type="password" name="pass1" id="pass1" size="16" value="" class="settings-input small password-entry" <?php bp_form_field_attributes( 'password' ); ?>/>
     36    <div class="user-pass1-wrap">
     37        <button type="button" class="button wp-generate-pw">
     38            <?php esc_html_e( 'Generate Password', 'buddypress' ); ?>
     39        </button>
    3840
    39     <label for="pass2" class="repeated-pwd"><?php esc_html_e( 'Repeat Your New Password', 'buddypress' ); ?></label>
    40     <input type="password" name="pass2" id="pass2" size="16" value="" class="settings-input small password-entry-confirm" <?php bp_form_field_attributes( 'password' ); ?>/>
     41        <div class="wp-pwd">
     42            <label for="pass1"><?php esc_html_e( 'Add Your New Password', 'buddypress' ); ?></label>
     43            <span class="password-input-wrapper">
     44                <input type="password" name="pass1" id="pass1" size="24" class="settings-input small password-entry" value="" <?php bp_form_field_attributes( 'password', array( 'data-pw' => wp_generate_password( 24 ), 'aria-describedby' => 'pass-strength-result' ) ); ?> />
     45            </span>
     46            <button type="button" class="button wp-hide-pw" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password', 'buddypress' ); ?>">
     47                <span class="dashicons dashicons-hidden" aria-hidden="true"></span>
     48                <span class="text bp-screen-reader-text"><?php esc_html_e( 'Hide', 'buddypress' ); ?></span>
     49            </button>
     50            <button type="button" class="button wp-cancel-pw" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change', 'buddypress' ); ?>">
     51                <span class="text"><?php esc_html_e( 'Cancel', 'buddypress' ); ?></span>
     52            </button>
     53            <div id="pass-strength-result" aria-live="polite"></div>
     54        </div>
     55    </div>
    4156
    42     <div id="pass-strength-result"></div>
     57    <div class="user-pass2-wrap">
     58        <label class="label" for="pass2"><?php esc_html_e( 'Repeat Your New Password', 'buddypress' ); ?></label>
     59        <input name="pass2" type="password" id="pass2" size="24" class="settings-input small password-entry-confirm" value="" <?php bp_form_field_attributes( 'password' ); ?> />
     60    </div>
     61
     62    <div class="pw-weak">
     63        <label>
     64            <input type="checkbox" name="pw_weak" class="pw-checkbox" />
     65            <span id="pw-weak-text-label"><?php esc_html_e( 'Confirm use of potentially weak password', 'buddypress' ); ?></span>
     66        </label>
     67    </div>
    4368
    4469    <?php bp_nouveau_submit_button( 'members-general-settings' ); ?>
Note: See TracChangeset for help on using the changeset viewer.