Rename wp-login.php - Version 2.5

Version Description

  • Use wp-login.php instead of copying the file.
  • Don't add notices for W3 Total Cache and WP Super Cache.
Download this release

Release Info

Developer avryl
Plugin Icon 128x128 Rename wp-login.php
Version 2.5
Comparing to
See all releases

Code changes from version 2.4 to 2.5

Files changed (4) hide show
  1. index.php +0 -3
  2. readme.txt +19 -17
  3. rename-wp-login.php +8 -30
  4. rwl-login.php +0 -954
index.php CHANGED
@@ -1,3 +0,0 @@
1
- <?php
2
-
3
- // Silence is golden.
 
 
 
readme.txt CHANGED
@@ -1,23 +1,28 @@
1
  === Rename wp-login.php ===
2
 
3
  Contributors: avryl
4
- Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=49WXVSPP2HUKG
5
- Tags: rename, login, wp-login, wp-login.php, brute force attacks, custom login url, security
6
- Requires at least: 4.0
7
- Tested up to: 4.0
8
- Stable tag: 2.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- Change wp-login.php to anything you want. It can also prevent a lot of brute force attacks.
13
 
14
  == Description ==
15
 
 
 
 
 
 
 
16
  *Rename wp-login.php* is a very light plugin that lets you easily and safely change wp-login.php to anything you want. It doesn’t literally rename or change files in core, nor does it add rewrite rules. It simply intercepts page requests and works on any WordPress website. The wp-admin directory and wp-login.php page become inaccessible, so you should bookmark or remember the url. Deactivating this plugin brings your site back exactly to the state it was before.
17
 
18
  = Compatibility =
19
 
20
- Requires WordPress 3.8 or higher. All login related things such as the registration form, lost password form, login widget and expired sessions just keep working.
21
 
22
  It’s also compatible with any plugin that hooks in the login form, including
23
 
@@ -28,21 +33,13 @@ It’s also compatible with any plugin that hooks in the login form, including
28
 
29
  Obviously it doesn’t work with plugins that *hardcoded* wp-login.php.
30
 
31
- This also works with multisite! Activating it for a network allows you to set a networkwide default. Individual sites can still rename their login page to something else.
32
 
33
  If you’re using a **page caching plugin** you should add the slug of the new login url to the list of pages not to cache. For W3 Total Cache and WP Super Cache this plugin will give you a message with a link to the field you should update.
34
 
