Changeset 13189 for trunk/src/bp-settings/actions/general.php
- Timestamp:
- 12/16/2021 06:16:38 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-settings/actions/general.php
r13090 r13189 74 74 // User is changing email address. 75 75 if ( $old_user_email !== $user_email ) { 76 77 76 // Run some tests on the email address. 78 77 $email_checks = bp_core_validate_email_address( $user_email ); … … 135 134 $pass = wp_unslash( $_POST['pass1'] ); 136 135 $pass_confirm = wp_unslash( $_POST['pass2'] ); 137 $pass_error = bp_members_validate_user_password( $pass, $pass_confirm, $update_user ); 138 139 if ( ! $pass_error->get_error_message() ) { 140 // Password change attempt is successful. 141 if ( ( ! empty( $_POST['pwd'] ) && wp_unslash( $_POST['pwd'] ) !== $pass ) || is_super_admin() ) { 142 $update_user['user_pass'] = $_POST['pass1']; 143 $pass_error = false; 144 $pass_changed = true; 145 146 // The new password is the same as the current password. 147 } else { 148 $pass_error->add( 'same_user_password', __( 'The new password must be different from the current password.', 'buddypress' ) ); 136 137 // Password strength check. 138 $required_password_strength = bp_members_user_pass_required_strength(); 139 $current_password_strength = null; 140 if ( isset( $_POST['_password_strength_score'] ) ) { 141 $current_password_strength = (int) $_POST['_password_strength_score']; 142 } 143 144 if ( $required_password_strength && ! is_null( $current_password_strength ) && $required_password_strength > $current_password_strength ) { 145 $pass_error = new WP_Error( 146 'not_strong_enough_password', 147 __( 'Your password is not strong enougth to be allowed on this site. Please use a stronger password.', 'buddypress' ) 148 ); 149 } else { 150 $pass_error = bp_members_validate_user_password( $pass, $pass_confirm, $update_user ); 151 152 if ( ! $pass_error->get_error_message() ) { 153 // Password change attempt is successful. 154 if ( ( ! empty( $_POST['pwd'] ) && wp_unslash( $_POST['pwd'] ) !== $pass ) || is_super_admin() ) { 155 $update_user['user_pass'] = $_POST['pass1']; 156 $pass_error = false; 157 $pass_changed = true; 158 159 // The new password is the same as the current password. 160 } else { 161 $pass_error->add( 'same_user_password', __( 'The new password must be different from the current password.', 'buddypress' ) ); 162 } 149 163 } 150 164 }
Note: See TracChangeset
for help on using the changeset viewer.