| @@ -33,9 +33,9 @@ | ||
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $redirect_to = ''; |
| 36 | 36 | if ( isset( $_REQUEST['redirect_to'] ) ) { |
| 37 | - $redirect_to = esc_url_raw( $_REQUEST['redirect_to'] ); | |
| 37 | + $redirect_to = wppb_sanitize_request_url( $_REQUEST['redirect_to'] ); | |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | $user = wp_signon( array(), $secure_cookie ); |
| 41 | 41 | |
| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | 'https://codex.wordpress.org/Cookies', 'https://wordpress.org/support/' ) ); |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | - $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? esc_url_raw( $_REQUEST['redirect_to'] ) : ''; | |
| 50 | + $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? wppb_sanitize_request_url( $_REQUEST['redirect_to'] ) : ''; | |
| 51 | 51 | /** |
| 52 | 52 | * Filters the login redirect URL. |
| 53 | 53 | */ |
| 54 | 54 | $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user ); |
| @@ -166,11 +166,11 @@ | ||
| 166 | 166 | $form_location = 'widget'; |
| 167 | 167 | |
| 168 | 168 | // if an error is being shown pass the original referer forward |
| 169 | 169 | if( isset( $_GET['wppb_referer_url'] ) ){ |
| 170 | - $wppb_referer_url = esc_url_raw ( $_GET['wppb_referer_url'] ); | |
| 170 | + $wppb_referer_url = wppb_sanitize_request_url( $_GET['wppb_referer_url'] ); | |
| 171 | 171 | } else { |
| 172 | - $wppb_referer_url = esc_url_raw ( isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '' ); | |
| 172 | + $wppb_referer_url = wppb_sanitize_request_url( isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : '' ); | |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $form = ' |
| 176 | 176 | <form name="' . esc_attr( $args['form_id'] ) . '" id="' . esc_attr( $args['form_id'] ) . '" class="' . esc_attr( $args['form_classes'] ) . '" action="'. esc_url( wppb_curpageurl() ) .'" method="post"> |
| @@ -411,9 +411,9 @@ | ||
| 411 | 411 | if( isset( $_POST['wppb_login'] ) ){ |
| 412 | 412 | if( is_wp_error( $user ) ) { |
| 413 | 413 | // if we don't have a successful login we must redirect to the url of the form, so make sure this happens |
| 414 | 414 | if( isset( $_POST['wppb_request_url'] ) ) |
| 415 | - $redirect_to = esc_url_raw( $_POST['wppb_request_url'] ); | |
| 415 | + $redirect_to = wppb_sanitize_request_url( $_POST['wppb_request_url'] ); | |
| 416 | 416 | if( isset( $_POST['wppb_form_location'] ) ) |
| 417 | 417 | $request_form_location = sanitize_text_field( $_POST['wppb_form_location'] ); |
| 418 | 418 | $error_string = $user->get_error_message(); |
| 419 | 419 | |
| @@ -422,10 +422,11 @@ | ||
| 422 | 422 | if (isset($wppb_generalSettings['loginWith'])) { |
| 423 | 423 | |
| 424 | 424 | $lost_pass_url = site_url('/wp-login.php?action=lostpassword'); |
| 425 | 425 | // if the Login shortcode has a lostpassword argument set, give the lost password error link that value |
| 426 | - if (!empty($_POST['wppb_lostpassword_url'])) { | |
| 427 | - $lost_pass_url = esc_url_raw( $_POST['wppb_lostpassword_url'] ); | |
| 426 | + $lost_pass_url_input = wppb_sanitize_request_url( $_POST['wppb_lostpassword_url'] ?? '' ); | |
| 427 | + if ( $lost_pass_url_input !== '' ) { | |
| 428 | + $lost_pass_url = $lost_pass_url_input; | |
| 428 | 429 | if ( wppb_check_missing_http( $lost_pass_url ) ) |
| 429 | 430 | $lost_pass_url = "http://" . $lost_pass_url; |
| 430 | 431 | } |
| 431 | 432 | //apply filter to allow changing Lost your Password link |
| @@ -483,10 +484,11 @@ | ||
| 483 | 484 | $error_string = apply_filters('wppb_login_wp_error_message', $error_string, $user); |
| 484 | 485 | $wppb_error_string_nonce = wp_create_nonce( 'wppb_login_error_'.$error_string ); |
| 485 | 486 | |
| 486 | 487 | // encode the error string and send it as a GET parameter |
| 487 | - if ( isset($_POST['wppb_referer_url']) && $_POST['wppb_referer_url'] !== '' ) { | |
| 488 | - $arr_params = array('loginerror' => urlencode(base64_encode($error_string)), '_wpnonce' => $wppb_error_string_nonce, 'request_form_location' => $request_form_location, 'wppb_referer_url' => urlencode(esc_url_raw( $_POST['wppb_referer_url'] ))); | |
| 488 | + $referer_url = wppb_sanitize_request_url( $_POST['wppb_referer_url'] ?? '' ); | |
| 489 | + if ( $referer_url !== '' ) { | |
| 490 | + $arr_params = array('loginerror' => urlencode(base64_encode($error_string)), '_wpnonce' => $wppb_error_string_nonce, 'request_form_location' => $request_form_location, 'wppb_referer_url' => urlencode( $referer_url )); | |
| 489 | 491 | } else { |
| 490 | 492 | $arr_params = array('loginerror' => urlencode(base64_encode($error_string)), '_wpnonce' => $wppb_error_string_nonce, 'request_form_location' => $request_form_location); |
| 491 | 493 | } |
| 492 | 494 | |
| @@ -628,9 +630,9 @@ | ||
| 628 | 630 | if( wp_verify_nonce( sanitize_text_field( $_GET['_wpnonce'] ), 'wppb_login_error_'. $error_string ) ) { |
| 629 | 631 | if ( isset( $_GET['wppb_message_type'] ) && $_GET['wppb_message_type'] == 'success' ) |
| 630 | 632 | $message_type = 'wppb-success'; |
| 631 | 633 | else $message_type = 'wppb-error'; |
| 632 | - $loginerror = '<p class="'. $message_type .'">' . wp_kses_post(str_replace( '-wppb-plus-', '+', $error_string)) . '</p><!-- .error -->'; | |
| 634 | + $loginerror = '<p class="'. $message_type .'" role="alert">' . wp_kses_post(str_replace( '-wppb-plus-', '+', $error_string)) . '</p><!-- .error -->'; | |
| 633 | 635 | if (isset($_GET['request_form_location'])) { |
| 634 | 636 | if ($_GET['request_form_location'] === 'widget' && !in_the_loop()) { |
| 635 | 637 | $login_form .= $loginerror; |
| 636 | 638 | } elseif ($_GET['request_form_location'] === 'page' && in_the_loop()) { |
| @@ -686,9 +688,9 @@ | ||
| 686 | 688 | } else { |
| 687 | 689 | $display_name = $wppb_user->user_login; |
| 688 | 690 | } |
| 689 | 691 | |
| 690 | - $logged_in_message = '<p class="wppb-alert">'; | |
| 692 | + $logged_in_message = '<p class="wppb-alert" role="alert">'; | |
| 691 | 693 | |
| 692 | 694 | // CHECK FOR REDIRECT |
| 693 | 695 | $logout_redirect_url = wppb_get_redirect_url( $redirect_priority, 'after_logout', $logout_redirect_url, $wppb_user ); |
| 694 | 696 | $logout_redirect_url = apply_filters( 'wppb_after_logout_redirect_url', $logout_redirect_url ); |