56 /** |
56 /** |
57 * Filters the error codes array for shaking the login form. |
57 * Filters the error codes array for shaking the login form. |
58 * |
58 * |
59 * @since 3.0.0 |
59 * @since 3.0.0 |
60 * |
60 * |
61 * @param array $shake_error_codes Error codes that shake the login form. |
61 * @param string[] $shake_error_codes Error codes that shake the login form. |
62 */ |
62 */ |
63 $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); |
63 $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); |
64 |
64 |
65 if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) { |
65 if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) { |
66 add_action( 'login_footer', 'wp_shake_js', 12 ); |
66 add_action( 'login_footer', 'wp_shake_js', 12 ); |
183 /** |
183 /** |
184 * Filters the login page body classes. |
184 * Filters the login page body classes. |
185 * |
185 * |
186 * @since 3.5.0 |
186 * @since 3.5.0 |
187 * |
187 * |
188 * @param array $classes An array of body classes. |
188 * @param string[] $classes An array of body classes. |
189 * @param string $action The action that brought the visitor to the login page. |
189 * @param string $action The action that brought the visitor to the login page. |
190 */ |
190 */ |
191 $classes = apply_filters( 'login_body_class', $classes, $action ); |
191 $classes = apply_filters( 'login_body_class', $classes, $action ); |
192 |
192 |
193 ?> |
193 ?> |
194 </head> |
194 </head> |
310 |
310 |
311 ?> |
311 ?> |
312 </div><?php // End of <div id="login">. ?> |
312 </div><?php // End of <div id="login">. ?> |
313 |
313 |
314 <?php |
314 <?php |
|
315 if ( |
|
316 ! $interim_login && |
|
317 /** |
|
318 * Filters the Languages select input activation on the login screen. |
|
319 * |
|
320 * @since 5.9.0 |
|
321 * |
|
322 * @param bool Whether to display the Languages select input on the login screen. |
|
323 */ |
|
324 apply_filters( 'login_display_language_dropdown', true ) |
|
325 ) { |
|
326 $languages = get_available_languages(); |
|
327 |
|
328 if ( ! empty( $languages ) ) { |
|
329 ?> |
|
330 <div class="language-switcher"> |
|
331 <form id="language-switcher" action="" method="get"> |
|
332 |
|
333 <label for="language-switcher-locales"> |
|
334 <span class="dashicons dashicons-translation" aria-hidden="true"></span> |
|
335 <span class="screen-reader-text"><?php _e( 'Language' ); ?></span> |
|
336 </label> |
|
337 |
|
338 <?php |
|
339 $args = array( |
|
340 'id' => 'language-switcher-locales', |
|
341 'name' => 'wp_lang', |
|
342 'selected' => determine_locale(), |
|
343 'show_available_translations' => false, |
|
344 'explicit_option_en_us' => true, |
|
345 'languages' => $languages, |
|
346 ); |
|
347 |
|
348 /** |
|
349 * Filters default arguments for the Languages select input on the login screen. |
|
350 * |
|
351 * @since 5.9.0 |
|
352 * |
|
353 * @param array $args Arguments for the Languages select input on the login screen. |
|
354 */ |
|
355 wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) ); |
|
356 ?> |
|
357 |
|
358 <?php if ( $interim_login ) { ?> |
|
359 <input type="hidden" name="interim-login" value="1" /> |
|
360 <?php } ?> |
|
361 |
|
362 <?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?> |
|
363 <input type="hidden" name="redirect_to" value="<?php echo esc_url_raw( $_GET['redirect_to'] ); ?>" /> |
|
364 <?php } ?> |
|
365 |
|
366 <?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?> |
|
367 <input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" /> |
|
368 <?php } ?> |
|
369 |
|
370 <input type="submit" class="button" value="<?php esc_attr_e( 'Change' ); ?>"> |
|
371 |
|
372 </form> |
|
373 </div> |
|
374 <?php } ?> |
|
375 <?php } ?> |
|
376 <?php |
315 |
377 |
316 if ( ! empty( $input_id ) ) { |
378 if ( ! empty( $input_id ) ) { |
317 ?> |
379 ?> |
318 <script type="text/javascript"> |
380 <script type="text/javascript"> |
319 try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} |
381 try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} |
417 |
479 |
418 if ( SITECOOKIEPATH !== COOKIEPATH ) { |
480 if ( SITECOOKIEPATH !== COOKIEPATH ) { |
419 setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); |
481 setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); |
420 } |
482 } |
421 |
483 |
|
484 if ( isset( $_GET['wp_lang'] ) ) { |
|
485 setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
|
486 } |
|
487 |
422 /** |
488 /** |
423 * Fires when the login form is initialized. |
489 * Fires when the login form is initialized. |
424 * |
490 * |
425 * @since 3.2.0 |
491 * @since 3.2.0 |
426 */ |
492 */ |
432 * The dynamic portion of the hook name, `$action`, refers to the action |
498 * The dynamic portion of the hook name, `$action`, refers to the action |
433 * that brought the visitor to the login form. |
499 * that brought the visitor to the login form. |
434 * |
500 * |
435 * Possible hook names include: |
501 * Possible hook names include: |
436 * |
502 * |
437 * - 'login_form_checkemail' |
503 * - `login_form_checkemail` |
438 * - 'login_form_confirm_admin_email' |
504 * - `login_form_confirm_admin_email` |
439 * - 'login_form_confirmaction' |
505 * - `login_form_confirmaction` |
440 * - 'login_form_entered_recovery_mode' |
506 * - `login_form_entered_recovery_mode` |
441 * - 'login_form_login' |
507 * - `login_form_login` |
442 * - 'login_form_logout' |
508 * - `login_form_logout` |
443 * - 'login_form_lostpassword' |
509 * - `login_form_lostpassword` |
444 * - 'login_form_postpass' |
510 * - `login_form_postpass` |
445 * - 'login_form_register' |
511 * - `login_form_register` |
446 * - 'login_form_resetpass' |
512 * - `login_form_resetpass` |
447 * - 'login_form_retrievepassword' |
513 * - `login_form_retrievepassword` |
448 * - 'login_form_rp' |
514 * - `login_form_rp` |
449 * |
515 * |
450 * @since 2.8.0 |
516 * @since 2.8.0 |
451 */ |
517 */ |
452 do_action( "login_form_{$action}" ); |
518 do_action( "login_form_{$action}" ); |
453 |
519 |
762 ?> |
828 ?> |
763 |
829 |
764 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> |
830 <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> |
765 <p> |
831 <p> |
766 <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
832 <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
767 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" /> |
833 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" /> |
768 </p> |
834 </p> |
769 <?php |
835 <?php |
770 |
836 |
771 /** |
837 /** |
772 * Fires inside the lostpassword form tags, before the hidden fields. |
838 * Fires inside the lostpassword form tags, before the hidden fields. |
839 exit; |
905 exit; |
840 } |
906 } |
841 |
907 |
842 $errors = new WP_Error(); |
908 $errors = new WP_Error(); |
843 |
909 |
844 if ( isset( $_POST['pass1'] ) && $_POST['pass1'] !== $_POST['pass2'] ) { |
910 // Check if password is one or all empty spaces. |
|
911 if ( ! empty( $_POST['pass1'] ) ) { |
|
912 $_POST['pass1'] = trim( $_POST['pass1'] ); |
|
913 |
|
914 if ( empty( $_POST['pass1'] ) ) { |
|
915 $errors->add( 'password_reset_empty_space', __( 'The password cannot be a space or all spaces.' ) ); |
|
916 } |
|
917 } |
|
918 |
|
919 // Check if password fields do not match. |
|
920 if ( ! empty( $_POST['pass1'] ) && trim( $_POST['pass2'] ) !== $_POST['pass1'] ) { |
845 $errors->add( 'password_reset_mismatch', __( '<strong>Error</strong>: The passwords do not match.' ) ); |
921 $errors->add( 'password_reset_mismatch', __( '<strong>Error</strong>: The passwords do not match.' ) ); |
846 } |
922 } |
847 |
923 |
848 /** |
924 /** |
849 * Fires before the password reset procedure is validated. |
925 * Fires before the password reset procedure is validated. |
876 <p> |
952 <p> |
877 <label for="pass1"><?php _e( 'New password' ); ?></label> |
953 <label for="pass1"><?php _e( 'New password' ); ?></label> |
878 </p> |
954 </p> |
879 |
955 |
880 <div class="wp-pwd"> |
956 <div class="wp-pwd"> |
881 <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="off" aria-describedby="pass-strength-result" /> |
957 <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="new-password" aria-describedby="pass-strength-result" /> |
882 |
958 |
883 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
959 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
884 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> |
960 <span class="dashicons dashicons-hidden" aria-hidden="true"></span> |
885 </button> |
961 </button> |
886 <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> |
962 <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> |
911 do_action( 'resetpass_form', $user ); |
987 do_action( 'resetpass_form', $user ); |
912 |
988 |
913 ?> |
989 ?> |
914 <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> |
990 <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> |
915 <p class="submit reset-pass-submit"> |
991 <p class="submit reset-pass-submit"> |
916 <button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="true"><?php _e( 'Generate Password' ); ?></button> |
992 <button type="button" class="button wp-generate-pw hide-if-no-js skip-aria-expanded"><?php _e( 'Generate Password' ); ?></button> |
917 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" /> |
993 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" /> |
918 </p> |
994 </p> |
919 </form> |
995 </form> |
920 |
996 |
921 <p id="nav"> |
997 <p id="nav"> |
981 |
1057 |
982 /** |
1058 /** |
983 * Filters the registration redirect URL. |
1059 * Filters the registration redirect URL. |
984 * |
1060 * |
985 * @since 3.0.0 |
1061 * @since 3.0.0 |
986 * |
1062 * @since 5.9.0 Added the `$errors` parameter. |
987 * @param string $registration_redirect The redirect destination URL. |
1063 * |
|
1064 * @param string $registration_redirect The redirect destination URL. |
|
1065 * @param int|WP_Error $errors User id if registration was successful, |
|
1066 * WP_Error object otherwise. |
988 */ |
1067 */ |
989 $redirect_to = apply_filters( 'registration_redirect', $registration_redirect ); |
1068 $redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors ); |
990 |
1069 |
991 login_header( __( 'Registration Form' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $errors ); |
1070 login_header( __( 'Registration Form' ), '<p class="message register">' . __( 'Register For This Site' ) . '</p>', $errors ); |
992 |
1071 |
993 ?> |
1072 ?> |
994 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> |
1073 <form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> |
995 <p> |
1074 <p> |
996 <label for="user_login"><?php _e( 'Username' ); ?></label> |
1075 <label for="user_login"><?php _e( 'Username' ); ?></label> |
997 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" /> |
1076 <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( wp_unslash( $user_login ) ); ?>" size="20" autocapitalize="off" autocomplete="username" /> |
998 </p> |
1077 </p> |
999 <p> |
1078 <p> |
1000 <label for="user_email"><?php _e( 'Email' ); ?></label> |
1079 <label for="user_email"><?php _e( 'Email' ); ?></label> |
1001 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /> |
1080 <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" autocomplete="email" /> |
1002 </p> |
1081 </p> |
1003 <?php |
1082 <?php |
1004 |
1083 |
1005 /** |
1084 /** |
1006 * Fires following the 'Email' field in the user registration form. |
1085 * Fires following the 'Email' field in the user registration form. |
1205 |
1284 |
1206 // Check if it is time to add a redirect to the admin email confirmation screen. |
1285 // Check if it is time to add a redirect to the admin email confirmation screen. |
1207 if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) { |
1286 if ( is_a( $user, 'WP_User' ) && $user->exists() && $user->has_cap( 'manage_options' ) ) { |
1208 $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); |
1287 $admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); |
1209 |
1288 |
1210 // If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected |
1289 /* |
1211 // to the admin email confirmation screen. |
1290 * If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected |
|
1291 * to the admin email confirmation screen. |
|
1292 */ |
1212 /** This filter is documented in wp-login.php */ |
1293 /** This filter is documented in wp-login.php */ |
1213 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); |
1294 $admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); |
1214 |
1295 |
1215 if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) { |
1296 if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) { |
1216 $redirect_to = add_query_arg( |
1297 $redirect_to = add_query_arg( |
1265 $errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
1346 $errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
1266 } elseif ( WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED === $action ) { |
1347 } elseif ( WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED === $action ) { |
1267 $errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' ); |
1348 $errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' ); |
1268 } elseif ( isset( $_GET['redirect_to'] ) && false !== strpos( $_GET['redirect_to'], 'wp-admin/authorize-application.php' ) ) { |
1349 } elseif ( isset( $_GET['redirect_to'] ) && false !== strpos( $_GET['redirect_to'], 'wp-admin/authorize-application.php' ) ) { |
1269 $query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY ); |
1350 $query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY ); |
1270 parse_str( $query_component, $query ); |
1351 $query = array(); |
|
1352 if ( $query_component ) { |
|
1353 parse_str( $query_component, $query ); |
|
1354 } |
1271 |
1355 |
1272 if ( ! empty( $query['app_name'] ) ) { |
1356 if ( ! empty( $query['app_name'] ) ) { |
1273 /* translators: 1: Website name, 2: Application name. */ |
1357 /* translators: 1: Website name, 2: Application name. */ |
1274 $message = sprintf( 'Please log in to %1$s to authorize %2$s to connect to your account.', get_bloginfo( 'name', 'display' ), '<strong>' . esc_html( $query['app_name'] ) . '</strong>' ); |
1358 $message = sprintf( 'Please log in to %1$s to authorize %2$s to connect to your account.', get_bloginfo( 'name', 'display' ), '<strong>' . esc_html( $query['app_name'] ) . '</strong>' ); |
1275 } else { |
1359 } else { |
1314 ?> |
1398 ?> |
1315 |
1399 |
1316 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> |
1400 <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> |
1317 <p> |
1401 <p> |
1318 <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
1402 <label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
1319 <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" /> |
1403 <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" autocomplete="username" /> |
1320 </p> |
1404 </p> |
1321 |
1405 |
1322 <div class="user-pass-wrap"> |
1406 <div class="user-pass-wrap"> |
1323 <label for="user_pass"><?php _e( 'Password' ); ?></label> |
1407 <label for="user_pass"><?php _e( 'Password' ); ?></label> |
1324 <div class="wp-pwd"> |
1408 <div class="wp-pwd"> |
1325 <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input password-input" value="" size="20" /> |
1409 <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input password-input" value="" size="20" autocomplete="current-password" /> |
1326 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>"> |
1410 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Show password' ); ?>"> |
1327 <span class="dashicons dashicons-visibility" aria-hidden="true"></span> |
1411 <span class="dashicons dashicons-visibility" aria-hidden="true"></span> |
1328 </button> |
1412 </button> |
1329 </div> |
1413 </div> |
1330 </div> |
1414 </div> |