35
- = Benefits =
36
-
37
- Not only does it allow you to further customise your login page, it also prevents brute force attacks that are targeted specifically to wp-login.php. Both the wp-login.php page and the wp-admin directory (if not logged in) become inaccessible.
38
-
39
- While you could use this plugin to prevent a lot of brute force attacks, it does not mean you don’t need a strong password. Read [this codex article](http://codex.wordpress.org/Brute_Force_Attacks) for more information on how to protect your website.
40
-
41
- Of course, if you want to keep your login page secret, you should make sure there aren’t any links pointing to it on your website.
42
-
43
  = GitHub =
44
 
45
- This plugin has a [mirror](https://github.com/avryl/rename-wp-login) on GitHub.
46
 
47
  == Installation ==
48
 
@@ -62,6 +59,11 @@ On a multisite install the `rwl_page` option will be in the sitemeta table, if t
62
 
63
  == Changelog ==
64
 
 
 
 
 
 
65
  = 2.4 =
66
 
67
  * WordPress 4.0 compatible.
1
  === Rename wp-login.php ===
2
 
3
  Contributors: avryl
4
+ Tags: rename, login, wp-login, wp-login.php, custom login url
5
+ Requires at least: 4.1
6
+ Tested up to: 4.1
7
+ Stable tag: 2.5
 
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
11
+ Change wp-login.php to anything you want.
12
 
13
  == Description ==
14
 
15
+ ***
16
+
17
+ I don't actively work on this plugin anymore, so use at your own risk.
18
+
19
+ ***
20
+
21
  *Rename wp-login.php* is a very light plugin that lets you easily and safely change wp-login.php to anything you want. It doesn’t literally rename or change files in core, nor does it add rewrite rules. It simply intercepts page requests and works on any WordPress website. The wp-admin directory and wp-login.php page become inaccessible, so you should bookmark or remember the url. Deactivating this plugin brings your site back exactly to the state it was before.
22
 
23
  = Compatibility =
24
 
25
+ Requires WordPress 4.1 or higher. All login related things such as the registration form, lost password form, login widget and expired sessions just keep working.
26
 
27
  It’s also compatible with any plugin that hooks in the login form, including
28
 
33
 
34
  Obviously it doesn’t work with plugins that *hardcoded* wp-login.php.
35
 
36
+ Works with multisite, but not tested with subdomains. Activating it for a network allows you to set a networkwide default. Individual sites can still rename their login page to something else.
37
 
38
  If you’re using a **page caching plugin** you should add the slug of the new login url to the list of pages not to cache. For W3 Total Cache and WP Super Cache this plugin will give you a message with a link to the field you should update.
39
 
 
 
 
 
 
 
 
 
40
  = GitHub =
41
 
42
+ https://github.com/avryl/rename-wp-login
43
 
44
  == Installation ==
45
 
59
 
60
  == Changelog ==
61
 
62
+ = 2.5 =
63
+
64
+ * Use wp-login.php instead of copying the file.
65
+ * Don't add notices for W3 Total Cache and WP Super Cache.
66
+
67
  = 2.4 =
68
 
69
  * WordPress 4.0 compatible.
rename-wp-login.php CHANGED
@@ -1,12 +1,12 @@
1
  <?php
2
 
3
  /*
4
- Plugin Name: Rename wp-login.php
5
  Plugin URI: http://wordpress.org/plugins/rename-wp-login/
6
- Description: Change wp-login.php to whatever you want. It can also prevent a lot of brute force attacks.
7
  Author: avryl
8
  Author URI: http://profiles.wordpress.org/avryl/
9
- Version: 2.4
10
  Text Domain: rename-wp-login
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -340,7 +340,7 @@ if ( defined( 'ABSPATH' )
340
 
341
  public function admin_notices() {
342
 
343
- global $pagenow, $cache_rejected_uri;
344
 
345
  $out = '';
346
 
@@ -348,34 +348,10 @@ if ( defined( 'ABSPATH' )
348
  && $pagenow === 'options-permalink.php'
349
  && isset( $_GET['settings-updated'] ) ) {
350
 
351
- $out .= '<div class="updated"><p>Your login page is now here: <strong><a href="' . $this->new_login_url() . '">' . $this->new_login_url() . '</a></strong>. Bookmark this page!</p></div>';
352
-
353
- }
354
-
355
- if ( current_user_can( 'manage_options' )
356
- && function_exists( 'w3_instance' )
357
- && ( $w3tc = w3_instance( 'W3_Config' ) )
358
- && ( $w3tc = $w3tc->get_array( 'pgcache.reject.uri' ) )
359
- && ! in_array( $this->new_login_slug(), $w3tc ) ) {
360
-
361
- $admin_url = admin_url( 'admin.php?page=w3tc_pgcache#pgcache_reject_uri' );
362
-
363
- $out .= '<div class="update-nag"><strong>W3 Total Cache</strong> is enabled on your website. To make sure <strong>Rename wp-login.php</strong> works correctly, you should add <strong>' . $this->new_login_slug() . '</strong> to <a href="' . $admin_url . '">Never cache the following pages</a>. This notice will disappear once you’ve done that correctly.</div>';
364
-
365
- }
366
-
367
- if ( current_user_can( 'manage_options' )
368
- && is_array( $cache_rejected_uri )
369
- && ! in_array( $this->new_login_slug(), $cache_rejected_uri ) ) {
370
-
371
- $admin_url = is_network_admin() ? network_admin_url( 'settings.php?page=wpsupercache&tab=settings#rejecturi' ) : admin_url( 'options-general.php?page=wpsupercache&tab=settings#rejecturi' );
372
-
373
- $out .= '<div class="update-nag"><strong>WP Super Cache</strong> is enabled on your website. To make sure <strong>Rename wp-login.php</strong> works correctly, you should add <strong>' . $this->new_login_slug() . '</strong> to <a href="' . $admin_url . '">Rejected URIs</a>. This notice will disappear once you’ve done that correctly.</div>';
374
 
375
  }
376
 
377
- echo $out;
378
-
379
  }
380
 
381
  public function plugin_action_links( $links ) {
@@ -489,7 +465,9 @@ if ( defined( 'ABSPATH' )
489
 
490
  elseif ( $pagenow === 'wp-login.php' ) {
491
 
492
- require_once $this->path() . 'rwl-login.php';
 
 
493
 
494
  die;
495
 
1
  <?php
2
 
3
  /*
4
+ Plugin Name: Rename wp-login.php (unmaintained)
5
  Plugin URI: http://wordpress.org/plugins/rename-wp-login/
6
+ Description: Change wp-login.php to whatever you want.
7
  Author: avryl
8
  Author URI: http://profiles.wordpress.org/avryl/
9
+ Version: 2.5
10
  Text Domain: rename-wp-login
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
340
 
341
  public function admin_notices() {
342
 
343
+ global $pagenow;
344
 
345
  $out = '';
346
 
348
  && $pagenow === 'options-permalink.php'
349
  && isset( $_GET['settings-updated'] ) ) {
350
 
351
+ echo '<div class="updated"><p>Your login page is now here: <strong><a href="' . $this->new_login_url() . '">' . $this->new_login_url() . '</a></strong>. Bookmark this page!</p></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
352
 
353
  }
354
 
 
 
355
  }
356
 
357
  public function plugin_action_links( $links ) {
465
 
466
  elseif ( $pagenow === 'wp-login.php' ) {
467
 
468
+ global $error, $interim_login, $action, $user_login;
469
+
470
+ @require_once ABSPATH . 'wp-login.php';
471
 
472
  die;
473
 
rwl-login.php DELETED
@@ -1,954 +0,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. */
12
- // require( dirname(__FILE__) . '/wp-load.php' );
13
-
14
- global $error, $interim_login, $action, $user_login;
15
-
16
- // Redirect to https login if forced to use SSL
17
- if ( force_ssl_admin() && ! is_ssl() ) {
18
- if ( 0 === strpos($_SERVER['REQUEST_URI'], 'http') ) {
19
- wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
20
- exit();
21
- } else {
22
- wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
23
- exit();
24
- }
25
- }
26
-
27
- /**
28
- * Output the login page header.
29
- *
30
- * @param string $title Optional. WordPress Log In Page title to display in <title> element. Default 'Log In'.
31
- * @param string $message Optional. Message to display in header. Default empty.
32
- * @param WP_Error $wp_error Optional. The error to pass. Default empty.
33
- */
34
- function login_header( $title = 'Log In', $message = '', $wp_error = '' ) {
35
- global $error, $interim_login, $action;
36
-
37
- // Don't index any of these forms
38
- add_action( 'login_head', 'wp_no_robots' );
39
-
40
- if ( wp_is_mobile() )
41
- add_action( 'login_head', 'wp_login_viewport_meta' );
42
-
43
- if ( empty($wp_error) )
44
- $wp_error = new WP_Error();
45
-
46
- // Shake it!
47
- $shake_error_codes = array( 'empty_password', 'empty_email', 'invalid_email', 'invalidcombo', 'empty_username', 'invalid_username', 'incorrect_password' );
48
- /**
49
- * Filter the error codes array for shaking the login form.
50
- *
51
- * @since 3.0.0
52
- *
53
- * @param array $shake_error_codes Error codes that shake the login form.
54
- */
55
- $shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );
56
-
57
- if ( $shake_error_codes && $wp_error->get_error_code() && in_array( $wp_error->get_error_code(), $shake_error_codes ) )
58
- add_action( 'login_head', 'wp_shake_js', 12 );
59
-
60
- ?><!DOCTYPE html>
61
- <!--[if IE 8]>
62
- <html xmlns="http://www.w3.org/1999/xhtml" class="ie8" <?php language_attributes(); ?>>
63
- <![endif]-->
64
- <!--[if !(IE 8) ]><!-->
65
- <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
66
- <!--<![endif]-->
67
- <head>
68
- <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
69
- <title><?php bloginfo('name'); ?> &rsaquo; <?php echo $title; ?></title>
70
- <?php
71
-
72
- wp_admin_css( 'login', true );
73
-
74
- /*
75
- * Remove all stored post data on logging out.
76
- * This could be added by add_action('login_head'...) like wp_shake_js(),
77
- * but maybe better if it's not removable by plugins
78
- */
79
- if ( 'loggedout' == $wp_error->get_error_code() ) {
80
- ?>
81
- <script>if("sessionStorage" in window){try{for(var key in sessionStorage){if(key.indexOf("wp-autosave-")!=-1){sessionStorage.removeItem(key)}}}catch(e){}};</script>
82
- <?php
83
- }
84
-
85
- /**
86
- * Enqueue scripts and styles for the login page.
87
- *
88
- * @since 3.1.0
89
- */
90
- do_action( 'login_enqueue_scripts' );
91
- /**
92
- * Fires in the login page header after scripts are enqueued.
93
- *
94
- * @since 2.1.0
95
- */
96
- do_action( 'login_head' );
97
-
98
- if ( is_multisite() ) {
99
- $login_header_url = network_home_url();
100
- $login_header_title = get_current_site()->site_name;
101
- } else {
102
- $login_header_url = __( 'https://wordpress.org/' );
103
- $login_header_title = __( 'Powered by WordPress' );
104
- }
105
-
106
- /**
107
- * Filter link URL of the header logo above login form.
108
- *
109
- * @since 2.1.0
110
- *
111
- * @param string $login_header_url Login header logo URL.
112
- */
113
- $login_header_url = apply_filters( 'login_headerurl', $login_header_url );
114
- /**
115
- * Filter the title attribute of the header logo above login form.
116
- *
117
- * @since 2.1.0
118
- *
119
- * @param string $login_header_title Login header logo title attribute.
120
- */
121
- $login_header_title = apply_filters( 'login_headertitle', $login_header_title );
122
-
123
- $classes = array( 'login-action-' . $action, 'wp-core-ui' );
124
- if ( wp_is_mobile() )
125
- $classes[] = 'mobile';
126
- if ( is_rtl() )
127
- $classes[] = 'rtl';
128
- if ( $interim_login ) {
129
- $classes[] = 'interim-login';
130
- ?>
131
- <style type="text/css">html{background-color: transparent;}</style>
132
- <?php
133
-
134
- if ( 'success' === $interim_login )
135
- $classes[] = 'interim-login-success';
136
- }
137
- $classes[] =' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
138
-
139
- /**
140
- * Filter the login page body classes.
141
- *
142
- * @since 3.5.0
143
- *
144
- * @param array $classes An array of body classes.
145
- * @param string $action The action that brought the visitor to the login page.
146
- */
147
- $classes = apply_filters( 'login_body_class', $classes, $action );
148
-
149
- ?>
150
- </head>
151
- <body class="login <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
152
- <div id="login">
153
- <h1><a href="<?php echo esc_url( $login_header_url ); ?>" title="<?php echo esc_attr( $login_header_title ); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
154
- <?php
155
-
156
- unset( $login_header_url, $login_header_title );
157
-
158
- /**
159
- * Filter the message to display above the login form.
160
- *
161
- * @since 2.1.0
162
- *
163
- * @param string $message Login message text.
164
- */
165
- $message = apply_filters( 'login_message', $message );
166
- if ( !empty( $message ) )
167
- echo $message . "\n";
168
-
169
- // In case a plugin uses $error rather than the $wp_errors object
170
- if ( !empty( $error ) ) {
171
- $wp_error->add('error', $error);
172
- unset($error);
173
- }
174
-
175
- if ( $wp_error->get_error_code() ) {
176
- $errors = '';
177
- $messages = '';
178
- foreach ( $wp_error->get_error_codes() as $code ) {
179
- $severity = $wp_error->get_error_data( $code );
180
- foreach ( $wp_error->get_error_messages( $code ) as $error_message ) {
181
- if ( 'message' == $severity )
182
- $messages .= ' ' . $error_message . "<br />\n";
183
- else
184
- $errors .= ' ' . $error_message . "<br />\n";
185
- }
186
- }
187
- if ( ! empty( $errors ) ) {
188
- /**
189
- * Filter the error messages displayed above the login form.
190
- *
191
- * @since 2.1.0
192
- *
193
- * @param string $errors Login error message.
194
- */
195
- echo '<div id="login_error">' . apply_filters( 'login_errors', $errors ) . "</div>\n";
196
- }
197
- if ( ! empty( $messages ) ) {
198
- /**
199
- * Filter instructional messages displayed above the login form.
200
- *
201
- * @since 2.5.0
202
- *
203
- * @param string $messages Login messages.
204
- */
205
- echo '<p class="message">' . apply_filters( 'login_messages', $messages ) . "</p>\n";
206
- }
207
- }
208
- } // End of login_header()
209
-
210
- /**
211
- * Outputs the footer for the login page.
212
- *
213
- * @param string $input_id Which input to auto-focus
214
- */
215
- function login_footer($input_id = '') {
216
- global $interim_login;
217
-
218
- // Don't allow interim logins to navigate away from the page.
219
- if ( ! $interim_login ): ?>
220
- <p id="backtoblog"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php esc_attr_e( 'Are you lost?' ); ?>"><?php printf( __( '&larr; Back to %s' ), get_bloginfo( 'title', 'display' ) ); ?></a></p>
221
- <?php endif; ?>
222
-
223
- </div>
224
-
225
- <?php if ( !empty($input_id) ) : ?>
226
- <script type="text/javascript">
227
- try{document.getElementById('<?php echo $input_id; ?>').focus();}catch(e){}
228
- if(typeof wpOnload=='function')wpOnload();
229
- </script>
230
- <?php endif; ?>
231
-
232
- <?php
233
- /**
234
- * Fires in the login page footer.
235
- *
236
- * @since 3.1.0
237
- */
238
- do_action( 'login_footer' ); ?>
239
- <div class="clear"></div>
240
- </body>
241
- </html>
242
- <?php
243
- }
244
-
245
- function wp_shake_js() {
246
- if ( wp_is_mobile() )
247
- return;
248
- ?>
249
- <script type="text/javascript">
250
- addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
251
- function s(id,pos){g(id).left=pos+'px';}
252
- function g(id){return document.getElementById(id).style;}
253
- function shake(id,a,d){c=a.shift();s(id,c);if(a.length>0){setTimeout(function(){shake(id,a,d);},d);}else{try{g(id).position='static';wp_attempt_focus();}catch(e){}}}
254
- addLoadEvent(function(){ var p=new Array(15,30,15,0,-15,-30,-15,0);p=p.concat(p.concat(p));var i=document.forms[0].id;g(i).position='relative';shake(i,p,20);});
255
- </script>
256
- <?php
257
- }
258
-
259
- function wp_login_viewport_meta() {
260
- ?>
261
- <meta name="viewport" content="width=device-width" />
262
- <?php
263
- }
264
-
265
- /**
266
- * Handles sending password retrieval email to user.
267
- *
268
- * @uses $wpdb WordPress Database object
269
- *
270
- * @return bool|WP_Error True: when finish. WP_Error on error
271
- */
272
- function retrieve_password() {
273
- global $wpdb, $wp_hasher;
274
-
275
- $errors = new WP_Error();
276
-
277
- if ( empty( $_POST['user_login'] ) ) {
278
- $errors->add('empty_username', __('<strong>ERROR</strong>: Enter a username or e-mail address.'));
279
- } else if ( strpos( $_POST['user_login'], '@' ) ) {
280
- $user_data = get_user_by( 'email', trim( $_POST['user_login'] ) );
281
- if ( empty( $user_data ) )
282
- $errors->add('invalid_email', __('<strong>ERROR</strong>: There is no user registered with that email address.'));
283
- } else {
284
- $login = trim($_POST['user_login']);
285
- $user_data = get_user_by('login', $login);
286
- }
287
-
288
- /**
289
- * Fires before errors are returned from a password reset request.
290
- *
291
- * @since 2.1.0
292
- */
293
- do_action( 'lostpassword_post' );
294
-
295
- if ( $errors->get_error_code() )
296
- return $errors;
297
-
298
- if ( !$user_data ) {
299
- $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or e-mail.'));
300
- return $errors;
301
- }
302
-
303
- // Redefining user_login ensures we return the right case in the email.
304
- $user_login = $user_data->user_login;
305
- $user_email = $user_data->user_email;
306
-
307
- /**
308
- * Fires before a new password is retrieved.
309
- *
310
- * @since 1.5.0
311
- * @deprecated 1.5.1 Misspelled. Use 'retrieve_password' hook instead.
312
- *
313
- * @param string $user_login The user login name.
314
- */
315
- do_action( 'retreive_password', $user_login );
316
-
317
- /**
318
- * Fires before a new password is retrieved.
319
- *
320
- * @since 1.5.1
321
- *
322
- * @param string $user_login The user login name.
323
- */
324
- do_action( 'retrieve_password', $user_login );
325
-
326
- /**
327
- * Filter whether to allow a password to be reset.
328
- *
329
- * @since 2.7.0
330
- *
331
- * @param bool true Whether to allow the password to be reset. Default true.
332
- * @param int $user_data->ID The ID of the user attempting to reset a password.
333
- */
334
- $allow = apply_filters( 'allow_password_reset', true, $user_data->ID );
335
-
336
- if ( ! $allow )
337
- return new WP_Error('no_password_reset', __('Password reset is not allowed for this user'));
338
- else if ( is_wp_error($allow) )
339
- return $allow;
340
-
341
- // Generate something random for a password reset key.
342
- $key = wp_generate_password( 20, false );
343
-
344
- /**
345
- * Fires when a password reset key is generated.
346
- *
347
- * @since 2.5.0
348
- *
349
- * @param string $user_login The username for the user.
350
- * @param string $key The generated password reset key.
351
- */
352
- do_action( 'retrieve_password_key', $user_login, $key );
353
-
354
- // Now insert the key, hashed, into the DB.
355
- if ( empty( $wp_hasher ) ) {
356
- require_once ABSPATH . WPINC . '/class-phpass.php';
357
- $wp_hasher = new PasswordHash( 8, true );
358
- }
359
- $hashed = $wp_hasher->HashPassword( $key );
360
- $wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user_login ) );
361
-
362
- $message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
363
- $message .= network_home_url( '/' ) . "\r\n\r\n";
364
- $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
365
- $message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
366
- $message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
367
- $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
368
-
369
- if ( is_multisite() )
370
- $blogname = $GLOBALS['current_site']->site_name;
371
- else
372
- /*
373
- * The blogname option is escaped with esc_html on the way into the database
374
- * in sanitize_option we want to reverse this for the plain text arena of emails.
375
- */
376
- $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
377
-
378
- $title = sprintf( __('[%s] Password Reset'), $blogname );
379
-
380
- /**
381
- * Filter the subject of the password reset email.
382
- *
383
- * @since 2.8.0
384
- *
385
- * @param string $title Default email title.
386
- */
387
- $title = apply_filters( 'retrieve_password_title', $title );
388
- /**
389
- * Filter the message body of the password reset mail.
390
- *
391
- * @since 2.8.0
392
- *
393
- * @param string $message Default mail message.
394
- * @param string $key The activation key.
395
- */
396
- $message = apply_filters( 'retrieve_password_message', $message, $key );
397
-
398
- if ( $message && !wp_mail( $user_email, wp_specialchars_decode( $title ), $message ) )
399
- wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.') );
400
-
401
- return true;
402
- }
403
-
404
- //
405
- // Main
406
- //
407
-
408
- $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'login';
409
- $errors = new WP_Error();
410
-
411
- if ( isset($_GET['key']) )
412
- $action = 'resetpass';
413
-
414
- // validate action so as to default to the login screen
415
- if ( !in_array( $action, array( 'postpass', 'logout', 'lostpassword', 'retrievepassword', 'resetpass', 'rp', 'register', 'login' ), true ) && false === has_filter( 'login_form_' . $action ) )
416
- $action = 'login';
417
-
418
- nocache_headers();
419
-
420
- header('Content-Type: '.get_bloginfo('html_type').'; charset='.get_bloginfo('charset'));
421
-
422
- if ( defined( 'RELOCATE' ) && RELOCATE ) { // Move flag is set
423
- if ( isset( $_SERVER['PATH_INFO'] ) && ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
424
- $_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], '', $_SERVER['PHP_SELF'] );
425
-
426
- $url = dirname( set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
427
- if ( $url != get_option( 'siteurl' ) )
428
- update_option( 'siteurl', $url );
429
- }
430
-
431
- //Set a cookie now to see if they are supported by the browser.
432
- $secure = ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) && 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
433
- setcookie( TEST_COOKIE, 'WP Cookie check', 0, COOKIEPATH, COOKIE_DOMAIN, $secure );
434
- if ( SITECOOKIEPATH != COOKIEPATH )
435
- setcookie( TEST_COOKIE, 'WP Cookie check', 0, SITECOOKIEPATH, COOKIE_DOMAIN, $secure );
436
-
437
- /**
438
- * Fires when the login form is initialized.
439
- *
440
- * @since 3.2.0
441
- */
442
- do_action( 'login_init' );
443
- /**
444
- * Fires before a specified login form action.
445
- *
446
- * The dynamic portion of the hook name, $action, refers to the action
447
- * that brought the visitor to the login form. Actions include 'postpass',
448
- * 'logout', 'lostpassword', etc.
449
- *
450
- * @since 2.8.0
451
- */
452
- do_action( 'login_form_' . $action );
453
-
454
- $http_post = ('POST' == $_SERVER['REQUEST_METHOD']);
455
- $interim_login = isset($_REQUEST['interim-login']);
456
-
457
- switch ($action) {
458
-
459
- case 'postpass' :
460
- require_once ABSPATH . WPINC . '/class-phpass.php';
461
- $hasher = new PasswordHash( 8, true );
462
-
463
- /**
464
- * Filter the life span of the post password cookie.
465
- *
466
- * By default, the cookie expires 10 days from creation. To turn this
467
- * into a session cookie, return 0.
468
- *
469
- * @since 3.7.0
470
- *
471
- * @param int $expires The expiry time, as passed to setcookie().
472
- */
473
- $expire = apply_filters( 'post_password_expires', time() + 10 * DAY_IN_SECONDS );
474
- $secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
475
- setcookie( 'wp-postpass_' . COOKIEHASH, $hasher->HashPassword( wp_unslash( $_POST['post_password'] ) ), $expire, COOKIEPATH, COOKIE_DOMAIN, $secure );
476
-
477
- wp_safe_redirect( wp_get_referer() );
478
- exit();
479
-
480
- case 'logout' :
481
- check_admin_referer('log-out');
482
- wp_logout();
483
-
484
- $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?loggedout=true';
485
- wp_safe_redirect( $redirect_to );
486
- exit();
487
-
488
- case 'lostpassword' :
489
- case 'retrievepassword' :
490
-
491
- if ( $http_post ) {
492
- $errors = retrieve_password();
493
- if ( !is_wp_error($errors) ) {
494
- $redirect_to = !empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : 'wp-login.php?checkemail=confirm';
495
- wp_safe_redirect( $redirect_to );
496
- exit();
497
- }
498
- }
499
-
500
- if ( isset( $_GET['error'] ) ) {
501
- if ( 'invalidkey' == $_GET['error'] )
502
- $errors->add( 'invalidkey', __( 'Sorry, that key does not appear to be valid.' ) );
503
- elseif ( 'expiredkey' == $_GET['error'] )
504
- $errors->add( 'expiredkey', __( 'Sorry, that key has expired. Please try again.' ) );
505
- }
506
-
507
- $lostpassword_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
508
- /**
509
- * Filter the URL redirected to after submitting the lostpassword/retrievepassword form.
510
- *
511
- * @since 3.0.0
512
- *
513
- * @param string $lostpassword_redirect The redirect destination URL.
514
- */
515
- $redirect_to = apply_filters( 'lostpassword_redirect', $lostpassword_redirect );
516
-
517
- /**
518
- * Fires before the lost password form.
519
- *
520
- * @since 1.5.1
521
- */
522
- do_action( 'lost_password' );
523
-
524
- login_header(__('Lost Password'), '<p class="message">' . __('Please enter your username or email address. You will receive a link to create a new password via email.') . '</p>', $errors);
525
-
526
- $user_login = isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
527
-
528
- ?>
529
-
530
- <form name="lostpasswordform" id="lostpasswordform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=lostpassword', 'login_post' ) ); ?>" method="post">
531
- <p>
532
- <label for="user_login" ><?php _e('Username or E-mail:') ?><br />
533
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
534
- </p>
535
- <?php
536
- /**
537
- * Fires inside the lostpassword <form> tags, before the hidden fields.
538
- *
539
- * @since 2.1.0
540
- */
541
- do_action( 'lostpassword_form' ); ?>
542
- <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
543
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Get New Password'); ?>" /></p>
544
- </form>
545
-
546
- <p id="nav">
547
- <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e('Log in') ?></a>
548
- <?php
549
- if ( get_option( 'users_can_register' ) ) :
550
- $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
551
-
552
- /** This filter is documented in wp-includes/general-template.php */
553
- echo ' | ' . apply_filters( 'register', $registration_url );
554
- endif;
555
- ?>
556
- </p>
557
-
558
- <?php
559
- login_footer('user_login');
560
- break;
561
-
562
- case 'resetpass' :
563
- case 'rp' :
564
- list( $rp_path ) = explode( '?', wp_unslash( $_SERVER['REQUEST_URI'] ) );
565
- $rp_cookie = 'wp-resetpass-' . COOKIEHASH;
566
- if ( isset( $_GET['key'] ) ) {
567
- $value = sprintf( '%s:%s', wp_unslash( $_GET['login'] ), wp_unslash( $_GET['key'] ) );
568
- setcookie( $rp_cookie, $value, 0, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
569
- wp_safe_redirect( remove_query_arg( array( 'key', 'login' ) ) );
570
- exit;
571
- }
572
-
573
- if ( isset( $_COOKIE[ $rp_cookie ] ) && 0 < strpos( $_COOKIE[ $rp_cookie ], ':' ) ) {
574
- list( $rp_login, $rp_key ) = explode( ':', wp_unslash( $_COOKIE[ $rp_cookie ] ), 2 );
575
- $user = check_password_reset_key( $rp_key, $rp_login );
576
- } else {
577
- $user = false;
578
- }
579
-
580
- if ( ! $user || is_wp_error( $user ) ) {
581
- setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
582
- if ( $user && $user->get_error_code() === 'expired_key' )
583
- wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=expiredkey' ) );
584
- else
585
- wp_redirect( site_url( 'wp-login.php?action=lostpassword&error=invalidkey' ) );
586
- exit;
587
- }
588
-
589
- $errors = new WP_Error();
590
-
591
- if ( isset($_POST['pass1']) && $_POST['pass1'] != $_POST['pass2'] )
592
- $errors->add( 'password_reset_mismatch', __( 'The passwords do not match.' ) );
593
-
594
- /**
595
- * Fires before the password reset procedure is validated.
596
- *
597
- * @since 3.5.0
598
- *
599
- * @param object $errors WP Error object.
600
- * @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise.
601
- */
602
- do_action( 'validate_password_reset', $errors, $user );
603
-
604
- if ( ( ! $errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
605
- reset_password($user, $_POST['pass1']);
606
- setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
607
- login_header( __( 'Password Reset' ), '<p class="message reset-pass">' . __( 'Your password has been reset.' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in' ) . '</a></p>' );
608
- login_footer();
609
- exit;
610
- }
611
-
612
- wp_enqueue_script('utils');
613
- wp_enqueue_script('user-profile');
614
-
615
- login_header(__('Reset Password'), '<p class="message reset-pass">' . __('Enter your new password below.') . '</p>', $errors );
616
-
617
- ?>
618
- <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
619
- <input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />
620
-
621
- <p>
622
- <label for="pass1"><?php _e('New password') ?><br />
623
- <input type="password" name="pass1" id="pass1" class="input" size="20" value="" autocomplete="off" /></label>
624
- </p>
625
- <p>
626
- <label for="pass2"><?php _e('Confirm new password') ?><br />
627
- <input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off" /></label>
628
- </p>
629
-
630
- <div id="pass-strength-result" class="hide-if-no-js"><?php _e('Strength indicator'); ?></div>
631
- <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ &amp; ).'); ?></p>
632
-
633
- <br class="clear" />
634
-
635
- <?php
636
- /**
637
- * Fires following the 'Strength indicator' meter in the user password reset form.
638
- *
639
- * @since 3.9.0
640
- *
641
- * @param WP_User $user User object of the user whose password is being reset.
642
- */
643
- do_action( 'resetpass_form', $user );
644
- ?>
645
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Reset Password'); ?>" /></p>
646
- </form>
647
-
648
- <p id="nav">
649
- <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a>
650
- <?php
651
- if ( get_option( 'users_can_register' ) ) :
652
- $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
653
-
654
- /** This filter is documented in wp-includes/general-template.php */
655
- echo ' | ' . apply_filters( 'register', $registration_url );
656
- endif;
657
- ?>
658
- </p>
659
-
660
- <?php
661
- login_footer('user_pass');
662
- break;
663
-
664
- case 'register' :
665
- if ( is_multisite() ) {
666
- /**
667
- * Filter the Multisite sign up URL.
668
- *
669
- * @since 3.0.0
670
- *
671
- * @param string $sign_up_url The sign up URL.
672
- */
673
- wp_redirect( apply_filters( 'wp_signup_location', network_site_url( 'wp-signup.php' ) ) );
674
- exit;
675
- }
676
-
677
- if ( !get_option('users_can_register') ) {
678
- wp_redirect( site_url('wp-login.php?registration=disabled') );
679
- exit();
680
- }
681
-
682
- $user_login = '';
683
- $user_email = '';
684
- if ( $http_post ) {
685
- $user_login = $_POST['user_login'];
686
- $user_email = $_POST['user_email'];
687
- $errors = register_new_user($user_login, $user_email);
688
- if ( !is_wp_error($errors) ) {
689
- $redirect_to = !empty( $_POST['redirect_to'] ) ? $_POST['redirect_to'] : 'wp-login.php?checkemail=registered';
690
- wp_safe_redirect( $redirect_to );
691
- exit();
692
- }
693
- }
694
-
695
- $registration_redirect = ! empty( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
696
- /**
697
- * Filter the registration redirect URL.
698
- *
699
- * @since 3.0.0
700
- *
701
- * @param string $registration_redirect The redirect destination URL.
702
- */
703
- $redirect_to = apply_filters( 'registration_redirect', $registration_redirect );
704
- login_header(__('Registration Form'), '<p class="message register">' . __('Register For This Site') . '</p>', $errors);
705
- ?>
706
-
707
- <form name="registerform" id="registerform" action="<?php echo esc_url( site_url('wp-login.php?action=register', 'login_post') ); ?>" method="post" novalidate="novalidate">
708
- <p>
709
- <label for="user_login"><?php _e('Username') ?><br />
710
- <input type="text" name="user_login" id="user_login" class="input" value="<?php echo esc_attr(wp_unslash($user_login)); ?>" size="20" /></label>
711
- </p>
712
- <p>
713
- <label for="user_email"><?php _e('E-mail') ?><br />
714
- <input type="email" name="user_email" id="user_email" class="input" value="<?php echo esc_attr( wp_unslash( $user_email ) ); ?>" size="25" /></label>
715
- </p>
716
- <?php
717
- /**
718
- * Fires following the 'E-mail' field in the user registration form.
719
- *
720
- * @since 2.1.0
721
- */
722
- do_action( 'register_form' );
723
- ?>
724
- <p id="reg_passmail"><?php _e('A password will be e-mailed to you.') ?></p>
725
- <br class="clear" />
726
- <input type="hidden" name="redirect_to" value="<?php echo esc_attr( $redirect_to ); ?>" />
727
- <p class="submit"><input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Register'); ?>" /></p>
728
- </form>
729
-
730
- <p id="nav">
731
- <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in' ); ?></a> |
732
- <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ) ?>"><?php _e( 'Lost your password?' ); ?></a>
733
- </p>
734
-
735
- <?php
736
- login_footer('user_login');
737
- break;
738
-
739
- case 'login' :
740
- default:
741
- $secure_cookie = '';
742
- $customize_login = isset( $_REQUEST['customize-login'] );
743
- if ( $customize_login )
744
- wp_enqueue_script( 'customize-base' );
745
-
746
- // If the user wants ssl but the session is not ssl, force a secure cookie.
747
- if ( !empty($_POST['log']) && !force_ssl_admin() ) {
748
- $user_name = sanitize_user($_POST['log']);
749
- if ( $user = get_user_by('login', $user_name) ) {
750
- if ( get_user_option('use_ssl', $user->ID) ) {
751
- $secure_cookie = true;
752
- force_ssl_admin(true);
753
- }
754
- }
755
- }
756
-
757
- if ( isset( $_REQUEST['redirect_to'] ) ) {
758
- $redirect_to = $_REQUEST['redirect_to'];
759
- // Redirect to https if user wants ssl
760
- if ( $secure_cookie && false !== strpos($redirect_to, 'wp-admin') )
761
- $redirect_to = preg_replace('|^http://|', 'https://', $redirect_to);
762
- } else {
763
- $redirect_to = admin_url();
764
- }
765
-
766
- $reauth = empty($_REQUEST['reauth']) ? false : true;
767
-
768
- $user = wp_signon( '', $secure_cookie );
769
-
770
- if ( empty( $_COOKIE[ LOGGED_IN_COOKIE ] ) ) {
771
- if ( headers_sent() ) {
772
- $user = new WP_Error( 'test_cookie', sprintf( __( '<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>.' ),
773
- __( 'http://codex.wordpress.org/Cookies' ), __( 'https://wordpress.org/support/' ) ) );
774
- } elseif ( isset( $_POST['testcookie'] ) && empty( $_COOKIE[ TEST_COOKIE ] ) ) {
775
- // If cookies are disabled we can't log in even with a valid user+pass
776
- $user = new WP_Error( 'test_cookie', sprintf( __( '<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ),
777
- __( 'http://codex.wordpress.org/Cookies' ) ) );
778
- }
779
- }
780
-
781
- $requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
782
- /**
783
- * Filter the login redirect URL.
784
- *
785
- * @since 3.0.0
786
- *
787
- * @param string $redirect_to The redirect destination URL.
788
- * @param string $requested_redirect_to The requested redirect destination URL passed as a parameter.
789
- * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise.
790
- */
791
- $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
792
-
793
- if ( !is_wp_error($user) && !$reauth ) {
794
- if ( $interim_login ) {
795
- $message = '<p class="message">' . __('You have logged in successfully.') . '</p>';
796
- $interim_login = 'success';
797
- login_header( '', $message ); ?>
798
- </div>
799
- <?php
800
- /** This action is documented in wp-login.php */
801
- do_action( 'login_footer' ); ?>
802
- <?php if ( $customize_login ) : ?>
803
- <script type="text/javascript">setTimeout( function(){ new wp.customize.Messenger({ url: '<?php echo wp_customize_url(); ?>', channel: 'login' }).send('login') }, 1000 );</script>
804
- <?php endif; ?>
805
- </body></html>
806
- <?php exit;
807
- }
808
-
809
- if ( ( empty( $redirect_to ) || $redirect_to == 'wp-admin/' || $redirect_to == admin_url() ) ) {
810
- // 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.
811
- if ( is_multisite() && !get_active_blog_for_user($user->ID) && !is_super_admin( $user->ID ) )
812
- $redirect_to = user_admin_url();
813
- elseif ( is_multisite() && !$user->has_cap('read') )
814
- $redirect_to = get_dashboard_url( $user->ID );
815
- elseif ( !$user->has_cap('edit_posts') )
816
- $redirect_to = admin_url('profile.php');
817
- }
818
- wp_safe_redirect($redirect_to);
819
- exit();
820
- }
821
-
822
- $errors = $user;
823
- // Clear errors if loggedout is set.
824
- if ( !empty($_GET['loggedout']) || $reauth )
825
- $errors = new WP_Error();
826
-
827
- if ( $interim_login ) {
828
- if ( ! $errors->get_error_code() )
829
- $errors->add('expired', __('Session expired. Please log in again. You will not move away from this page.'), 'message');
830
- } else {
831
- // Some parts of this script use the main login form to display a message
832
- if ( isset($_GET['loggedout']) && true == $_GET['loggedout'] )
833
- $errors->add('loggedout', __('You are now logged out.'), 'message');
834
- elseif ( isset($_GET['registration']) && 'disabled' == $_GET['registration'] )
835
- $errors->add('registerdisabled', __('User registration is currently not allowed.'));
836
- elseif ( isset($_GET['checkemail']) && 'confirm' == $_GET['checkemail'] )
837
- $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
838
- elseif ( isset($_GET['checkemail']) && 'newpass' == $_GET['checkemail'] )
839
- $errors->add('newpass', __('Check your e-mail for your new password.'), 'message');
840
- elseif ( isset($_GET['checkemail']) && 'registered' == $_GET['checkemail'] )
841
- $errors->add('registered', __('Registration complete. Please check your e-mail.'), 'message');
842
- elseif ( strpos( $redirect_to, 'about.php?updated' ) )
843
- $errors->add('updated', __( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
844
- }
845
-
846
- /**
847
- * Filter the login page errors.
848
- *
849
- * @since 3.6.0
850
- *
851
- * @param object $errors WP Error object.
852
- * @param string $redirect_to Redirect destination URL.
853
- */
854
- $errors = apply_filters( 'wp_login_errors', $errors, $redirect_to );
855
-
856
- // Clear any stale cookies.
857
- if ( $reauth )
858
- wp_clear_auth_cookie();
859
-
860
- login_header(__('Log In'), '', $errors);
861
-
862
- if ( isset($_POST['log']) )
863
- $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : '';
864
- $rememberme = ! empty( $_POST['rememberme'] );
865
- ?>
866
-
867
- <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
868
- <p>
869
- <label for="user_login"><?php _e('Username') ?><br />
870
- <input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
871
- </p>
872
- <p>
873
- <label for="user_pass"><?php _e('Password') ?><br />
874
- <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
875
- </p>
876
- <?php
877
- /**
878
- * Fires following the 'Password' field in the login form.
879
- *
880
- * @since 2.1.0
881
- */
882
- do_action( 'login_form' );
883
- ?>
884
- <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever" <?php checked( $rememberme ); ?> /> <?php esc_attr_e('Remember Me'); ?></label></p>
885
- <p class="submit">
886
- <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" />
887
- <?php if ( $interim_login ) { ?>
888
- <input type="hidden" name="interim-login" value="1" />
889
- <?php } else { ?>
890
- <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
891
- <?php } ?>
892
- <?php if ( $customize_login ) : ?>
893
- <input type="hidden" name="customize-login" value="1" />
894
- <?php endif; ?>
895
- <input type="hidden" name="testcookie" value="1" />
896
- </p>
897
- </form>
898
-
899
- <?php if ( ! $interim_login ) { ?>
900
- <p id="nav">
901
- <?php if ( ! isset( $_GET['checkemail'] ) || ! in_array( $_GET['checkemail'], array( 'confirm', 'newpass' ) ) ) :
902
- if ( get_option( 'users_can_register' ) ) :
903
- $registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register' ) );
904
-
905
- /** This filter is documented in wp-includes/general-template.php */
906
- echo apply_filters( 'register', $registration_url ) . ' | ';
907
- endif;
908
- ?>
909
- <a href="<?php echo esc_url( wp_lostpassword_url() ); ?>" title="<?php esc_attr_e( 'Password Lost and Found' ); ?>"><?php _e( 'Lost your password?' ); ?></a>
910
- <?php endif; ?>
911
- </p>
912
- <?php } ?>
913
-
914
- <script type="text/javascript">
915
- function wp_attempt_focus(){
916
- setTimeout( function(){ try{
917
- <?php if ( $user_login ) { ?>
918
- d = document.getElementById('user_pass');
919
- d.value = '';
920
- <?php } else { ?>
921
- d = document.getElementById('user_login');
922
- <?php if ( 'invalid_username' == $errors->get_error_code() ) { ?>
923
- if( d.value != '' )
924
- d.value = '';
925
- <?php
926
- }
927
- }?>
928
- d.focus();
929
- d.select();
930
- } catch(e){}
931
- }, 200);
932
- }
933
-
934
- <?php if ( !$error ) { ?>
935
- wp_attempt_focus();
936
- <?php } ?>
937
- if(typeof wpOnload=='function')wpOnload();
938
- <?php if ( $interim_login ) { ?>
939
- (function(){
940
- try {
941
- var i, links = document.getElementsByTagName('a');
942
- for ( i in links ) {
943
- if ( links[i].href )
944
- links[i].target = '_blank';
945
- }
946
- } catch(e){}
947
- }());
948
- <?php } ?>
949
- </script>
950
-
951
- <?php
952
- login_footer();
953
- break;
954
- } // end action switch