From 5e782cf922ad373b12003c5ef1839daa27d7b054 Mon Sep 17 00:00:00 2001 From: nikitasinelnikov Date: Mon, 3 Aug 2020 18:06:26 +0300 Subject: [PATCH] - fixed account submission for password reset; --- assets/img/extensions/jobboardwp.png | Bin 0 -> 17741 bytes assets/js/um-account.js | 8 +- assets/js/um-account.min.js | 2 +- includes/admin/templates/extensions.php | 10 +- includes/core/class-account.php | 44 ++++- includes/core/class-fields.php | 5 +- includes/core/class-form.php | 2 +- includes/core/class-password.php | 20 +-- includes/core/um-actions-account.php | 219 +++++++++++++++--------- includes/core/um-actions-global.php | 4 +- readme.txt | 18 +- 11 files changed, 220 insertions(+), 112 deletions(-) create mode 100644 assets/img/extensions/jobboardwp.png diff --git a/assets/img/extensions/jobboardwp.png b/assets/img/extensions/jobboardwp.png new file mode 100644 index 0000000000000000000000000000000000000000..04bf3b6bcf700c1dcc93e1efa748c2133c33d8d5 GIT binary patch literal 17741 zcmeIabyS;QvoIP6?pEC02~spbkm3$)p}0ef2TP%Nad($urBGap7k4OL+@Ym-amY=7 zub%fi=UexWyY62nYdv{(_A@hk_RQ?bo;{O9XlW?oVo_oN003NNC3zhH0144V0$`va zZboh&Z4e*)?B(RNl;z~;wcMO->>aED0QQ7;@e``ZG9&|?ug!}#7=rO=QfoCh8v|!p zv@nUm;S^RL2J_E>#$hWlk-RiPm9jE3#in7m*gw88>{Fx25XzT627TaVSfZMr#Ci)l zmpZpuO%pNgI!Ytw@(Kxvd~J8&t(QJBjy+B$I)zTAu#sYw^Gv6VnZ4tD;<`C3X0H`6 zf9nHxZa$0T1vc_-DreZEoeG^!Ms|xrC94$V2%TMcU$ym!*`69~sk72Bbug1|CnmG` zFEN5cELrGJIjddH4uki8{#YlNjBbw$QKWR0XP^({=p|r%$!dqs1R#_V z@78*OyGmVN`_!>aUmyfStN;V^Io>TQKXYQ|^8A`#!|Pc&vwIqsnO67U7t)Qd zJAhqvnAxU+%1M+g=sZ3JfVNy@NrU_=(tVRjY|9V7nY>8$e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PzWvExBQ&>C0>nK^(M@7Ye=iek}p*$2MgwJ!iCqqMU^4qtpVXx#J) z$FdmjBQm3PKqhaNh*OQAK7DhSeg4qQ6<><|1j5FTe>y~BM+bSv_>Mqe!FLS*A)NqG z%bi0N@CPJFn>4JAc1w#`rnJ4;P*9GHI4AZ; z4TmSCpI-$8=o&G>T^fXXquYFBZgJ)gP$Hx#SzB?u9l~?f3I~?8gRZ(=WIB_PjI^59 z+R|Kq=V%DW$+r17I#k_nZI0ER=9*G}zo8n3M4-m4e+LQQ^-zeYfT~AF8@LZzn z5=#UnF@VUi0e3wu)>4k(d7kz*2!{TyZ=gwO6-Ie_j1;GU9+N^d(sKYo zE&?8HZaoE-q8GbV-|)541~bi=2%fd}`4KBigX0jtkDL(MSm1=HwlAh<`QJ{~o!OoK z>__^zh0{9}HqU&Wrb!zQj}q&YyMOH_A)MS!Y^WaCKK;U+i{qKo_yE48cr{M{Q|BS> zcx3WBweI^iES0aHV|LCMD~?DlVR5PNHe7zwG=6=fVEzo^0Wg0*O_kwFsj)*fzqn+c zduQqWeW%e73w}WGa9)kpiOkwWa#PkmFZM;`y9c;f4-G^+!;)D?ON(^rbM3DKvWdBzP|6g0ey?=_Ti-V`Z<)44z P04P7xkgt?A3;KTm 'Using the Google Maps API, display users on a map on the member directory page and allow users to add their location via their profile', ); -//$premium['profile-tabs'] = array( -// 'url' => 'https://ultimatemember.com/extensions/profile-tabs/', -// 'name' => 'Profile Tabs', -// 'desc' => 'Allow users to add custom tabs to profiles', -//); +$free['jobboardwp'] = array( + 'url' => 'https://wordpress.org/plugins/um-jobboardwp', + 'name' => 'JobBoardWP', + 'desc' => 'Integrates Ultimate Member with the job board plugin JobBoardWP', +); $free['forumwp'] = array( 'url' => 'https://ultimatemember.com/extensions/forumwp/', diff --git a/includes/core/class-account.php b/includes/core/class-account.php index fea95b00..ade56be5 100644 --- a/includes/core/class-account.php +++ b/includes/core/class-account.php @@ -160,6 +160,10 @@ if ( ! class_exists( 'um\core\Account' ) ) { * @throws \Exception */ function ultimatemember_account( $args = array() ) { + if ( ! is_user_logged_in() ) { + return ''; + } + um_fetch_user( get_current_user_id() ); ob_start(); @@ -626,7 +630,10 @@ if ( ! class_exists( 'um\core\Account' ) ) { case 'delete': - $args = 'single_user_password'; + $args = ''; + if ( $this->current_password_is_required( $id ) ) { + $args = 'single_user_password'; + } /** * UM hook @@ -660,6 +667,10 @@ if ( ! class_exists( 'um\core\Account' ) ) { $output .= UM()->fields()->edit_field( $key, $data ); } + if ( ! $output && ! $this->current_password_is_required( $id ) ) { + $output = '
'; + } + break; case 'general': @@ -674,7 +685,7 @@ if ( ! class_exists( 'um\core\Account' ) ) { $args = str_replace(',user_email','', $args ); } - if ( UM()->options()->get( 'account_general_password' ) ) { + if ( $this->current_password_is_required( $id ) ) { $args .= ',single_user_password'; } @@ -930,5 +941,34 @@ if ( ! class_exists( 'um\core\Account' ) ) { $classes = apply_filters( 'um_form_official_classes__hook', $classes ); return $classes; } + + + /** + * Checks account actions require current password + * + * @param $tab_key + * + * @return bool + */ + function current_password_is_required( $tab_key ) { + $is_required = true; + + switch ( $tab_key ) { + case 'general': + $is_required = UM()->options()->get( 'account_general_password' ); + break; + case 'delete': + break; + case 'password': + break; + case 'privacy_erase_data': + case 'privacy_download_data': + break; + } + + $is_required = apply_filters( "um_account_{$tab_key}_require_current", $is_required ); + + return $is_required; + } } } \ No newline at end of file diff --git a/includes/core/class-fields.php b/includes/core/class-fields.php index a65ba453..826e3cf2 100644 --- a/includes/core/class-fields.php +++ b/includes/core/class-fields.php @@ -2279,7 +2279,8 @@ if ( ! class_exists( 'um\core\Fields' ) ) { } else { - if ( $this->set_mode == 'account' || um_is_core_page( 'account' ) ) { + if ( UM()->account()->current_password_is_required( 'password' ) && + ( $this->set_mode == 'account' || um_is_core_page( 'account' ) ) ) { $key = 'current_' . $original_key; $output .= '
get_atts( $key, $classes, $conditional, $data ) . '>'; @@ -2302,7 +2303,7 @@ if ( ! class_exists( 'um\core\Fields' ) ) { if ( $this->is_error( $key ) ) { $output .= $this->field_error( $this->show_error( $key ) ); - }else if ( $this->is_notice( $key ) ) { + } elseif ( $this->is_notice( $key ) ) { $output .= $this->field_notice( $this->show_notice( $key ) ); } diff --git a/includes/core/class-form.php b/includes/core/class-form.php index dcf7be4b..80bed687 100644 --- a/includes/core/class-form.php +++ b/includes/core/class-form.php @@ -407,7 +407,7 @@ if ( ! class_exists( 'um\core\Form' ) ) { //$this->post_form['submitted']['role'] = $role; } - if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ){ + if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ) { wp_die( 'Hello, spam bot!', 'ultimate-member' ); } diff --git a/includes/core/class-password.php b/includes/core/class-password.php index dfd71899..d19a9ba8 100644 --- a/includes/core/class-password.php +++ b/includes/core/class-password.php @@ -262,7 +262,7 @@ if ( ! class_exists( 'um\core\Password' ) ) { * @return bool */ function is_change_request() { - if ( um_is_core_page( 'account' ) && isset( $_POST['_um_account'] ) == 1 && isset( $_POST['_um_account_tab'] ) && $_POST['_um_account_tab'] == 'password' ) { + if ( isset( $_POST['_um_account'] ) == 1 && isset( $_POST['_um_account_tab'] ) && $_POST['_um_account_tab'] == 'password' ) { return true; } elseif ( isset( $_POST['_um_password_change'] ) && $_POST['_um_password_change'] == 1 ) { return true; @@ -526,41 +526,41 @@ if ( ! class_exists( 'um\core\Password' ) ) { * @param $args */ function um_change_password_errors_hook( $args ) { - if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ){ - wp_die('Hello, spam bot!','ultimate-member'); + if ( isset( $_POST[ UM()->honeypot ] ) && $_POST[ UM()->honeypot ] != '' ) { + wp_die( 'Hello, spam bot!', 'ultimate-member' ); } if ( ! is_user_logged_in() && isset( $args ) && ! um_is_core_page( 'password-reset' ) || is_user_logged_in() && isset( $args['user_id'] ) && $args['user_id'] != get_current_user_id() ) { - wp_die( __( 'This is not possible for security reasons.','ultimate-member') ); + wp_die( __( 'This is not possible for security reasons.', 'ultimate-member' ) ); } if ( isset( $args['user_password'] ) && empty( $args['user_password'] ) ) { - UM()->form()->add_error('user_password', __('You must enter a new password','ultimate-member') ); + UM()->form()->add_error( 'user_password', __( 'You must enter a new password', 'ultimate-member' ) ); } if ( UM()->options()->get( 'reset_require_strongpass' ) ) { if ( strlen( utf8_decode( $args['user_password'] ) ) < 8 ) { - UM()->form()->add_error('user_password', __('Your password must contain at least 8 characters','ultimate-member') ); + UM()->form()->add_error( 'user_password', __( 'Your password must contain at least 8 characters', 'ultimate-member' ) ); } if ( strlen( utf8_decode( $args['user_password'] ) ) > 30 ) { - UM()->form()->add_error('user_password', __('Your password must contain less than 30 characters','ultimate-member') ); + UM()->form()->add_error( 'user_password', __( 'Your password must contain less than 30 characters', 'ultimate-member' ) ); } if ( ! UM()->validation()->strong_pass( $args['user_password'] ) ) { - UM()->form()->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimate-member') ); + UM()->form()->add_error( 'user_password', __( 'Your password must contain at least one lowercase letter, one capital letter and one number', 'ultimate-member' ) ); } } if ( isset( $args['confirm_user_password'] ) && empty( $args['confirm_user_password'] ) ) { - UM()->form()->add_error('confirm_user_password', __('You must confirm your new password','ultimate-member') ); + UM()->form()->add_error( 'confirm_user_password', __( 'You must confirm your new password', 'ultimate-member' ) ); } if ( isset( $args['user_password'] ) && isset( $args['confirm_user_password'] ) && $args['user_password'] != $args['confirm_user_password'] ) { - UM()->form()->add_error('confirm_user_password', __('Your passwords do not match','ultimate-member') ); + UM()->form()->add_error( 'confirm_user_password', __( 'Your passwords do not match', 'ultimate-member' ) ); } } diff --git a/includes/core/um-actions-account.php b/includes/core/um-actions-account.php index f006bdc7..388cc258 100644 --- a/includes/core/um-actions-account.php +++ b/includes/core/um-actions-account.php @@ -4,11 +4,10 @@ /** * Validate for errors in account form * - * @param $args + * @param array $args */ function um_submit_account_errors_hook( $args ) { - - if ( ! isset( $_POST['um_account_submit'] ) ) { + if ( ! isset( $_POST['_um_account'] ) && ! isset( $_POST['_um_account_tab'] ) ) { return; } @@ -22,11 +21,13 @@ function um_submit_account_errors_hook( $args ) { switch ( $_POST['_um_account_tab'] ) { case 'delete': { // delete account - if ( strlen(trim( $_POST['single_user_password'] ) ) == 0 ) { - UM()->form()->add_error( 'single_user_password', __( 'You must enter your password', 'ultimate-member' ) ); - } else { - if ( ! wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) { - UM()->form()->add_error( 'single_user_password', __( 'This is not your password', 'ultimate-member' ) ); + if ( UM()->account()->current_password_is_required( 'delete' ) ) { + if ( strlen( trim( $_POST['single_user_password'] ) ) == 0 ) { + UM()->form()->add_error( 'single_user_password', __( 'You must enter your password', 'ultimate-member' ) ); + } else { + if ( ! wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) { + UM()->form()->add_error( 'single_user_password', __( 'This is not your password', 'ultimate-member' ) ); + } } } @@ -36,39 +37,53 @@ function um_submit_account_errors_hook( $args ) { } case 'password': { + // change password - if ( ( isset( $_POST['current_user_password'] ) && $_POST['current_user_password'] != '' ) || - ( isset( $_POST['user_password'] ) && $_POST['user_password'] != '' ) || - ( isset( $_POST['confirm_user_password'] ) && $_POST['confirm_user_password'] != '') ) { + UM()->account()->current_tab = 'password'; - if ( $_POST['current_user_password'] == '' || ! wp_check_password( $_POST['current_user_password'], $user->data->user_pass, $user->data->ID ) ) { + if ( empty( $_POST['user_password'] ) ) { + UM()->form()->add_error('user_password', __( 'Password is required', 'ultimate-member' ) ); + return; + } - UM()->form()->add_error('current_user_password', __('This is not your password','ultimate-member') ); - UM()->account()->current_tab = 'password'; - } else { // correct password + if ( empty( $_POST['confirm_user_password'] ) ) { + UM()->form()->add_error('user_password', __( 'Password confirmation is required', 'ultimate-member' ) ); + return; + } - if ( $_POST['user_password'] != $_POST['confirm_user_password'] && $_POST['user_password'] ) { - UM()->form()->add_error('user_password', __('Your new password does not match','ultimate-member') ); - UM()->account()->current_tab = 'password'; + if ( ! empty( $_POST['user_password'] ) && ! empty( $_POST['confirm_user_password'] ) ) { + + if ( UM()->account()->current_password_is_required( 'password' ) ) { + if ( empty( $_POST['current_user_password'] ) ) { + UM()->form()->add_error('current_user_password', __( 'This is not your password', 'ultimate-member' ) ); + return; + } else { + if ( ! wp_check_password( $_POST['current_user_password'], $user->data->user_pass, $user->data->ID ) ) { + UM()->form()->add_error('current_user_password', __( 'This is not your password', 'ultimate-member' ) ); + return; + } } - - if ( UM()->options()->get( 'account_require_strongpass' ) ) { - - if ( strlen( utf8_decode( $_POST['user_password'] ) ) < 8 ) { - UM()->form()->add_error('user_password', __('Your password must contain at least 8 characters','ultimate-member') ); - } - - if ( strlen( utf8_decode( $_POST['user_password'] ) ) > 30 ) { - UM()->form()->add_error('user_password', __('Your password must contain less than 30 characters','ultimate-member') ); - } - - if ( ! UM()->validation()->strong_pass( $_POST['user_password'] ) ) { - UM()->form()->add_error('user_password', __('Your password must contain at least one lowercase letter, one capital letter and one number','ultimate-member') ); - } - - } - } + + if ( $_POST['user_password'] != $_POST['confirm_user_password'] && $_POST['user_password'] ) { + UM()->form()->add_error('user_password', __( 'Your new password does not match', 'ultimate-member' ) ); + return; + } + + if ( UM()->options()->get( 'account_require_strongpass' ) ) { + if ( strlen( utf8_decode( $_POST['user_password'] ) ) < 8 ) { + UM()->form()->add_error( 'user_password', __( 'Your password must contain at least 8 characters', 'ultimate-member' ) ); + } + + if ( strlen( utf8_decode( $_POST['user_password'] ) ) > 30 ) { + UM()->form()->add_error( 'user_password', __( 'Your password must contain less than 30 characters', 'ultimate-member' ) ); + } + + if ( ! UM()->validation()->strong_pass( $_POST['user_password'] ) ) { + UM()->form()->add_error( 'user_password', __( 'Your password must contain at least one lowercase letter, one capital letter and one number', 'ultimate-member' ) ); + } + } + } break; @@ -109,7 +124,7 @@ function um_submit_account_errors_hook( $args ) { } // check account password - if ( UM()->options()->get( 'account_general_password' ) ) { + if ( UM()->account()->current_password_is_required( 'general' ) ) { if ( strlen( trim( $_POST['single_user_password'] ) ) == 0 ) { UM()->form()->add_error('single_user_password', __( 'You must enter your password', 'ultimate-member' ) ); } else { @@ -185,10 +200,7 @@ function um_submit_account_details( $args ) { // delete account - $user = get_user_by( 'login', um_user( 'user_login' ) ); - - if ( 'delete' == $current_tab && isset( $_POST['single_user_password'] ) && - wp_check_password( $_POST['single_user_password'], $user->data->user_pass, $user->data->ID ) ) { + if ( 'delete' == $current_tab ) { if ( current_user_can( 'delete_users' ) || um_user( 'can_delete_profile' ) ) { UM()->user()->delete(); @@ -415,7 +427,13 @@ add_action( 'um_account_page_hidden_fields', 'um_account_page_hidden_fields' ); * Before delete account tab content */ function um_before_account_delete() { - printf( __( '%s', 'ultimate-member' ), wpautop( htmlspecialchars( UM()->options()->get( 'delete_account_text' ) ) ) ); + if ( UM()->account()->current_password_is_required( 'delete' ) ) { + $text = UM()->options()->get( 'delete_account_text' ); + } else { + $text = UM()->options()->get( 'delete_account_no_pass_required_text' ); + } + + printf( __( '%s', 'ultimate-member' ), wpautop( htmlspecialchars( $text ) ) ); } add_action( 'um_before_account_delete', 'um_before_account_delete' ); @@ -530,17 +548,29 @@ function um_after_account_privacy( $args ) { echo '

' . esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' ) . '

'; } elseif ( ! empty( $pending ) && $pending['post_status'] == 'request-confirmed' ) { echo '

' . esc_html__( 'The administrator has not yet approved downloading the data. Please expect an email with a link to your data.', 'ultimate-member' ) . '

'; - } else { ?> - -
- -
- + } else { + if ( UM()->account()->current_password_is_required( 'privacy_download_data' ) ) { ?> + + +
+ +
+ +
+
+ + + +
-
+ + + @@ -592,15 +622,27 @@ function um_after_account_privacy( $args ) { echo '

' . esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' ) . '

'; } elseif ( ! empty( $pending ) && $pending['post_status'] == 'request-confirmed' ) { echo '

' . esc_html__( 'The administrator has not yet approved deleting your data. Please expect an email with a link to your data.', 'ultimate-member' ) . '

'; - } else { ?> - + } else { + if ( UM()->account()->current_password_is_required( 'privacy_erase_data' ) ) { ?> + + + + + + + + + @@ -615,37 +657,48 @@ function um_after_account_privacy( $args ) { function um_request_user_data() { UM()->check_ajax_nonce(); + if ( ! isset( $_POST['request_action'] ) ) { + wp_send_json_error( __( 'Wrong request.', 'ultimate-member' ) ); + } + $user_id = get_current_user_id(); - $password = $_POST['password']; + $password = ! empty( $_POST['password'] ) ? $_POST['password'] : ''; $user = get_userdata( $user_id ); $hash = $user->data->user_pass; - if ( wp_check_password( $password, $hash ) && isset( $_POST['request_action'] ) ) { - - if ( $_POST['request_action'] == 'um-export-data' ) { - $request_id = wp_create_user_request( $user->data->user_email, 'export_personal_data' ); - } elseif ( $_POST['request_action'] == 'um-erase-data' ) { - $request_id = wp_create_user_request( $user->data->user_email, 'remove_personal_data' ); + if ( $_POST['request_action'] == 'um-export-data' ) { + if ( UM()->account()->current_password_is_required( 'privacy_download_data' ) ) { + if ( ! wp_check_password( $password, $hash ) ) { + $answer = esc_html__( 'The password you entered is incorrect.', 'ultimate-member' ); + wp_send_json_success( array( 'answer' => $answer ) ); + } } - - if ( empty( $request_id ) ) { - wp_send_json_error( __( 'Wrong request.', 'ultimate-member' ) ); + } elseif ( $_POST['request_action'] == 'um-erase-data' ) { + if ( UM()->account()->current_password_is_required( 'privacy_erase_data' ) ) { + if ( ! wp_check_password( $password, $hash ) ) { + $answer = esc_html__( 'The password you entered is incorrect.', 'ultimate-member' ); + wp_send_json_success( array( 'answer' => $answer ) ); + } } - - if ( is_wp_error( $request_id ) ) { - $answer = $request_id->get_error_message(); - } else { - wp_send_user_request( $request_id ); - $answer = esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' ); - } - - } else { - - $answer = esc_html__( 'The password you entered is incorrect.', 'ultimate-member' ); - } - wp_send_json_success( array( 'answer' => esc_html( $answer ) ) ); + if ( $_POST['request_action'] == 'um-export-data' ) { + $request_id = wp_create_user_request( $user->data->user_email, 'export_personal_data' ); + } elseif ( $_POST['request_action'] == 'um-erase-data' ) { + $request_id = wp_create_user_request( $user->data->user_email, 'remove_personal_data' ); + } + + if ( ! isset( $request_id ) || empty( $request_id ) ) { + wp_send_json_error( __( 'Wrong request.', 'ultimate-member' ) ); + } + + if ( is_wp_error( $request_id ) ) { + $answer = esc_html( $request_id->get_error_message() ); + } else { + wp_send_user_request( $request_id ); + $answer = esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' ); + } + + wp_send_json_success( array( 'answer' => $answer ) ); } -add_action( 'wp_ajax_nopriv_um_request_user_data', 'um_request_user_data' ); add_action( 'wp_ajax_um_request_user_data', 'um_request_user_data' ); \ No newline at end of file diff --git a/includes/core/um-actions-global.php b/includes/core/um-actions-global.php index e411ebc6..e87db7e2 100644 --- a/includes/core/um-actions-global.php +++ b/includes/core/um-actions-global.php @@ -28,7 +28,7 @@ function um_add_security_checks( $args ) {

- +