diff --git a/src/wp-login.php b/src/wp-login.php
index 5f1e8bc10d..e119d37c2c 100644
|
a
|
b
|
function login_footer( $input_id = '' ) { |
| 286 | 286 | <?php |
| 287 | 287 | $html_link = sprintf( |
| 288 | 288 | '<a href="%s">%s</a>', |
| 289 | | esc_url( home_url( '/' ) ), |
| | 289 | esc_url( maybe_add_wp_lang_query_arg( home_url( '/' ) ) ), |
| 290 | 290 | sprintf( |
| 291 | 291 | /* translators: %s: Site title. */ |
| 292 | 292 | _x( '← Go to %s', 'site' ), |
| … |
… |
switch ( $action ) { |
| 472 | 472 | * However this action runs on a redirect after logging in. |
| 473 | 473 | */ |
| 474 | 474 | if ( ! is_user_logged_in() ) { |
| 475 | | wp_safe_redirect( wp_login_url() ); |
| | 475 | wp_safe_redirect( maybe_add_wp_lang_query_arg( wp_login_url() ) ); |
| 476 | 476 | exit; |
| 477 | 477 | } |
| 478 | 478 | |
| … |
… |
switch ( $action ) { |
| 485 | 485 | if ( current_user_can( 'manage_options' ) ) { |
| 486 | 486 | $admin_email = get_option( 'admin_email' ); |
| 487 | 487 | } else { |
| 488 | | wp_safe_redirect( $redirect_to ); |
| | 488 | wp_safe_redirect( maybe_add_wp_lang_query_arg( $redirect_to ) ); |
| 489 | 489 | exit; |
| 490 | 490 | } |
| 491 | 491 | |
| … |
… |
switch ( $action ) { |
| 502 | 502 | |
| 503 | 503 | if ( ! empty( $_GET['remind_me_later'] ) ) { |
| 504 | 504 | if ( ! wp_verify_nonce( $_GET['remind_me_later'], 'remind_me_later_nonce' ) ) { |
| 505 | | wp_safe_redirect( wp_login_url() ); |
| | 505 | wp_safe_redirect( maybe_add_wp_lang_query_arg( wp_login_url() ) ); |
| 506 | 506 | exit; |
| 507 | 507 | } |
| 508 | 508 | |
| … |
… |
switch ( $action ) { |
| 510 | 510 | update_option( 'admin_email_lifespan', time() + $remind_interval ); |
| 511 | 511 | } |
| 512 | 512 | |
| 513 | | $redirect_to = add_query_arg( 'admin_email_remind_later', 1, $redirect_to ); |
| | 513 | $redirect_to = maybe_add_wp_lang_query_arg( add_query_arg( 'admin_email_remind_later', 1, $redirect_to ) ); |
| 514 | 514 | wp_safe_redirect( $redirect_to ); |
| 515 | 515 | exit; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | if ( ! empty( $_POST['correct-admin-email'] ) ) { |
| 519 | 519 | if ( ! check_admin_referer( 'confirm_admin_email', 'confirm_admin_email_nonce' ) ) { |
| 520 | | wp_safe_redirect( wp_login_url() ); |
| | 520 | wp_safe_redirect( maybe_add_wp_lang_query_arg( wp_login_url() ) ); |
| 521 | 521 | exit; |
| 522 | 522 | } |
| 523 | 523 | |
| … |
… |
switch ( $action ) { |
| 536 | 536 | update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); |
| 537 | 537 | } |
| 538 | 538 | |
| 539 | | wp_safe_redirect( $redirect_to ); |
| | 539 | wp_safe_redirect( maybe_add_wp_lang_query_arg( $redirect_to ) ); |
| 540 | 540 | exit; |
| 541 | 541 | } |
| 542 | 542 | |
| … |
… |
switch ( $action ) { |
| 554 | 554 | |
| 555 | 555 | ?> |
| 556 | 556 | |
| 557 | | <form class="admin-email-confirm-form" name="admin-email-confirm-form" action="<?php echo esc_url( site_url( 'wp-login.php?action=confirm_admin_email', 'login_post' ) ); ?>" method="post"> |
| | 557 | <form class="admin-email-confirm-form" name="admin-email-confirm-form" action="<?php echo esc_url( maybe_add_wp_lang_query_arg( site_url( 'wp-login.php?action=confirm_admin_email', 'login_post' ) ) ); ?>" method="post"> |
| 558 | 558 | <?php |
| 559 | 559 | /** |
| 560 | 560 | * Fires inside the admin-email-confirm-form form tags, before the hidden fields. |
| … |
… |
switch ( $action ) { |
| 566 | 566 | wp_nonce_field( 'confirm_admin_email', 'confirm_admin_email_nonce' ); |
| 567 | 567 | |
| 568 | 568 | ?> |
| 569 | | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
| | 569 | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( maybe_add_wp_lang_query_arg( $redirect_to ) ); ?>" /> |
| 570 | 570 | |
| 571 | 571 | <h1 class="admin-email__heading"> |
| 572 | 572 | <?php _e( 'Administration email verification' ); ?> |
| … |
… |
switch ( $action ) { |
| 630 | 630 | ); |
| 631 | 631 | |
| 632 | 632 | ?> |
| 633 | | <a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ); ?></a> |
| | 633 | <a href="<?php echo esc_url( maybe_add_wp_lang_query_arg( $remind_me_link ) ); ?>"><?php _e( 'Remind me later' ); ?></a> |
| 634 | 634 | </div> |
| 635 | 635 | <?php endif; ?> |
| 636 | 636 | </div> |
| … |
… |
switch ( $action ) { |
| 707 | 707 | */ |
| 708 | 708 | $redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); |
| 709 | 709 | |
| 710 | | wp_safe_redirect( $redirect_to ); |
| | 710 | wp_safe_redirect( maybe_add_wp_lang_query_arg( $redirect_to ) ); |
| 711 | 711 | exit; |
| 712 | 712 | |
| 713 | 713 | case 'lostpassword': |
| … |
… |
switch ( $action ) { |
| 717 | 717 | |
| 718 | 718 | if ( ! is_wp_error( $errors ) ) { |
| 719 | 719 | $redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; |
| 720 | | wp_safe_redirect( $redirect_to ); |
| | 720 | wp_safe_redirect( maybe_add_wp_lang_query_arg( $redirect_to ) ); |
| 721 | 721 | exit; |
| 722 | 722 | } |
| 723 | 723 | } |
| … |
… |
switch ( $action ) { |
| 759 | 759 | $user_login = wp_unslash( $_POST['user_login'] ); |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | | $action_url = network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ); |
| 763 | | $login_url = wp_login_url(); |
| 764 | | $wp_registration_url = wp_registration_url(); |
| 765 | | |
| 766 | | if ( ! empty( $_GET['wp_lang'] ) ) { |
| 767 | | $wp_lang = sanitize_text_field( $_GET['wp_lang'] ); |
| 768 | | |
| 769 | | $action_url = add_query_arg( 'wp_lang', $wp_lang, $action_url ); |
| 770 | | $login_url = add_query_arg( 'wp_lang', $wp_lang, $login_url ); |
| 771 | | $wp_registration_url = add_query_arg( 'wp_lang', $wp_lang, $wp_registration_url ); |
| 772 | | } |
| | 762 | $action_url = maybe_add_wp_lang_query_arg( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); |
| | 763 | $login_url = maybe_add_wp_lang_query_arg( wp_login_url() ); |
| | 764 | $wp_registration_url = maybe_add_wp_lang_query_arg( wp_registration_url() ); |
| 773 | 765 | |
| 774 | 766 | ?> |
| 775 | 767 | |
| … |
… |
switch ( $action ) { |
| 788 | 780 | do_action( 'lostpassword_form' ); |
| 789 | 781 | |
| 790 | 782 | ?> |
| 791 | | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
| | 783 | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( maybe_add_wp_lang_query_arg( $redirect_to ) ); ?>" /> |
| 792 | 784 | <p class="submit"> |
| 793 | 785 | <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" /> |
| 794 | 786 | </p> |
| … |
… |
switch ( $action ) { |
| 880 | 872 | |
| 881 | 873 | login_header( __( 'Reset Password' ), '<p class="message reset-pass">' . __( 'Enter your new password below or generate one.' ) . '</p>', $errors ); |
| 882 | 874 | |
| | 875 | $action_url = maybe_add_wp_lang_query_arg( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); |
| 883 | 876 | ?> |
| 884 | | <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> |
| | 877 | <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( $action_url ); ?>" method="post" autocomplete="off"> |
| 885 | 878 | <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> |
| 886 | 879 | |
| 887 | 880 | <div class="user-pass1-wrap"> |
| … |
… |
switch ( $action ) { |
| 935 | 928 | <?php |
| 936 | 929 | |
| 937 | 930 | if ( get_option( 'users_can_register' ) ) { |
| 938 | | $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
| | 931 | $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( maybe_add_wp_lang_query_arg( wp_registration_url() ) ), __( 'Register' ) ); |
| 939 | 932 | |
| 940 | 933 | echo esc_html( $login_link_separator ); |
| 941 | 934 | |
| … |
… |
switch ( $action ) { |
| 964 | 957 | } |
| 965 | 958 | |
| 966 | 959 | if ( ! get_option( 'users_can_register' ) ) { |
| 967 | | wp_redirect( site_url( 'wp-login.php?registration=disabled' ) ); |
| | 960 | wp_redirect( maybe_add_wp_lang_query_arg( site_url( 'wp-login.php?registration=disabled' ) ) ); |
| 968 | 961 | exit; |
| 969 | 962 | } |
| 970 | 963 | |
| … |
… |
switch ( $action ) { |
| 984 | 977 | |
| 985 | 978 | if ( ! is_wp_error( $errors ) ) { |
| 986 | 979 | $redirect_to = ! empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; |
| 987 | | wp_safe_redirect( $redirect_to ); |
| | 980 | wp_safe_redirect( maybe_add_wp_lang_query_arg( $redirect_to ) ); |
| 988 | 981 | exit; |
| 989 | 982 | } |
| 990 | 983 | } |
| … |
… |
switch ( $action ) { |
| 1003 | 996 | login_header( __( 'Registration Form' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $errors ); |
| 1004 | 997 | |
| 1005 | 998 | ?> |
| 1006 | | <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> |
| | 999 | <form name="registerform" id="registerform" action="<?php echo esc_url( maybe_add_wp_lang_query_arg( site_url( 'wp-login.php?action=register', 'login_post' ) ) ); ?>" method="post" novalidate="novalidate"> |
| 1007 | 1000 | <p> |
| 1008 | 1001 | <label for="user_login"><?php _e( 'Username' ); ?></label> |
| 1009 | 1002 | <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" /> |
| … |
… |
switch ( $action ) { |
| 1026 | 1019 | <?php _e( 'Registration confirmation will be emailed to you.' ); ?> |
| 1027 | 1020 | </p> |
| 1028 | 1021 | <br class="clear" /> |
| 1029 | | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
| | 1022 | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( maybe_add_wp_lang_query_arg( $redirect_to ) ); ?>" /> |
| 1030 | 1023 | <p class="submit"> |
| 1031 | 1024 | <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" /> |
| 1032 | 1025 | </p> |
| 1033 | 1026 | </form> |
| 1034 | 1027 | |
| | 1028 | <?php |
| | 1029 | $login_url = maybe_add_wp_lang_query_arg( wp_login_url() ); |
| | 1030 | $lostpassword_url = maybe_add_wp_lang_query_arg( wp_lostpassword_url() ); |
| | 1031 | ?> |
| | 1032 | |
| 1035 | 1033 | <p id="nav"> |
| 1036 | | <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
| | 1034 | <a href="<?php echo esc_url( $login_url ); ?>"><?php _e( 'Log in' ); ?></a> |
| 1037 | 1035 | <?php echo esc_html( $login_link_separator ); ?> |
| 1038 | | <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
| | 1036 | <a href="<?php echo esc_url( $lostpassword_url ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
| 1039 | 1037 | </p> |
| 1040 | 1038 | <?php |
| 1041 | 1039 | |
| … |
… |
switch ( $action ) { |
| 1052 | 1050 | sprintf( |
| 1053 | 1051 | /* translators: %s: Link to the login page. */ |
| 1054 | 1052 | __( 'Check your email for the confirmation link, then visit the <a href="%s">login page</a>.' ), |
| 1055 | | wp_login_url() |
| | 1053 | maybe_add_wp_lang_query_arg( wp_login_url() ) |
| 1056 | 1054 | ), |
| 1057 | 1055 | 'message' |
| 1058 | 1056 | ); |
| … |
… |
switch ( $action ) { |
| 1062 | 1060 | sprintf( |
| 1063 | 1061 | /* translators: %s: Link to the login page. */ |
| 1064 | 1062 | __( 'Registration complete. Please check your email, then visit the <a href="%s">login page</a>.' ), |
| 1065 | | wp_login_url() |
| | 1063 | maybe_add_wp_lang_query_arg( wp_login_url() ) |
| 1066 | 1064 | ), |
| 1067 | 1065 | 'message' |
| 1068 | 1066 | ); |
| … |
… |
switch ( $action ) { |
| 1245 | 1243 | $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); |
| 1246 | 1244 | } |
| 1247 | 1245 | |
| 1248 | | wp_redirect( $redirect_to ); |
| | 1246 | wp_redirect( maybe_add_wp_lang_query_arg( $redirect_to ) ); |
| 1249 | 1247 | exit; |
| 1250 | 1248 | } |
| 1251 | 1249 | |
| 1252 | | wp_safe_redirect( $redirect_to ); |
| | 1250 | wp_safe_redirect( maybe_add_wp_lang_query_arg( $redirect_to ) ); |
| 1253 | 1251 | exit; |
| 1254 | 1252 | } |
| 1255 | 1253 | |
| … |
… |
switch ( $action ) { |
| 1325 | 1323 | wp_enqueue_script( 'user-profile' ); |
| 1326 | 1324 | ?> |
| 1327 | 1325 | |
| 1328 | | <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> |
| | 1326 | <form name="loginform" id="loginform" action="<?php echo esc_url( maybe_add_wp_lang_query_arg( site_url( 'wp-login.php', 'login_post' ) ) ); ?>" method="post"> |
| 1329 | 1327 | <p> |
| 1330 | 1328 | <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
| 1331 | 1329 | <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /> |
| … |
… |
switch ( $action ) { |
| 1361 | 1359 | <?php |
| 1362 | 1360 | } else { |
| 1363 | 1361 | ?> |
| 1364 | | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
| | 1362 | <input type="hidden" name="redirect_to" value="<?php echo esc_attr( maybe_add_wp_lang_query_arg( $redirect_to ) ); ?>" /> |
| 1365 | 1363 | <?php |
| 1366 | 1364 | } |
| 1367 | 1365 | |
| … |
… |
switch ( $action ) { |
| 1383 | 1381 | <p id="nav"> |
| 1384 | 1382 | <?php |
| 1385 | 1383 | |
| | 1384 | $wp_registration_url = maybe_add_wp_lang_query_arg( wp_registration_url() ); |
| | 1385 | $lostpassword_url = maybe_add_wp_lang_query_arg( wp_lostpassword_url() ); |
| | 1386 | |
| 1386 | 1387 | if ( get_option( 'users_can_register' ) ) { |
| 1387 | | $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
| | 1388 | $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( $wp_registration_url ), __( 'Register' ) ); |
| 1388 | 1389 | |
| 1389 | 1390 | /** This filter is documented in wp-includes/general-template.php */ |
| 1390 | 1391 | echo apply_filters( 'register', $registration_url ); |
| … |
… |
switch ( $action ) { |
| 1393 | 1394 | } |
| 1394 | 1395 | |
| 1395 | 1396 | ?> |
| 1396 | | <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
| | 1397 | <a href="<?php echo esc_url( $lostpassword_url ); ?>"><?php _e( 'Lost your password?' ); ?></a> |
| 1397 | 1398 | </p> |
| 1398 | 1399 | <?php |
| 1399 | 1400 | } |
| … |
… |
switch ( $action ) { |
| 1458 | 1459 | login_footer(); |
| 1459 | 1460 | break; |
| 1460 | 1461 | } // End action switch. |
| | 1462 | |
| | 1463 | /** |
| | 1464 | * Add wp_lang query arg in the url if its exists on the GET param. |
| | 1465 | * |
| | 1466 | * @param string $url URL of the specific page. |
| | 1467 | * |
| | 1468 | * @since 5.8.0 |
| | 1469 | * |
| | 1470 | * @return string; |
| | 1471 | */ |
| | 1472 | function maybe_add_wp_lang_query_arg( $url ) { |
| | 1473 | if ( ! empty( $_GET['wp_lang'] ) && ! empty( $url ) ) { |
| | 1474 | $wp_lang = sanitize_text_field( $_GET['wp_lang'] ); |
| | 1475 | |
| | 1476 | $url = add_query_arg( 'wp_lang', $wp_lang, $url ); |
| | 1477 | } |
| | 1478 | |
| | 1479 | return $url; |
| | 1480 | } |