author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 19 | 3d72ae0968f4 |
child 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
0 | 1 |
<?php |
2 |
/** |
|
3 |
* WordPress User Page |
|
4 |
* |
|
5 |
* Handles authentication, registering, resetting passwords, forgot password, |
|
6 |
* and other user handling. |
|
7 |
* |
|
8 |
* @package WordPress |
|
9 |
*/ |
|
10 |
||
11 |
/** Make sure that the WordPress bootstrap has run before continuing. */ |
|
16 | 12 |
require __DIR__ . '/wp-load.php'; |
0 | 13 |
|
9 | 14 |
// Redirect to HTTPS login if forced to use SSL. |
0 | 15 |
if ( force_ssl_admin() && ! is_ssl() ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
16 |
if ( str_starts_with( $_SERVER['REQUEST_URI'], 'http' ) ) { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
17 |
wp_safe_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) ); |
16 | 18 |
exit; |
0 | 19 |
} else { |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
20 |
wp_safe_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); |
16 | 21 |
exit; |
0 | 22 |
} |
23 |
} |
|
24 |
||
25 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
26 |
* Outputs the login page header. |
0 | 27 |
* |
9 | 28 |
* @since 2.1.0 |
29 |
* |
|
16 | 30 |
* @global string $error Login error message set by deprecated pluggable wp_login() function |
31 |
* or plugins replacing it. |
|
32 |
* @global bool|string $interim_login Whether interim login modal is being displayed. String 'success' |
|
33 |
* upon successful login. |
|
34 |
* @global string $action The action that brought the visitor to the login page. |
|
35 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
36 |
* @param string|null $title Optional. WordPress login page title to display in the `<title>` element. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
37 |
* Defaults to 'Log In'. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
38 |
* @param string $message Optional. Message to display in header. Default empty. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
39 |
* @param WP_Error|null $wp_error Optional. The error to pass. Defaults to a WP_Error instance. |
0 | 40 |
*/ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
41 |
function login_header( $title = null, $message = '', $wp_error = null ) { |
5 | 42 |
global $error, $interim_login, $action; |
0 | 43 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
44 |
if ( null === $title ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
45 |
$title = __( 'Log In' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
46 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
47 |
|
16 | 48 |
// Don't index any of these forms. |
18 | 49 |
add_filter( 'wp_robots', 'wp_robots_sensitive_page' ); |
50 |
add_action( 'login_head', 'wp_strict_cross_origin_referrer' ); |
|
0 | 51 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
52 |
add_action( 'login_head', 'wp_login_viewport_meta' ); |
0 | 53 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
54 |
if ( ! is_wp_error( $wp_error ) ) { |
0 | 55 |
$wp_error = new WP_Error(); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
56 |
} |
0 | 57 |
|
58 |
// Shake it! |
|
16 | 59 |
$shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password', 'retrieve_password_email_failure' ); |
0 | 60 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
61 |
* Filters the error codes array for shaking the login form. |
0 | 62 |
* |
63 |
* @since 3.0.0 |
|
64 |
* |
|
19 | 65 |
* @param string[] $shake_error_codes Error codes that shake the login form. |
0 | 66 |
*/ |
67 |
$shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes ); |
|
68 |
||
16 | 69 |
if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code(), $shake_error_codes, true ) ) { |
70 |
add_action( 'login_footer', 'wp_shake_js', 12 ); |
|
9 | 71 |
} |
0 | 72 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
73 |
$login_title = get_bloginfo( 'name', 'display' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
74 |
|
16 | 75 |
/* translators: Login screen title. 1: Login screen name, 2: Network or site name. */ |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
76 |
$login_title = sprintf( __( '%1$s ‹ %2$s — WordPress' ), $title, $login_title ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
77 |
|
9 | 78 |
if ( wp_is_recovery_mode() ) { |
79 |
/* translators: %s: Login screen title. */ |
|
80 |
$login_title = sprintf( __( 'Recovery Mode — %s' ), $login_title ); |
|
81 |
} |
|
82 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
83 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
84 |
* Filters the title tag content for login page. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
85 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
86 |
* @since 4.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
87 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
88 |
* @param string $login_title The page title, with extra context added. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
89 |
* @param string $title The original page title. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
90 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
91 |
$login_title = apply_filters( 'login_title', $login_title, $title ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
92 |
|
0 | 93 |
?><!DOCTYPE html> |
16 | 94 |
<html <?php language_attributes(); ?>> |
0 | 95 |
<head> |
9 | 96 |
<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php bloginfo( 'charset' ); ?>" /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
97 |
<title><?php echo $login_title; ?></title> |
0 | 98 |
<?php |
99 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
100 |
wp_enqueue_style( 'login' ); |
0 | 101 |
|
5 | 102 |
/* |
103 |
* Remove all stored post data on logging out. |
|
104 |
* This could be added by add_action('login_head'...) like wp_shake_js(), |
|
9 | 105 |
* but maybe better if it's not removable by plugins. |
5 | 106 |
*/ |
16 | 107 |
if ( 'loggedout' === $wp_error->get_error_code() ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
108 |
ob_start(); |
0 | 109 |
?> |
110 |
<script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script> |
|
111 |
<?php |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
112 |
wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); |
0 | 113 |
} |
114 |
||
115 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
116 |
* Enqueues scripts and styles for the login page. |
0 | 117 |
* |
118 |
* @since 3.1.0 |
|
119 |
*/ |
|
120 |
do_action( 'login_enqueue_scripts' ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
121 |
|
0 | 122 |
/** |
123 |
* Fires in the login page header after scripts are enqueued. |
|
124 |
* |
|
125 |
* @since 2.1.0 |
|
126 |
*/ |
|
127 |
do_action( 'login_head' ); |
|
128 |
||
9 | 129 |
$login_header_url = __( 'https://wordpress.org/' ); |
0 | 130 |
|
131 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
132 |
* Filters link URL of the header logo above login form. |
0 | 133 |
* |
134 |
* @since 2.1.0 |
|
135 |
* |
|
136 |
* @param string $login_header_url Login header logo URL. |
|
137 |
*/ |
|
138 |
$login_header_url = apply_filters( 'login_headerurl', $login_header_url ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
139 |
|
9 | 140 |
$login_header_title = ''; |
141 |
||
0 | 142 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
143 |
* Filters the title attribute of the header logo above login form. |
0 | 144 |
* |
145 |
* @since 2.1.0 |
|
16 | 146 |
* @deprecated 5.2.0 Use {@see 'login_headertext'} instead. |
0 | 147 |
* |
148 |
* @param string $login_header_title Login header logo title attribute. |
|
149 |
*/ |
|
9 | 150 |
$login_header_title = apply_filters_deprecated( |
151 |
'login_headertitle', |
|
152 |
array( $login_header_title ), |
|
153 |
'5.2.0', |
|
154 |
'login_headertext', |
|
155 |
__( 'Usage of the title attribute on the login logo is not recommended for accessibility reasons. Use the link text instead.' ) |
|
156 |
); |
|
0 | 157 |
|
9 | 158 |
$login_header_text = empty( $login_header_title ) ? __( 'Powered by WordPress' ) : $login_header_title; |
159 |
||
160 |
/** |
|
161 |
* Filters the link text of the header logo above the login form. |
|
162 |
* |
|
163 |
* @since 5.2.0 |
|
164 |
* |
|
165 |
* @param string $login_header_text The login header logo link text. |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
166 |
*/ |
9 | 167 |
$login_header_text = apply_filters( 'login_headertext', $login_header_text ); |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
168 |
|
0 | 169 |
$classes = array( 'login-action-' . $action, 'wp-core-ui' ); |
16 | 170 |
|
9 | 171 |
if ( is_rtl() ) { |
0 | 172 |
$classes[] = 'rtl'; |
9 | 173 |
} |
16 | 174 |
|
0 | 175 |
if ( $interim_login ) { |
176 |
$classes[] = 'interim-login'; |
|
16 | 177 |
|
0 | 178 |
?> |
179 |
<style type="text/css">html{background-color: transparent;}</style> |
|
180 |
<?php |
|
181 |
||
9 | 182 |
if ( 'success' === $interim_login ) { |
0 | 183 |
$classes[] = 'interim-login-success'; |
9 | 184 |
} |
0 | 185 |
} |
16 | 186 |
|
9 | 187 |
$classes[] = ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) ); |
0 | 188 |
|
189 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
190 |
* Filters the login page body classes. |
0 | 191 |
* |
192 |
* @since 3.5.0 |
|
193 |
* |
|
19 | 194 |
* @param string[] $classes An array of body classes. |
195 |
* @param string $action The action that brought the visitor to the login page. |
|
0 | 196 |
*/ |
197 |
$classes = apply_filters( 'login_body_class', $classes, $action ); |
|
198 |
||
199 |
?> |
|
200 |
</head> |
|
16 | 201 |
<body class="login no-js <?php echo esc_attr( implode( ' ', $classes ) ); ?>"> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
202 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
203 |
wp_print_inline_script_tag( "document.body.className = document.body.className.replace('no-js','js');" ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
204 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
205 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
206 |
<?php |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
207 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
208 |
* Fires in the login page header after the body tag is opened. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
209 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
210 |
* @since 4.6.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
211 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
212 |
do_action( 'login_header' ); |
16 | 213 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
214 |
?> |
0 | 215 |
<div id="login"> |
9 | 216 |
<h1><a href="<?php echo esc_url( $login_header_url ); ?>"><?php echo $login_header_text; ?></a></h1> |
0 | 217 |
<?php |
218 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
219 |
* Filters the message to display above the login form. |
0 | 220 |
* |
221 |
* @since 2.1.0 |
|
222 |
* |
|
223 |
* @param string $message Login message text. |
|
224 |
*/ |
|
225 |
$message = apply_filters( 'login_message', $message ); |
|
16 | 226 |
|
9 | 227 |
if ( ! empty( $message ) ) { |
0 | 228 |
echo $message . "\n"; |
229 |
} |
|
230 |
||
9 | 231 |
// In case a plugin uses $error rather than the $wp_errors object. |
232 |
if ( ! empty( $error ) ) { |
|
233 |
$wp_error->add( 'error', $error ); |
|
234 |
unset( $error ); |
|
235 |
} |
|
236 |
||
237 |
if ( $wp_error->has_errors() ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
238 |
$error_list = array(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
239 |
$messages = ''; |
16 | 240 |
|
0 | 241 |
foreach ( $wp_error->get_error_codes() as $code ) { |
5 | 242 |
$severity = $wp_error->get_error_data( $code ); |
243 |
foreach ( $wp_error->get_error_messages( $code ) as $error_message ) { |
|
16 | 244 |
if ( 'message' === $severity ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
245 |
$messages .= '<p>' . $error_message . '</p>'; |
9 | 246 |
} else { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
247 |
$error_list[] = $error_message; |
9 | 248 |
} |
0 | 249 |
} |
250 |
} |
|
16 | 251 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
252 |
if ( ! empty( $error_list ) ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
253 |
$errors = ''; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
254 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
255 |
if ( count( $error_list ) > 1 ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
256 |
$errors .= '<ul class="login-error-list">'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
257 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
258 |
foreach ( $error_list as $item ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
259 |
$errors .= '<li>' . $item . '</li>'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
260 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
261 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
262 |
$errors .= '</ul>'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
263 |
} else { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
264 |
$errors .= '<p>' . $error_list[0] . '</p>'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
265 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
266 |
|
0 | 267 |
/** |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
268 |
* Filters the error messages displayed above the login form. |
0 | 269 |
* |
270 |
* @since 2.1.0 |
|
271 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
272 |
* @param string $errors Login error messages. |
0 | 273 |
*/ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
274 |
$errors = apply_filters( 'login_errors', $errors ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
275 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
276 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
277 |
$errors, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
278 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
279 |
'type' => 'error', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
280 |
'id' => 'login_error', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
281 |
'paragraph_wrap' => false, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
282 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
283 |
); |
0 | 284 |
} |
16 | 285 |
|
0 | 286 |
if ( ! empty( $messages ) ) { |
287 |
/** |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
288 |
* Filters instructional messages displayed above the login form. |
0 | 289 |
* |
290 |
* @since 2.5.0 |
|
291 |
* |
|
292 |
* @param string $messages Login messages. |
|
293 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
294 |
$messages = apply_filters( 'login_messages', $messages ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
295 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
296 |
wp_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
297 |
$messages, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
298 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
299 |
'type' => 'info', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
300 |
'id' => 'login-message', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
301 |
'additional_classes' => array( 'message' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
302 |
'paragraph_wrap' => false, |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
303 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
304 |
); |
0 | 305 |
} |
306 |
} |
|
16 | 307 |
} // End of login_header(). |
0 | 308 |
|
309 |
/** |
|
310 |
* Outputs the footer for the login page. |
|
311 |
* |
|
9 | 312 |
* @since 3.1.0 |
313 |
* |
|
16 | 314 |
* @global bool|string $interim_login Whether interim login modal is being displayed. String 'success' |
315 |
* upon successful login. |
|
316 |
* |
|
9 | 317 |
* @param string $input_id Which input to auto-focus. |
0 | 318 |
*/ |
9 | 319 |
function login_footer( $input_id = '' ) { |
0 | 320 |
global $interim_login; |
321 |
||
322 |
// Don't allow interim logins to navigate away from the page. |
|
16 | 323 |
if ( ! $interim_login ) { |
9 | 324 |
?> |
18 | 325 |
<p id="backtoblog"> |
326 |
<?php |
|
327 |
$html_link = sprintf( |
|
328 |
'<a href="%s">%s</a>', |
|
329 |
esc_url( home_url( '/' ) ), |
|
330 |
sprintf( |
|
331 |
/* translators: %s: Site title. */ |
|
332 |
_x( '← Go to %s', 'site' ), |
|
333 |
get_bloginfo( 'title', 'display' ) |
|
334 |
) |
|
335 |
); |
|
336 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
337 |
* Filters the "Go to site" link displayed in the login page footer. |
18 | 338 |
* |
339 |
* @since 5.7.0 |
|
340 |
* |
|
341 |
* @param string $link HTML link to the home URL of the current site. |
|
342 |
*/ |
|
343 |
echo apply_filters( 'login_site_html_link', $html_link ); |
|
344 |
?> |
|
345 |
</p> |
|
16 | 346 |
<?php |
0 | 347 |
|
16 | 348 |
the_privacy_policy_link( '<div class="privacy-policy-page-link">', '</div>' ); |
349 |
} |
|
350 |
||
351 |
?> |
|
352 |
</div><?php // End of <div id="login">. ?> |
|
0 | 353 |
|
354 |
<?php |
|
19 | 355 |
if ( |
356 |
! $interim_login && |
|
357 |
/** |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
358 |
* Filters whether to display the Language selector on the login screen. |
19 | 359 |
* |
360 |
* @since 5.9.0 |
|
361 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
362 |
* @param bool $display Whether to display the Language selector on the login screen. |
19 | 363 |
*/ |
364 |
apply_filters( 'login_display_language_dropdown', true ) |
|
365 |
) { |
|
366 |
$languages = get_available_languages(); |
|
367 |
||
368 |
if ( ! empty( $languages ) ) { |
|
369 |
?> |
|
370 |
<div class="language-switcher"> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
371 |
<form id="language-switcher" method="get"> |
19 | 372 |
|
373 |
<label for="language-switcher-locales"> |
|
374 |
<span class="dashicons dashicons-translation" aria-hidden="true"></span> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
375 |
<span class="screen-reader-text"> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
376 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
377 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
378 |
_e( 'Language' ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
379 |
?> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
380 |
</span> |
19 | 381 |
</label> |
382 |
||
383 |
<?php |
|
384 |
$args = array( |
|
385 |
'id' => 'language-switcher-locales', |
|
386 |
'name' => 'wp_lang', |
|
387 |
'selected' => determine_locale(), |
|
388 |
'show_available_translations' => false, |
|
389 |
'explicit_option_en_us' => true, |
|
390 |
'languages' => $languages, |
|
391 |
); |
|
392 |
||
393 |
/** |
|
394 |
* Filters default arguments for the Languages select input on the login screen. |
|
395 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
396 |
* The arguments get passed to the wp_dropdown_languages() function. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
397 |
* |
19 | 398 |
* @since 5.9.0 |
399 |
* |
|
400 |
* @param array $args Arguments for the Languages select input on the login screen. |
|
401 |
*/ |
|
402 |
wp_dropdown_languages( apply_filters( 'login_language_dropdown_args', $args ) ); |
|
403 |
?> |
|
404 |
||
405 |
<?php if ( $interim_login ) { ?> |
|
406 |
<input type="hidden" name="interim-login" value="1" /> |
|
407 |
<?php } ?> |
|
408 |
||
409 |
<?php if ( isset( $_GET['redirect_to'] ) && '' !== $_GET['redirect_to'] ) { ?> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
410 |
<input type="hidden" name="redirect_to" value="<?php echo sanitize_url( $_GET['redirect_to'] ); ?>" /> |
19 | 411 |
<?php } ?> |
412 |
||
413 |
<?php if ( isset( $_GET['action'] ) && '' !== $_GET['action'] ) { ?> |
|
414 |
<input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action'] ); ?>" /> |
|
415 |
<?php } ?> |
|
416 |
||
417 |
<input type="submit" class="button" value="<?php esc_attr_e( 'Change' ); ?>"> |
|
418 |
||
419 |
</form> |
|
420 |
</div> |
|
421 |
<?php } ?> |
|
422 |
<?php } ?> |
|
423 |
<?php |
|
16 | 424 |
|
425 |
if ( ! empty( $input_id ) ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
426 |
ob_start(); |
16 | 427 |
?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
428 |
<script> |
16 | 429 |
try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){} |
18 | 430 |
if(typeof wpOnload==='function')wpOnload(); |
16 | 431 |
</script> |
432 |
<?php |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
433 |
wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); |
16 | 434 |
} |
435 |
||
0 | 436 |
/** |
437 |
* Fires in the login page footer. |
|
438 |
* |
|
439 |
* @since 3.1.0 |
|
440 |
*/ |
|
9 | 441 |
do_action( 'login_footer' ); |
16 | 442 |
|
9 | 443 |
?> |
0 | 444 |
</body> |
445 |
</html> |
|
446 |
<?php |
|
447 |
} |
|
448 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
449 |
/** |
18 | 450 |
* Outputs the JavaScript to handle the form shaking on the login page. |
9 | 451 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
452 |
* @since 3.0.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
453 |
*/ |
0 | 454 |
function wp_shake_js() { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
455 |
wp_print_inline_script_tag( "document.querySelector('form').classList.add('shake');" ); |
0 | 456 |
} |
457 |
||
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
458 |
/** |
18 | 459 |
* Outputs the viewport meta tag for the login page. |
9 | 460 |
* |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
461 |
* @since 3.7.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
462 |
*/ |
0 | 463 |
function wp_login_viewport_meta() { |
464 |
?> |
|
465 |
<meta name="viewport" content="width=device-width" /> |
|
466 |
<?php |
|
467 |
} |
|
468 |
||
19 | 469 |
/* |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
470 |
* Main part. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
471 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
472 |
* Check the request and redirect or display a form based on the current action. |
19 | 473 |
*/ |
0 | 474 |
|
9 | 475 |
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'login'; |
0 | 476 |
$errors = new WP_Error(); |
477 |
||
9 | 478 |
if ( isset( $_GET['key'] ) ) { |
0 | 479 |
$action = 'resetpass'; |
9 | 480 |
} |
0 | 481 |
|
16 | 482 |
if ( isset( $_GET['checkemail'] ) ) { |
483 |
$action = 'checkemail'; |
|
484 |
} |
|
485 |
||
486 |
$default_actions = array( |
|
487 |
'confirm_admin_email', |
|
488 |
'postpass', |
|
489 |
'logout', |
|
490 |
'lostpassword', |
|
491 |
'retrievepassword', |
|
492 |
'resetpass', |
|
493 |
'rp', |
|
494 |
'register', |
|
495 |
'checkemail', |
|
496 |
'confirmaction', |
|
497 |
'login', |
|
498 |
WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED, |
|
499 |
); |
|
500 |
||
9 | 501 |
// Validate action so as to default to the login screen. |
16 | 502 |
if ( ! in_array( $action, $default_actions, true ) && false === has_filter( 'login_form_' . $action ) ) { |
0 | 503 |
$action = 'login'; |
9 | 504 |
} |
0 | 505 |
|
506 |
nocache_headers(); |
|
507 |
||
9 | 508 |
header( 'Content-Type: ' . get_bloginfo( 'html_type' ) . '; charset=' . get_bloginfo( 'charset' ) ); |
0 | 509 |
|
16 | 510 |
if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set. |
511 |
if ( isset( $_SERVER['PATH_INFO'] ) && ( $_SERVER['PATH_INFO'] !== $_SERVER['PHP_SELF'] ) ) { |
|
0 | 512 |
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] ); |
9 | 513 |
} |
0 | 514 |
|
9 | 515 |
$url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) ); |
16 | 516 |
|
517 |
if ( get_option( 'siteurl' ) !== $url ) { |
|
0 | 518 |
update_option( 'siteurl', $url ); |
9 | 519 |
} |
0 | 520 |
} |
521 |
||
16 | 522 |
// Set a cookie now to see if they are supported by the browser. |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
523 |
$secure = ( 'https' === parse_url( wp_login_url(), PHP_URL_SCHEME ) ); |
5 | 524 |
setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
16 | 525 |
|
526 |
if ( SITECOOKIEPATH !== COOKIEPATH ) { |
|
5 | 527 |
setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure ); |
9 | 528 |
} |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
529 |
|
19 | 530 |
if ( isset( $_GET['wp_lang'] ) ) { |
531 |
setcookie( 'wp_lang', sanitize_text_field( $_GET['wp_lang'] ), 0, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
|
532 |
} |
|
533 |
||
0 | 534 |
/** |
535 |
* Fires when the login form is initialized. |
|
536 |
* |
|
537 |
* @since 3.2.0 |
|
538 |
*/ |
|
539 |
do_action( 'login_init' ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
540 |
|
0 | 541 |
/** |
542 |
* Fires before a specified login form action. |
|
543 |
* |
|
5 | 544 |
* The dynamic portion of the hook name, `$action`, refers to the action |
18 | 545 |
* that brought the visitor to the login form. |
546 |
* |
|
547 |
* Possible hook names include: |
|
548 |
* |
|
19 | 549 |
* - `login_form_checkemail` |
550 |
* - `login_form_confirm_admin_email` |
|
551 |
* - `login_form_confirmaction` |
|
552 |
* - `login_form_entered_recovery_mode` |
|
553 |
* - `login_form_login` |
|
554 |
* - `login_form_logout` |
|
555 |
* - `login_form_lostpassword` |
|
556 |
* - `login_form_postpass` |
|
557 |
* - `login_form_register` |
|
558 |
* - `login_form_resetpass` |
|
559 |
* - `login_form_retrievepassword` |
|
560 |
* - `login_form_rp` |
|
0 | 561 |
* |
562 |
* @since 2.8.0 |
|
563 |
*/ |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
564 |
do_action( "login_form_{$action}" ); |
0 | 565 |
|
16 | 566 |
$http_post = ( 'POST' === $_SERVER['REQUEST_METHOD'] ); |
9 | 567 |
$interim_login = isset( $_REQUEST['interim-login'] ); |
0 | 568 |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
569 |
/** |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
570 |
* Filters the separator used between login form navigation links. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
571 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
572 |
* @since 4.9.0 |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
573 |
* |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
574 |
* @param string $login_link_separator The separator used between login form navigation links. |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
575 |
*/ |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
576 |
$login_link_separator = apply_filters( 'login_link_separator', ' | ' ); |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
577 |
|
9 | 578 |
switch ( $action ) { |
0 | 579 |
|
16 | 580 |
case 'confirm_admin_email': |
581 |
/* |
|
582 |
* Note that `is_user_logged_in()` will return false immediately after logging in |
|
583 |
* as the current user is not set, see wp-includes/pluggable.php. |
|
584 |
* However this action runs on a redirect after logging in. |
|
585 |
*/ |
|
586 |
if ( ! is_user_logged_in() ) { |
|
587 |
wp_safe_redirect( wp_login_url() ); |
|
588 |
exit; |
|
589 |
} |
|
590 |
||
591 |
if ( ! empty( $_REQUEST['redirect_to'] ) ) { |
|
592 |
$redirect_to = $_REQUEST['redirect_to']; |
|
593 |
} else { |
|
594 |
$redirect_to = admin_url(); |
|
595 |
} |
|
596 |
||
597 |
if ( current_user_can( 'manage_options' ) ) { |
|
598 |
$admin_email = get_option( 'admin_email' ); |
|
599 |
} else { |
|
600 |
wp_safe_redirect( $redirect_to ); |
|
601 |
exit; |
|
602 |
} |
|
603 |
||
604 |
/** |
|
605 |
* Filters the interval for dismissing the admin email confirmation screen. |
|
606 |
* |
|
607 |
* If `0` (zero) is returned, the "Remind me later" link will not be displayed. |
|
608 |
* |
|
609 |
* @since 5.3.1 |
|
610 |
* |
|
611 |
* @param int $interval Interval time (in seconds). Default is 3 days. |
|
612 |
*/ |
|
613 |
$remind_interval = (int) apply_filters( 'admin_email_remind_interval', 3 * DAY_IN_SECONDS ); |
|
614 |
||
615 |
if ( ! empty( $_GET['remind_me_later'] ) ) { |
|
616 |
if ( ! wp_verify_nonce( $_GET['remind_me_later'], 'remind_me_later_nonce' ) ) { |
|
617 |
wp_safe_redirect( wp_login_url() ); |
|
618 |
exit; |
|
619 |
} |
|
620 |
||
621 |
if ( $remind_interval > 0 ) { |
|
622 |
update_option( 'admin_email_lifespan', time() + $remind_interval ); |
|
623 |
} |
|
624 |
||
625 |
$redirect_to = add_query_arg( 'admin_email_remind_later', 1, $redirect_to ); |
|
626 |
wp_safe_redirect( $redirect_to ); |
|
627 |
exit; |
|
628 |
} |
|
629 |
||
630 |
if ( ! empty( $_POST['correct-admin-email'] ) ) { |
|
631 |
if ( ! check_admin_referer( 'confirm_admin_email', 'confirm_admin_email_nonce' ) ) { |
|
632 |
wp_safe_redirect( wp_login_url() ); |
|
633 |
exit; |
|
634 |
} |
|
635 |
||
636 |
/** |
|
637 |
* Filters the interval for redirecting the user to the admin email confirmation screen. |
|
638 |
* |
|
639 |
* If `0` (zero) is returned, the user will not be redirected. |
|
640 |
* |
|
641 |
* @since 5.3.0 |
|
642 |
* |
|
643 |
* @param int $interval Interval time (in seconds). Default is 6 months. |
|
644 |
*/ |
|
645 |
$admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); |
|
646 |
||
647 |
if ( $admin_email_check_interval > 0 ) { |
|
648 |
update_option( 'admin_email_lifespan', time() + $admin_email_check_interval ); |
|
649 |
} |
|
650 |
||
651 |
wp_safe_redirect( $redirect_to ); |
|
652 |
exit; |
|
653 |
} |
|
654 |
||
655 |
login_header( __( 'Confirm your administration email' ), '', $errors ); |
|
656 |
||
657 |
/** |
|
658 |
* Fires before the admin email confirm form. |
|
659 |
* |
|
660 |
* @since 5.3.0 |
|
661 |
* |
|
662 |
* @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid |
|
663 |
* credentials. Note that the error object may not contain any errors. |
|
664 |
*/ |
|
665 |
do_action( 'admin_email_confirm', $errors ); |
|
666 |
||
667 |
?> |
|
668 |
||
669 |
<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"> |
|
670 |
<?php |
|
671 |
/** |
|
672 |
* Fires inside the admin-email-confirm-form form tags, before the hidden fields. |
|
673 |
* |
|
674 |
* @since 5.3.0 |
|
675 |
*/ |
|
676 |
do_action( 'admin_email_confirm_form' ); |
|
677 |
||
678 |
wp_nonce_field( 'confirm_admin_email', 'confirm_admin_email_nonce' ); |
|
679 |
||
680 |
?> |
|
681 |
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
682 |
||
683 |
<h1 class="admin-email__heading"> |
|
684 |
<?php _e( 'Administration email verification' ); ?> |
|
685 |
</h1> |
|
686 |
<p class="admin-email__details"> |
|
687 |
<?php _e( 'Please verify that the <strong>administration email</strong> for this website is still correct.' ); ?> |
|
688 |
<?php |
|
689 |
||
690 |
/* translators: URL to the WordPress help section about admin email. */ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
691 |
$admin_email_help_url = __( 'https://wordpress.org/documentation/article/settings-general-screen/#email-address' ); |
16 | 692 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
693 |
$accessibility_text = sprintf( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
694 |
'<span class="screen-reader-text"> %s</span>', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
695 |
/* translators: Hidden accessibility text. */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
696 |
__( '(opens in a new tab)' ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
697 |
); |
16 | 698 |
|
699 |
printf( |
|
18 | 700 |
'<a href="%s" rel="noopener" target="_blank">%s%s</a>', |
16 | 701 |
esc_url( $admin_email_help_url ), |
702 |
__( 'Why is this important?' ), |
|
703 |
$accessibility_text |
|
704 |
); |
|
705 |
||
706 |
?> |
|
707 |
</p> |
|
708 |
<p class="admin-email__details"> |
|
709 |
<?php |
|
710 |
||
711 |
printf( |
|
712 |
/* translators: %s: Admin email address. */ |
|
713 |
__( 'Current administration email: %s' ), |
|
714 |
'<strong>' . esc_html( $admin_email ) . '</strong>' |
|
715 |
); |
|
716 |
||
717 |
?> |
|
718 |
</p> |
|
719 |
<p class="admin-email__details"> |
|
720 |
<?php _e( 'This email may be different from your personal email address.' ); ?> |
|
721 |
</p> |
|
722 |
||
723 |
<div class="admin-email__actions"> |
|
724 |
<div class="admin-email__actions-primary"> |
|
725 |
<?php |
|
726 |
||
727 |
$change_link = admin_url( 'options-general.php' ); |
|
728 |
$change_link = add_query_arg( 'highlight', 'confirm_admin_email', $change_link ); |
|
729 |
||
730 |
?> |
|
731 |
<a class="button button-large" href="<?php echo esc_url( $change_link ); ?>"><?php _e( 'Update' ); ?></a> |
|
732 |
<input type="submit" name="correct-admin-email" id="correct-admin-email" class="button button-primary button-large" value="<?php esc_attr_e( 'The email is correct' ); ?>" /> |
|
733 |
</div> |
|
734 |
<?php if ( $remind_interval > 0 ) : ?> |
|
735 |
<div class="admin-email__actions-secondary"> |
|
736 |
<?php |
|
737 |
||
738 |
$remind_me_link = wp_login_url( $redirect_to ); |
|
739 |
$remind_me_link = add_query_arg( |
|
740 |
array( |
|
741 |
'action' => 'confirm_admin_email', |
|
742 |
'remind_me_later' => wp_create_nonce( 'remind_me_later_nonce' ), |
|
743 |
), |
|
744 |
$remind_me_link |
|
745 |
); |
|
746 |
||
747 |
?> |
|
748 |
<a href="<?php echo esc_url( $remind_me_link ); ?>"><?php _e( 'Remind me later' ); ?></a> |
|
749 |
</div> |
|
750 |
<?php endif; ?> |
|
751 |
</div> |
|
752 |
</form> |
|
753 |
||
754 |
<?php |
|
755 |
||
756 |
login_footer(); |
|
757 |
break; |
|
758 |
||
9 | 759 |
case 'postpass': |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
760 |
if ( ! isset( $_POST['post_password'] ) || ! is_string( $_POST['post_password'] ) ) { |
9 | 761 |
wp_safe_redirect( wp_get_referer() ); |
16 | 762 |
exit; |
0 | 763 |
} |
9 | 764 |
|
765 |
require_once ABSPATH . WPINC . '/class-phpass.php'; |
|
766 |
$hasher = new PasswordHash( 8, true ); |
|
0 | 767 |
|
9 | 768 |
/** |
769 |
* Filters the life span of the post password cookie. |
|
770 |
* |
|
771 |
* By default, the cookie expires 10 days from creation. To turn this |
|
772 |
* into a session cookie, return 0. |
|
773 |
* |
|
774 |
* @since 3.7.0 |
|
775 |
* |
|
776 |
* @param int $expires The expiry time, as passed to setcookie(). |
|
777 |
*/ |
|
778 |
$expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS ); |
|
779 |
$referer = wp_get_referer(); |
|
16 | 780 |
|
9 | 781 |
if ( $referer ) { |
782 |
$secure = ( 'https' === parse_url( $referer, PHP_URL_SCHEME ) ); |
|
783 |
} else { |
|
784 |
$secure = false; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
785 |
} |
16 | 786 |
|
9 | 787 |
setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure ); |
788 |
||
789 |
wp_safe_redirect( wp_get_referer() ); |
|
16 | 790 |
exit; |
9 | 791 |
|
792 |
case 'logout': |
|
793 |
check_admin_referer( 'log-out' ); |
|
794 |
||
795 |
$user = wp_get_current_user(); |
|
796 |
||
797 |
wp_logout(); |
|
798 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
799 |
if ( ! empty( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) { |
16 | 800 |
$redirect_to = $_REQUEST['redirect_to']; |
801 |
$requested_redirect_to = $redirect_to; |
|
9 | 802 |
} else { |
16 | 803 |
$redirect_to = add_query_arg( |
804 |
array( |
|
805 |
'loggedout' => 'true', |
|
806 |
'wp_lang' => get_user_locale( $user ), |
|
807 |
), |
|
808 |
wp_login_url() |
|
809 |
); |
|
810 |
||
9 | 811 |
$requested_redirect_to = ''; |
812 |
} |
|
0 | 813 |
|
9 | 814 |
/** |
815 |
* Filters the log out redirect URL. |
|
816 |
* |
|
817 |
* @since 4.2.0 |
|
818 |
* |
|
819 |
* @param string $redirect_to The redirect destination URL. |
|
820 |
* @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
|
821 |
* @param WP_User $user The WP_User object for the user that's logging out. |
|
822 |
*/ |
|
823 |
$redirect_to = apply_filters( 'logout_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
16 | 824 |
|
9 | 825 |
wp_safe_redirect( $redirect_to ); |
16 | 826 |
exit; |
9 | 827 |
|
828 |
case 'lostpassword': |
|
829 |
case 'retrievepassword': |
|
830 |
if ( $http_post ) { |
|
831 |
$errors = retrieve_password(); |
|
16 | 832 |
|
9 | 833 |
if ( ! is_wp_error( $errors ) ) { |
834 |
$redirect_to = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm'; |
|
835 |
wp_safe_redirect( $redirect_to ); |
|
16 | 836 |
exit; |
9 | 837 |
} |
838 |
} |
|
839 |
||
840 |
if ( isset( $_GET['error'] ) ) { |
|
16 | 841 |
if ( 'invalidkey' === $_GET['error'] ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
842 |
$errors->add( 'invalidkey', __( '<strong>Error:</strong> Your password reset link appears to be invalid. Please request a new link below.' ) ); |
16 | 843 |
} elseif ( 'expiredkey' === $_GET['error'] ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
844 |
$errors->add( 'expiredkey', __( '<strong>Error:</strong> Your password reset link has expired. Please request a new link below.' ) ); |
9 | 845 |
} |
846 |
} |
|
0 | 847 |
|
9 | 848 |
$lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
849 |
/** |
|
850 |
* Filters the URL redirected to after submitting the lostpassword/retrievepassword form. |
|
851 |
* |
|
852 |
* @since 3.0.0 |
|
853 |
* |
|
854 |
* @param string $lostpassword_redirect The redirect destination URL. |
|
855 |
*/ |
|
856 |
$redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect ); |
|
0 | 857 |
|
9 | 858 |
/** |
859 |
* Fires before the lost password form. |
|
860 |
* |
|
861 |
* @since 1.5.1 |
|
862 |
* @since 5.1.0 Added the `$errors` parameter. |
|
863 |
* |
|
864 |
* @param WP_Error $errors A `WP_Error` object containing any errors generated by using invalid |
|
865 |
* credentials. Note that the error object may not contain any errors. |
|
866 |
*/ |
|
867 |
do_action( 'lost_password', $errors ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
868 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
869 |
login_header( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
870 |
__( 'Lost Password' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
871 |
wp_get_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
872 |
__( 'Please enter your username or email address. You will receive an email message with instructions on how to reset your password.' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
873 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
874 |
'type' => 'info', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
875 |
'additional_classes' => array( 'message' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
876 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
877 |
), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
878 |
$errors |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
879 |
); |
9 | 880 |
|
881 |
$user_login = ''; |
|
0 | 882 |
|
9 | 883 |
if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) { |
884 |
$user_login = wp_unslash( $_POST['user_login'] ); |
|
885 |
} |
|
0 | 886 |
|
9 | 887 |
?> |
888 |
||
16 | 889 |
<form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post"> |
890 |
<p> |
|
891 |
<label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
892 |
<input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" /> |
16 | 893 |
</p> |
894 |
<?php |
|
895 |
||
896 |
/** |
|
897 |
* Fires inside the lostpassword form tags, before the hidden fields. |
|
898 |
* |
|
899 |
* @since 2.1.0 |
|
900 |
*/ |
|
901 |
do_action( 'lostpassword_form' ); |
|
0 | 902 |
|
16 | 903 |
?> |
904 |
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
905 |
<p class="submit"> |
|
906 |
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Get New Password' ); ?>" /> |
|
907 |
</p> |
|
908 |
</form> |
|
5 | 909 |
|
16 | 910 |
<p id="nav"> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
911 |
<a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
16 | 912 |
<?php |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
913 |
|
16 | 914 |
if ( get_option( 'users_can_register' ) ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
915 |
$registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
16 | 916 |
|
917 |
echo esc_html( $login_link_separator ); |
|
0 | 918 |
|
16 | 919 |
/** This filter is documented in wp-includes/general-template.php */ |
920 |
echo apply_filters( 'register', $registration_url ); |
|
921 |
} |
|
922 |
||
923 |
?> |
|
924 |
</p> |
|
9 | 925 |
<?php |
16 | 926 |
|
9 | 927 |
login_footer( 'user_login' ); |
928 |
break; |
|
0 | 929 |
|
9 | 930 |
case 'resetpass': |
931 |
case 'rp': |
|
932 |
list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
933 |
$rp_cookie = 'wp-resetpass-' . COOKIEHASH; |
|
16 | 934 |
|
18 | 935 |
if ( isset( $_GET['key'] ) && isset( $_GET['login'] ) ) { |
9 | 936 |
$value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) ); |
937 |
setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
16 | 938 |
|
9 | 939 |
wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) ); |
940 |
exit; |
|
941 |
} |
|
0 | 942 |
|
9 | 943 |
if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) { |
944 |
list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 ); |
|
16 | 945 |
|
946 |
$user = check_password_reset_key( $rp_key, $rp_login ); |
|
947 |
||
9 | 948 |
if ( isset( $_POST['pass1'] ) && ! hash_equals( $rp_key, $_POST['rp_key'] ) ) { |
949 |
$user = false; |
|
950 |
} |
|
951 |
} else { |
|
5 | 952 |
$user = false; |
953 |
} |
|
954 |
||
9 | 955 |
if ( ! $user || is_wp_error( $user ) ) { |
956 |
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
16 | 957 |
|
9 | 958 |
if ( $user && $user->get_error_code() === 'expired_key' ) { |
959 |
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) ); |
|
960 |
} else { |
|
961 |
wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) ); |
|
962 |
} |
|
16 | 963 |
|
9 | 964 |
exit; |
965 |
} |
|
0 | 966 |
|
9 | 967 |
$errors = new WP_Error(); |
0 | 968 |
|
19 | 969 |
// Check if password is one or all empty spaces. |
970 |
if ( ! empty( $_POST['pass1'] ) ) { |
|
971 |
$_POST['pass1'] = trim( $_POST['pass1'] ); |
|
972 |
||
973 |
if ( empty( $_POST['pass1'] ) ) { |
|
974 |
$errors->add( 'password_reset_empty_space', __( 'The password cannot be a space or all spaces.' ) ); |
|
975 |
} |
|
976 |
} |
|
977 |
||
978 |
// Check if password fields do not match. |
|
979 |
if ( ! empty( $_POST['pass1'] ) && trim( $_POST['pass2'] ) !== $_POST['pass1'] ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
980 |
$errors->add( 'password_reset_mismatch', __( '<strong>Error:</strong> The passwords do not match.' ) ); |
9 | 981 |
} |
0 | 982 |
|
9 | 983 |
/** |
984 |
* Fires before the password reset procedure is validated. |
|
985 |
* |
|
986 |
* @since 3.5.0 |
|
987 |
* |
|
16 | 988 |
* @param WP_Error $errors WP Error object. |
9 | 989 |
* @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise. |
990 |
*/ |
|
991 |
do_action( 'validate_password_reset', $errors, $user ); |
|
0 | 992 |
|
9 | 993 |
if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) { |
994 |
reset_password( $user, $_POST['pass1'] ); |
|
995 |
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true ); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
996 |
login_header( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
997 |
__( 'Password Reset' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
998 |
wp_get_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
999 |
__( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a>', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1000 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1001 |
'type' => 'info', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1002 |
'additional_classes' => array( 'message', 'reset-pass' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1003 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1004 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1005 |
); |
9 | 1006 |
login_footer(); |
1007 |
exit; |
|
1008 |
} |
|
0 | 1009 |
|
9 | 1010 |
wp_enqueue_script( 'utils' ); |
1011 |
wp_enqueue_script( 'user-profile' ); |
|
0 | 1012 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1013 |
login_header( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1014 |
__( 'Reset Password' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1015 |
wp_get_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1016 |
__( 'Enter your new password below or generate one.' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1017 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1018 |
'type' => 'info', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1019 |
'additional_classes' => array( 'message', 'reset-pass' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1020 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1021 |
), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1022 |
$errors |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1023 |
); |
0 | 1024 |
|
9 | 1025 |
?> |
16 | 1026 |
<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> |
1027 |
<input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" /> |
|
1028 |
||
1029 |
<div class="user-pass1-wrap"> |
|
1030 |
<p> |
|
1031 |
<label for="pass1"><?php _e( 'New password' ); ?></label> |
|
1032 |
</p> |
|
0 | 1033 |
|
16 | 1034 |
<div class="wp-pwd"> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1035 |
<input type="password" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="new-password" spellcheck="false" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" aria-describedby="pass-strength-result" /> |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1036 |
|
16 | 1037 |
<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' ); ?>"> |
1038 |
<span class="dashicons dashicons-hidden" aria-hidden="true"></span> |
|
1039 |
</button> |
|
1040 |
<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> |
|
1041 |
</div> |
|
1042 |
<div class="pw-weak"> |
|
1043 |
<input type="checkbox" name="pw_weak" id="pw-weak" class="pw-checkbox" /> |
|
1044 |
<label for="pw-weak"><?php _e( 'Confirm use of weak password' ); ?></label> |
|
1045 |
</div> |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1046 |
</div> |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1047 |
|
16 | 1048 |
<p class="user-pass2-wrap"> |
1049 |
<label for="pass2"><?php _e( 'Confirm new password' ); ?></label> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1050 |
<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="new-password" spellcheck="false" /> |
16 | 1051 |
</p> |
1052 |
||
1053 |
<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p> |
|
1054 |
||
1055 |
<?php |
|
0 | 1056 |
|
16 | 1057 |
/** |
1058 |
* Fires following the 'Strength indicator' meter in the user password reset form. |
|
1059 |
* |
|
1060 |
* @since 3.9.0 |
|
1061 |
* |
|
1062 |
* @param WP_User $user User object of the user whose password is being reset. |
|
1063 |
*/ |
|
1064 |
do_action( 'resetpass_form', $user ); |
|
0 | 1065 |
|
16 | 1066 |
?> |
1067 |
<input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" /> |
|
18 | 1068 |
<p class="submit reset-pass-submit"> |
19 | 1069 |
<button type="button" class="button wp-generate-pw hide-if-no-js skip-aria-expanded"><?php _e( 'Generate Password' ); ?></button> |
18 | 1070 |
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" /> |
16 | 1071 |
</p> |
1072 |
</form> |
|
9 | 1073 |
|
16 | 1074 |
<p id="nav"> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1075 |
<a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
16 | 1076 |
<?php |
9 | 1077 |
|
16 | 1078 |
if ( get_option( 'users_can_register' ) ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1079 |
$registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
16 | 1080 |
|
1081 |
echo esc_html( $login_link_separator ); |
|
0 | 1082 |
|
16 | 1083 |
/** This filter is documented in wp-includes/general-template.php */ |
1084 |
echo apply_filters( 'register', $registration_url ); |
|
1085 |
} |
|
9 | 1086 |
|
16 | 1087 |
?> |
1088 |
</p> |
|
9 | 1089 |
<?php |
16 | 1090 |
|
19 | 1091 |
login_footer( 'pass1' ); |
9 | 1092 |
break; |
5 | 1093 |
|
9 | 1094 |
case 'register': |
1095 |
if ( is_multisite() ) { |
|
1096 |
/** |
|
1097 |
* Filters the Multisite sign up URL. |
|
1098 |
* |
|
1099 |
* @since 3.0.0 |
|
1100 |
* |
|
1101 |
* @param string $sign_up_url The sign up URL. |
|
1102 |
*/ |
|
1103 |
wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) ); |
|
1104 |
exit; |
|
1105 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1106 |
|
9 | 1107 |
if ( ! get_option( 'users_can_register' ) ) { |
1108 |
wp_redirect( site_url( 'wp-login.php?registration=disabled' ) ); |
|
16 | 1109 |
exit; |
9 | 1110 |
} |
0 | 1111 |
|
9 | 1112 |
$user_login = ''; |
1113 |
$user_email = ''; |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1114 |
|
9 | 1115 |
if ( $http_post ) { |
1116 |
if ( isset( $_POST['user_login'] ) && is_string( $_POST['user_login'] ) ) { |
|
16 | 1117 |
$user_login = wp_unslash( $_POST['user_login'] ); |
9 | 1118 |
} |
1119 |
||
1120 |
if ( isset( $_POST['user_email'] ) && is_string( $_POST['user_email'] ) ) { |
|
1121 |
$user_email = wp_unslash( $_POST['user_email'] ); |
|
1122 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1123 |
|
9 | 1124 |
$errors = register_new_user( $user_login, $user_email ); |
16 | 1125 |
|
9 | 1126 |
if ( ! is_wp_error( $errors ) ) { |
1127 |
$redirect_to = ! empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered'; |
|
1128 |
wp_safe_redirect( $redirect_to ); |
|
16 | 1129 |
exit; |
9 | 1130 |
} |
1131 |
} |
|
0 | 1132 |
|
9 | 1133 |
$registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
16 | 1134 |
|
0 | 1135 |
/** |
9 | 1136 |
* Filters the registration redirect URL. |
0 | 1137 |
* |
1138 |
* @since 3.0.0 |
|
19 | 1139 |
* @since 5.9.0 Added the `$errors` parameter. |
0 | 1140 |
* |
19 | 1141 |
* @param string $registration_redirect The redirect destination URL. |
1142 |
* @param int|WP_Error $errors User id if registration was successful, |
|
1143 |
* WP_Error object otherwise. |
|
0 | 1144 |
*/ |
19 | 1145 |
$redirect_to = apply_filters( 'registration_redirect', $registration_redirect, $errors ); |
16 | 1146 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1147 |
login_header( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1148 |
__( 'Registration Form' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1149 |
wp_get_admin_notice( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1150 |
__( 'Register For This Site' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1151 |
array( |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1152 |
'type' => 'info', |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1153 |
'additional_classes' => array( 'message', 'register' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1154 |
) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1155 |
), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1156 |
$errors |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1157 |
); |
16 | 1158 |
|
9 | 1159 |
?> |
16 | 1160 |
<form name="registerform" id="registerform" action="<?php echo esc_url( site_url( 'wp-login.php?action=register', 'login_post' ) ); ?>" method="post" novalidate="novalidate"> |
1161 |
<p> |
|
1162 |
<label for="user_login"><?php _e( 'Username' ); ?></label> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1163 |
<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" required="required" /> |
16 | 1164 |
</p> |
1165 |
<p> |
|
1166 |
<label for="user_email"><?php _e( 'Email' ); ?></label> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1167 |
<input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" autocomplete="email" required="required" /> |
16 | 1168 |
</p> |
1169 |
<?php |
|
1170 |
||
1171 |
/** |
|
1172 |
* Fires following the 'Email' field in the user registration form. |
|
1173 |
* |
|
1174 |
* @since 2.1.0 |
|
1175 |
*/ |
|
1176 |
do_action( 'register_form' ); |
|
1177 |
||
1178 |
?> |
|
1179 |
<p id="reg_passmail"> |
|
1180 |
<?php _e( 'Registration confirmation will be emailed to you.' ); ?> |
|
1181 |
</p> |
|
1182 |
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
1183 |
<p class="submit"> |
|
1184 |
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Register' ); ?>" /> |
|
1185 |
</p> |
|
1186 |
</form> |
|
1187 |
||
1188 |
<p id="nav"> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1189 |
<a class="wp-login-log-in" href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1190 |
<?php |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1191 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1192 |
echo esc_html( $login_link_separator ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1193 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1194 |
$html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1195 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1196 |
/** This filter is documented in wp-login.php */ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1197 |
echo apply_filters( 'lost_password_html_link', $html_link ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1198 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1199 |
?> |
16 | 1200 |
</p> |
9 | 1201 |
<?php |
16 | 1202 |
|
1203 |
login_footer( 'user_login' ); |
|
1204 |
break; |
|
1205 |
||
1206 |
case 'checkemail': |
|
1207 |
$redirect_to = admin_url(); |
|
1208 |
$errors = new WP_Error(); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1209 |
|
16 | 1210 |
if ( 'confirm' === $_GET['checkemail'] ) { |
1211 |
$errors->add( |
|
1212 |
'confirm', |
|
1213 |
sprintf( |
|
1214 |
/* translators: %s: Link to the login page. */ |
|
1215 |
__( 'Check your email for the confirmation link, then visit the <a href="%s">login page</a>.' ), |
|
1216 |
wp_login_url() |
|
1217 |
), |
|
1218 |
'message' |
|
1219 |
); |
|
1220 |
} elseif ( 'registered' === $_GET['checkemail'] ) { |
|
1221 |
$errors->add( |
|
1222 |
'registered', |
|
1223 |
sprintf( |
|
1224 |
/* translators: %s: Link to the login page. */ |
|
1225 |
__( 'Registration complete. Please check your email, then visit the <a href="%s">login page</a>.' ), |
|
1226 |
wp_login_url() |
|
1227 |
), |
|
1228 |
'message' |
|
1229 |
); |
|
1230 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1231 |
|
16 | 1232 |
/** This action is documented in wp-login.php */ |
1233 |
$errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1234 |
|
16 | 1235 |
login_header( __( 'Check your email' ), '', $errors ); |
1236 |
login_footer(); |
|
9 | 1237 |
break; |
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1238 |
|
9 | 1239 |
case 'confirmaction': |
1240 |
if ( ! isset( $_GET['request_id'] ) ) { |
|
1241 |
wp_die( __( 'Missing request ID.' ) ); |
|
1242 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1243 |
|
9 | 1244 |
if ( ! isset( $_GET['confirm_key'] ) ) { |
1245 |
wp_die( __( 'Missing confirm key.' ) ); |
|
1246 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1247 |
|
9 | 1248 |
$request_id = (int) $_GET['request_id']; |
1249 |
$key = sanitize_text_field( wp_unslash( $_GET['confirm_key'] ) ); |
|
1250 |
$result = wp_validate_user_request_key( $request_id, $key ); |
|
0 | 1251 |
|
9 | 1252 |
if ( is_wp_error( $result ) ) { |
1253 |
wp_die( $result ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1254 |
} |
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1255 |
|
9 | 1256 |
/** |
1257 |
* Fires an action hook when the account action has been confirmed by the user. |
|
1258 |
* |
|
1259 |
* Using this you can assume the user has agreed to perform the action by |
|
1260 |
* clicking on the link in the confirmation email. |
|
1261 |
* |
|
1262 |
* After firing this action hook the page will redirect to wp-login a callback |
|
1263 |
* redirects or exits first. |
|
1264 |
* |
|
1265 |
* @since 4.9.6 |
|
1266 |
* |
|
1267 |
* @param int $request_id Request ID. |
|
1268 |
*/ |
|
1269 |
do_action( 'user_request_action_confirmed', $request_id ); |
|
1270 |
||
1271 |
$message = _wp_privacy_account_request_confirmed_message( $request_id ); |
|
1272 |
||
1273 |
login_header( __( 'User action confirmed.' ), $message ); |
|
1274 |
login_footer(); |
|
1275 |
exit; |
|
1276 |
||
1277 |
case 'login': |
|
1278 |
default: |
|
1279 |
$secure_cookie = ''; |
|
1280 |
$customize_login = isset( $_REQUEST['customize-login'] ); |
|
16 | 1281 |
|
9 | 1282 |
if ( $customize_login ) { |
1283 |
wp_enqueue_script( 'customize-base' ); |
|
1284 |
} |
|
1285 |
||
1286 |
// If the user wants SSL but the session is not SSL, force a secure cookie. |
|
1287 |
if ( ! empty( $_POST['log'] ) && ! force_ssl_admin() ) { |
|
16 | 1288 |
$user_name = sanitize_user( wp_unslash( $_POST['log'] ) ); |
9 | 1289 |
$user = get_user_by( 'login', $user_name ); |
1290 |
||
1291 |
if ( ! $user && strpos( $user_name, '@' ) ) { |
|
1292 |
$user = get_user_by( 'email', $user_name ); |
|
1293 |
} |
|
1294 |
||
1295 |
if ( $user ) { |
|
1296 |
if ( get_user_option( 'use_ssl', $user->ID ) ) { |
|
1297 |
$secure_cookie = true; |
|
1298 |
force_ssl_admin( true ); |
|
1299 |
} |
|
1300 |
} |
|
1301 |
} |
|
1302 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1303 |
if ( isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ) { |
9 | 1304 |
$redirect_to = $_REQUEST['redirect_to']; |
1305 |
// Redirect to HTTPS if user wants SSL. |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1306 |
if ( $secure_cookie && str_contains( $redirect_to, 'wp-admin' ) ) { |
9 | 1307 |
$redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to ); |
1308 |
} |
|
1309 |
} else { |
|
1310 |
$redirect_to = admin_url(); |
|
1311 |
} |
|
1312 |
||
1313 |
$reauth = empty( $_REQUEST['reauth'] ) ? false : true; |
|
1314 |
||
1315 |
$user = wp_signon( array(), $secure_cookie ); |
|
1316 |
||
1317 |
if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) { |
|
1318 |
if ( headers_sent() ) { |
|
1319 |
$user = new WP_Error( |
|
1320 |
'test_cookie', |
|
1321 |
sprintf( |
|
16 | 1322 |
/* translators: 1: Browser cookie documentation URL, 2: Support forums URL. */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1323 |
__( '<strong>Error:</strong> Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1324 |
__( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/' ), |
16 | 1325 |
__( 'https://wordpress.org/support/forums/' ) |
9 | 1326 |
) |
1327 |
); |
|
1328 |
} elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1329 |
// If cookies are disabled, the user can't log in even with a valid username and password. |
9 | 1330 |
$user = new WP_Error( |
1331 |
'test_cookie', |
|
1332 |
sprintf( |
|
16 | 1333 |
/* translators: %s: Browser cookie documentation URL. */ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1334 |
__( '<strong>Error:</strong> Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ), |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1335 |
__( 'https://developer.wordpress.org/advanced-administration/wordpress/cookies/#enable-cookies-in-your-browser' ) |
9 | 1336 |
) |
1337 |
); |
|
0 | 1338 |
} |
1339 |
} |
|
1340 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1341 |
$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) && is_string( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : ''; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1342 |
|
9 | 1343 |
/** |
1344 |
* Filters the login redirect URL. |
|
1345 |
* |
|
1346 |
* @since 3.0.0 |
|
1347 |
* |
|
1348 |
* @param string $redirect_to The redirect destination URL. |
|
1349 |
* @param string $requested_redirect_to The requested redirect destination URL passed as a parameter. |
|
1350 |
* @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. |
|
1351 |
*/ |
|
1352 |
$redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user ); |
|
0 | 1353 |
|
9 | 1354 |
if ( ! is_wp_error( $user ) && ! $reauth ) { |
1355 |
if ( $interim_login ) { |
|
1356 |
$message = '<p class="message">' . __( 'You have logged in successfully.' ) . '</p>'; |
|
1357 |
$interim_login = 'success'; |
|
1358 |
login_header( '', $message ); |
|
16 | 1359 |
|
9 | 1360 |
?> |
1361 |
</div> |
|
1362 |
<?php |
|
16 | 1363 |
|
9 | 1364 |
/** This action is documented in wp-login.php */ |
1365 |
do_action( 'login_footer' ); |
|
16 | 1366 |
|
1367 |
if ( $customize_login ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1368 |
ob_start(); |
16 | 1369 |
?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1370 |
<script>setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script> |
16 | 1371 |
<?php |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1372 |
wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); |
16 | 1373 |
} |
1374 |
||
9 | 1375 |
?> |
1376 |
</body></html> |
|
1377 |
<?php |
|
16 | 1378 |
|
9 | 1379 |
exit; |
1380 |
} |
|
1381 |
||
16 | 1382 |
// Check if it is time to add a redirect to the admin email confirmation screen. |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1383 |
if ( $user instanceof WP_User && $user->exists() && $user->has_cap( 'manage_options' ) ) { |
16 | 1384 |
$admin_email_lifespan = (int) get_option( 'admin_email_lifespan' ); |
1385 |
||
19 | 1386 |
/* |
1387 |
* If `0` (or anything "falsey" as it is cast to int) is returned, the user will not be redirected |
|
1388 |
* to the admin email confirmation screen. |
|
1389 |
*/ |
|
16 | 1390 |
/** This filter is documented in wp-login.php */ |
1391 |
$admin_email_check_interval = (int) apply_filters( 'admin_email_check_interval', 6 * MONTH_IN_SECONDS ); |
|
1392 |
||
1393 |
if ( $admin_email_check_interval > 0 && time() > $admin_email_lifespan ) { |
|
1394 |
$redirect_to = add_query_arg( |
|
1395 |
array( |
|
1396 |
'action' => 'confirm_admin_email', |
|
1397 |
'wp_lang' => get_user_locale( $user ), |
|
1398 |
), |
|
1399 |
wp_login_url( $redirect_to ) |
|
1400 |
); |
|
1401 |
} |
|
1402 |
} |
|
1403 |
||
1404 |
if ( ( empty( $redirect_to ) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) ) { |
|
9 | 1405 |
// If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile. |
1406 |
if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) { |
|
1407 |
$redirect_to = user_admin_url(); |
|
1408 |
} elseif ( is_multisite() && ! $user->has_cap( 'read' ) ) { |
|
1409 |
$redirect_to = get_dashboard_url( $user->ID ); |
|
1410 |
} elseif ( ! $user->has_cap( 'edit_posts' ) ) { |
|
1411 |
$redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url(); |
|
1412 |
} |
|
1413 |
||
1414 |
wp_redirect( $redirect_to ); |
|
16 | 1415 |
exit; |
9 | 1416 |
} |
16 | 1417 |
|
9 | 1418 |
wp_safe_redirect( $redirect_to ); |
16 | 1419 |
exit; |
9 | 1420 |
} |
1421 |
||
1422 |
$errors = $user; |
|
1423 |
// Clear errors if loggedout is set. |
|
1424 |
if ( ! empty( $_GET['loggedout'] ) || $reauth ) { |
|
1425 |
$errors = new WP_Error(); |
|
0 | 1426 |
} |
1427 |
||
9 | 1428 |
if ( empty( $_POST ) && $errors->get_error_codes() === array( 'empty_username', 'empty_password' ) ) { |
1429 |
$errors = new WP_Error( '', '' ); |
|
1430 |
} |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1431 |
|
9 | 1432 |
if ( $interim_login ) { |
1433 |
if ( ! $errors->has_errors() ) { |
|
1434 |
$errors->add( 'expired', __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' ); |
|
1435 |
} |
|
1436 |
} else { |
|
1437 |
// Some parts of this script use the main login form to display a message. |
|
16 | 1438 |
if ( isset( $_GET['loggedout'] ) && $_GET['loggedout'] ) { |
9 | 1439 |
$errors->add( 'loggedout', __( 'You are now logged out.' ), 'message' ); |
16 | 1440 |
} elseif ( isset( $_GET['registration'] ) && 'disabled' === $_GET['registration'] ) { |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1441 |
$errors->add( 'registerdisabled', __( '<strong>Error:</strong> User registration is currently not allowed.' ) ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1442 |
} elseif ( str_contains( $redirect_to, 'about.php?updated' ) ) { |
9 | 1443 |
$errors->add( 'updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what’s new.' ), 'message' ); |
1444 |
} elseif ( WP_Recovery_Mode_Link_Service::LOGIN_ACTION_ENTERED === $action ) { |
|
1445 |
$errors->add( 'enter_recovery_mode', __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' ); |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1446 |
} elseif ( isset( $_GET['redirect_to'] ) && is_string( $_GET['redirect_to'] ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1447 |
&& str_contains( $_GET['redirect_to'], 'wp-admin/authorize-application.php' ) |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1448 |
) { |
18 | 1449 |
$query_component = wp_parse_url( $_GET['redirect_to'], PHP_URL_QUERY ); |
19 | 1450 |
$query = array(); |
1451 |
if ( $query_component ) { |
|
1452 |
parse_str( $query_component, $query ); |
|
1453 |
} |
|
18 | 1454 |
|
1455 |
if ( ! empty( $query['app_name'] ) ) { |
|
1456 |
/* translators: 1: Website name, 2: Application name. */ |
|
1457 |
$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>' ); |
|
1458 |
} else { |
|
1459 |
/* translators: %s: Website name. */ |
|
1460 |
$message = sprintf( 'Please log in to %s to proceed with authorization.', get_bloginfo( 'name', 'display' ) ); |
|
1461 |
} |
|
1462 |
||
1463 |
$errors->add( 'authorize_application', $message, 'message' ); |
|
9 | 1464 |
} |
0 | 1465 |
} |
1466 |
||
9 | 1467 |
/** |
1468 |
* Filters the login page errors. |
|
1469 |
* |
|
1470 |
* @since 3.6.0 |
|
1471 |
* |
|
16 | 1472 |
* @param WP_Error $errors WP Error object. |
1473 |
* @param string $redirect_to Redirect destination URL. |
|
9 | 1474 |
*/ |
1475 |
$errors = apply_filters( 'wp_login_errors', $errors, $redirect_to ); |
|
1476 |
||
1477 |
// Clear any stale cookies. |
|
1478 |
if ( $reauth ) { |
|
1479 |
wp_clear_auth_cookie(); |
|
1480 |
} |
|
0 | 1481 |
|
9 | 1482 |
login_header( __( 'Log In' ), '', $errors ); |
0 | 1483 |
|
9 | 1484 |
if ( isset( $_POST['log'] ) ) { |
16 | 1485 |
$user_login = ( 'incorrect_password' === $errors->get_error_code() || 'empty_password' === $errors->get_error_code() ) ? esc_attr( wp_unslash( $_POST['log'] ) ) : ''; |
9 | 1486 |
} |
16 | 1487 |
|
9 | 1488 |
$rememberme = ! empty( $_POST['rememberme'] ); |
0 | 1489 |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1490 |
$aria_describedby = ''; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1491 |
$has_errors = $errors->has_errors(); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1492 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1493 |
if ( $has_errors ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1494 |
$aria_describedby = ' aria-describedby="login_error"'; |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1495 |
} |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1496 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1497 |
if ( $has_errors && 'message' === $errors->get_error_data() ) { |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1498 |
$aria_describedby = ' aria-describedby="login-message"'; |
9 | 1499 |
} |
16 | 1500 |
|
1501 |
wp_enqueue_script( 'user-profile' ); |
|
9 | 1502 |
?> |
5 | 1503 |
|
16 | 1504 |
<form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post"> |
1505 |
<p> |
|
1506 |
<label for="user_login"><?php _e( 'Username or Email Address' ); ?></label> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1507 |
<input type="text" name="log" id="user_login"<?php echo $aria_describedby; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" autocapitalize="off" autocomplete="username" required="required" /> |
16 | 1508 |
</p> |
1509 |
||
1510 |
<div class="user-pass-wrap"> |
|
1511 |
<label for="user_pass"><?php _e( 'Password' ); ?></label> |
|
1512 |
<div class="wp-pwd"> |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1513 |
<input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby; ?> class="input password-input" value="" size="20" autocomplete="current-password" spellcheck="false" required="required" /> |
16 | 1514 |
<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' ); ?>"> |
1515 |
<span class="dashicons dashicons-visibility" aria-hidden="true"></span> |
|
1516 |
</button> |
|
1517 |
</div> |
|
1518 |
</div> |
|
1519 |
<?php |
|
1520 |
||
1521 |
/** |
|
1522 |
* Fires following the 'Password' field in the login form. |
|
1523 |
* |
|
1524 |
* @since 2.1.0 |
|
1525 |
*/ |
|
1526 |
do_action( 'login_form' ); |
|
1527 |
||
1528 |
?> |
|
1529 |
<p class="forgetmenot"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <label for="rememberme"><?php esc_html_e( 'Remember Me' ); ?></label></p> |
|
1530 |
<p class="submit"> |
|
1531 |
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Log In' ); ?>" /> |
|
1532 |
<?php |
|
1533 |
||
1534 |
if ( $interim_login ) { |
|
1535 |
?> |
|
1536 |
<input type="hidden" name="interim-login" value="1" /> |
|
1537 |
<?php |
|
1538 |
} else { |
|
1539 |
?> |
|
1540 |
<input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" /> |
|
1541 |
<?php |
|
1542 |
} |
|
1543 |
||
1544 |
if ( $customize_login ) { |
|
1545 |
?> |
|
1546 |
<input type="hidden" name="customize-login" value="1" /> |
|
1547 |
<?php |
|
1548 |
} |
|
1549 |
||
1550 |
?> |
|
1551 |
<input type="hidden" name="testcookie" value="1" /> |
|
1552 |
</p> |
|
1553 |
</form> |
|
1554 |
||
9 | 1555 |
<?php |
0 | 1556 |
|
16 | 1557 |
if ( ! $interim_login ) { |
1558 |
?> |
|
1559 |
<p id="nav"> |
|
1560 |
<?php |
|
1561 |
||
1562 |
if ( get_option( 'users_can_register' ) ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1563 |
$registration_url = sprintf( '<a class="wp-login-register" href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) ); |
5 | 1564 |
|
9 | 1565 |
/** This filter is documented in wp-includes/general-template.php */ |
1566 |
echo apply_filters( 'register', $registration_url ); |
|
7
cf61fcea0001
resynchronize code repo with production
ymh <ymh.work@gmail.com>
parents:
5
diff
changeset
|
1567 |
|
9 | 1568 |
echo esc_html( $login_link_separator ); |
16 | 1569 |
} |
1570 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1571 |
$html_link = sprintf( '<a class="wp-login-lost-password" href="%s">%s</a>', esc_url( wp_lostpassword_url() ), __( 'Lost your password?' ) ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1572 |
|
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1573 |
/** |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1574 |
* Filters the link that allows the user to reset the lost password. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1575 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1576 |
* @since 6.1.0 |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1577 |
* |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1578 |
* @param string $html_link HTML link to the lost password form. |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1579 |
*/ |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1580 |
echo apply_filters( 'lost_password_html_link', $html_link ); |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1581 |
|
9 | 1582 |
?> |
16 | 1583 |
</p> |
1584 |
<?php |
|
1585 |
} |
|
1586 |
||
1587 |
$login_script = 'function wp_attempt_focus() {'; |
|
1588 |
$login_script .= 'setTimeout( function() {'; |
|
1589 |
$login_script .= 'try {'; |
|
0 | 1590 |
|
16 | 1591 |
if ( $user_login ) { |
1592 |
$login_script .= 'd = document.getElementById( "user_pass" ); d.value = "";'; |
|
1593 |
} else { |
|
1594 |
$login_script .= 'd = document.getElementById( "user_login" );'; |
|
1595 |
||
1596 |
if ( $errors->get_error_code() === 'invalid_username' ) { |
|
1597 |
$login_script .= 'd.value = "";'; |
|
9 | 1598 |
} |
16 | 1599 |
} |
0 | 1600 |
|
16 | 1601 |
$login_script .= 'd.focus(); d.select();'; |
1602 |
$login_script .= '} catch( er ) {}'; |
|
1603 |
$login_script .= '}, 200);'; |
|
1604 |
$login_script .= "}\n"; // End of wp_attempt_focus(). |
|
1605 |
||
9 | 1606 |
/** |
1607 |
* Filters whether to print the call to `wp_attempt_focus()` on the login screen. |
|
1608 |
* |
|
1609 |
* @since 4.8.0 |
|
1610 |
* |
|
1611 |
* @param bool $print Whether to print the function call. Default true. |
|
1612 |
*/ |
|
1613 |
if ( apply_filters( 'enable_login_autofocus', true ) && ! $error ) { |
|
16 | 1614 |
$login_script .= "wp_attempt_focus();\n"; |
1615 |
} |
|
1616 |
||
1617 |
// Run `wpOnload()` if defined. |
|
1618 |
$login_script .= "if ( typeof wpOnload === 'function' ) { wpOnload() }"; |
|
1619 |
||
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1620 |
wp_print_inline_script_tag( $login_script ); |
16 | 1621 |
|
1622 |
if ( $interim_login ) { |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1623 |
ob_start(); |
9 | 1624 |
?> |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1625 |
<script> |
16 | 1626 |
( function() { |
1627 |
try { |
|
1628 |
var i, links = document.getElementsByTagName( 'a' ); |
|
1629 |
for ( i in links ) { |
|
1630 |
if ( links[i].href ) { |
|
1631 |
links[i].target = '_blank'; |
|
18 | 1632 |
links[i].rel = 'noopener'; |
16 | 1633 |
} |
1634 |
} |
|
1635 |
} catch( er ) {} |
|
1636 |
}()); |
|
1637 |
</script> |
|
1638 |
<?php |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
19
diff
changeset
|
1639 |
wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) ); |
9 | 1640 |
} |
0 | 1641 |
|
9 | 1642 |
login_footer(); |
1643 |
break; |
|
1644 |
} // End action switch. |