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