Changeset 12679 for trunk/src/bp-settings/actions/general.php
- Timestamp:
- 07/04/2020 01:29:50 PM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-settings/actions/general.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-settings/actions/general.php
r12603 r12679 131 131 /* Password Change Attempt ***************************************/ 132 132 133 if ( !empty( $_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) { 134 135 if ( ( $_POST['pass1'] == $_POST['pass2'] ) && !strpos( " " . wp_unslash( $_POST['pass1'] ), "\\" ) ) { 136 133 if ( ! empty( $_POST['pass1'] ) && ! empty( $_POST['pass2'] ) ) { 134 $pass = wp_unslash( $_POST['pass1'] ); 135 $pass_confirm = wp_unslash( $_POST['pass2'] ); 136 $pass_error = bp_members_validate_user_password( $pass, $pass_confirm, $update_user ); 137 138 if ( ! $pass_error->get_error_message() ) { 137 139 // Password change attempt is successful. 138 if ( ( ! empty( $_POST['pwd'] ) && $_POST['pwd'] != $_POST['pass1']) || is_super_admin() ) {140 if ( ( ! empty( $_POST['pwd'] ) && wp_unslash( $_POST['pwd'] ) !== $pass ) || is_super_admin() ) { 139 141 $update_user->user_pass = $_POST['pass1']; 140 $pass_changed = true; 142 $pass_error = false; 143 $pass_changed = true; 141 144 142 145 // The new password is the same as the current password. 143 146 } else { 144 $pass_error = 'same';147 $pass_error->add( 'same_user_password', __( 'The new password must be different from the current password.', 'buddypress' ) ); 145 148 } 146 147 // Password change attempt was unsuccessful.148 } else {149 $pass_error = 'mismatch';150 149 } 151 150 … … 155 154 156 155 // One of the password boxes was left empty. 157 } elseif ( ( empty( $_POST['pass1'] ) && ! empty( $_POST['pass2'] ) ) || ( !empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) ) {158 $pass_error = 'empty';156 } elseif ( ( empty( $_POST['pass1'] ) && ! empty( $_POST['pass2'] ) ) || ( ! empty( $_POST['pass1'] ) && empty( $_POST['pass2'] ) ) ) { 157 $pass_error = new WP_Error( 'empty_user_password', __( 'One of the password fields was empty.', 'buddypress' ) ); 159 158 } 160 159 … … 181 180 // Password Error. 182 181 } else { 183 $pass_error = 'invalid';182 $pass_error = new WP_Error( 'invalid_user_password', __( 'Your current password is invalid.', 'buddypress' ) ); 184 183 } 185 184 … … 203 202 } 204 203 205 // Password feedback. 206 switch ( $pass_error ) { 207 case 'invalid' : 208 $feedback['pass_error'] = __( 'Your current password is invalid.', 'buddypress' ); 209 break; 210 case 'mismatch' : 211 $feedback['pass_mismatch'] = __( 'The new password fields did not match.', 'buddypress' ); 212 break; 213 case 'empty' : 214 $feedback['pass_empty'] = __( 'One of the password fields was empty.', 'buddypress' ); 215 break; 216 case 'same' : 217 $feedback['pass_same'] = __( 'The new password must be different from the current password.', 'buddypress' ); 218 break; 219 case false : 220 // No change. 221 break; 204 if ( is_wp_error( $pass_error ) && $pass_error->get_error_message() ) { 205 $feedback[ $pass_error->get_error_code() ] = $pass_error->get_error_message(); 222 206 } 223 207
Note: See TracChangeset
for help on using the changeset viewer.