WPS Hide Login - Version 1.5.1

Version Description

  • Fix : Action URL get_the_password_form()
Download this release

Release Info

Developer NicolasKulka
Plugin Icon 128x128 WPS Hide Login
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5 to 1.5.1

Files changed (3) hide show
  1. classes/plugin.php +42 -34
  2. readme.txt +5 -2
  3. wps-hide-login.php +3 -3
classes/plugin.php CHANGED
@@ -460,57 +460,61 @@ class Plugin {
460
 
461
  $request = parse_url( $_SERVER['REQUEST_URI'] );
462
 
463
- if ( is_admin() && ! is_user_logged_in() && ! defined( 'DOING_AJAX' ) && $pagenow !== 'admin-post.php' && ( isset( $_GET ) && empty( $_GET['adminhash'] ) && $request['path'] !== '/wp-admin/options.php' ) ) {
464
- wp_safe_redirect( $this->new_redirect_url() );
465
- die();
466
- }
467
 
468
- if ( $pagenow === 'wp-login.php'
469
- && $request['path'] !== $this->user_trailingslashit( $request['path'] )
470
- && get_option( 'permalink_structure' ) ) {
 
471
 
472
- wp_safe_redirect( $this->user_trailingslashit( $this->new_login_url() )
473
- . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' ) );
 
474
 
475
- die;
 
476
 
477
- } elseif ( $this->wp_login_php ) {
478
 
479
- if ( ( $referer = wp_get_referer() )
480
- && strpos( $referer, 'wp-activate.php' ) !== false
481
- && ( $referer = parse_url( $referer ) )
482
- && ! empty( $referer['query'] ) ) {
483
 
484
- parse_str( $referer['query'], $referer );
 
 
 
485
 
486
- if ( ! empty( $referer['key'] )
487
- && ( $result = wpmu_activate_signup( $referer['key'] ) )
488
- && is_wp_error( $result )
489
- && ( $result->get_error_code() === 'already_active'
490
- || $result->get_error_code() === 'blog_taken' ) ) {
491
 
492
- wp_safe_redirect( $this->new_login_url()
493
- . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' ) );
 
 
 
494
 
495
- die;
 
 
 
 
 
496
 
497
  }
498
 
499
- }
500
 
501
- $this->wp_template_loader();
 
502
 
503
- } elseif ( $pagenow === 'wp-login.php' ) {
504
- global $error, $interim_login, $action, $user_login;
 
 
505
 
506
- if ( is_user_logged_in() && ! isset( $_REQUEST['action'] ) ) {
507
- wp_safe_redirect( admin_url() );
508
- die();
509
- }
510
 
511
- @require_once ABSPATH . 'wp-login.php';
512
 
513
- die;
514
 
515
  }
516
 
@@ -540,6 +544,10 @@ class Plugin {
540
 
541
  public function filter_wp_login_php( $url, $scheme = null ) {
542
 
 
 
 
 
543
  if ( strpos( $url, 'wp-login.php' ) !== false ) {
544
 
545
  if ( is_ssl() ) {
460
 
461
  $request = parse_url( $_SERVER['REQUEST_URI'] );
462
 
463
+ if ( ! isset( $_POST['post_password'] ) ) {
 
 
 
464
 
465
+ if ( is_admin() && ! is_user_logged_in() && ! defined( 'DOING_AJAX' ) && $pagenow !== 'admin-post.php' && ( isset( $_GET ) && empty( $_GET['adminhash'] ) && $request['path'] !== '/wp-admin/options.php' ) ) {
466
+ wp_safe_redirect( $this->new_redirect_url() );
467
+ die();
468
+ }
469
 
470
+ if ( $pagenow === 'wp-login.php'
471
+ && $request['path'] !== $this->user_trailingslashit( $request['path'] )
472
+ && get_option( 'permalink_structure' ) ) {
473
 
474
+ wp_safe_redirect( $this->user_trailingslashit( $this->new_login_url() )
475
+ . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' ) );
476
 
477
+ die;
478
 
479
+ } elseif ( $this->wp_login_php ) {
 
 
 
480
 
481
+ if ( ( $referer = wp_get_referer() )
482
+ && strpos( $referer, 'wp-activate.php' ) !== false
483
+ && ( $referer = parse_url( $referer ) )
484
+ && ! empty( $referer['query'] ) ) {
485
 
486
+ parse_str( $referer['query'], $referer );
 
 
 
 
487
 
488
+ if ( ! empty( $referer['key'] )
489
+ && ( $result = wpmu_activate_signup( $referer['key'] ) )
490
+ && is_wp_error( $result )
491
+ && ( $result->get_error_code() === 'already_active'
492
+ || $result->get_error_code() === 'blog_taken' ) ) {
493
 
494
+ wp_safe_redirect( $this->new_login_url()
495
+ . ( ! empty( $_SERVER['QUERY_STRING'] ) ? '?' . $_SERVER['QUERY_STRING'] : '' ) );
496
+
497
+ die;
498
+
499
+ }
500
 
501
  }
502
 
503
+ $this->wp_template_loader();
504
 
505
+ } elseif ( $pagenow === 'wp-login.php' ) {
506
+ global $error, $interim_login, $action, $user_login;
507
 
508
+ if ( is_user_logged_in() && ! isset( $_REQUEST['action'] ) ) {
509
+ wp_safe_redirect( admin_url() );
510
+ die();
511
+ }
512
 
513
+ @require_once ABSPATH . 'wp-login.php';
 
 
 
514
 
515
+ die;
516
 
517
+ }
518
 
519
  }
520
 
544
 
545
  public function filter_wp_login_php( $url, $scheme = null ) {
546
 
547
+ if ( strpos( $url, 'wp-login.php?action=postpass' ) !== false ) {
548
+ return $url;
549
+ }
550
+
551
  if ( strpos( $url, 'wp-login.php' ) !== false ) {
552
 
553
  if ( is_ssl() ) {
readme.txt CHANGED
@@ -4,9 +4,9 @@ Contributors: tabrisrp, WPServeur, nicolaskulka
4
  Donate link : https://www.paypal.me/donateWPServeur
5
  Tags: rename, login, wp-login, wp-login.php, custom login url, jetpack
6
  Requires at least: 4.1
7
- Tested up to: 4.9
8
  Requires PHP: 7.0
9
- Stable tag: 1.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -146,6 +146,9 @@ First step is to check your .htaccess file and compare it to a regular one, to s
146
 
147
  == Changelog ==
148
 
 
 
 
149
  = 1.5 =
150
  * Enhancement: Add custom redirection URL
151
 
4
  Donate link : https://www.paypal.me/donateWPServeur
5
  Tags: rename, login, wp-login, wp-login.php, custom login url, jetpack
6
  Requires at least: 4.1
7
+ Tested up to: 5.0
8
  Requires PHP: 7.0
9
+ Stable tag: 1.5.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
146
 
147
  == Changelog ==
148
 
149
+ = 1.5.1 =
150
+ * Fix : Action URL get_the_password_form()
151
+
152
  = 1.5 =
153
  * Enhancement: Add custom redirection URL
154
 
wps-hide-login.php CHANGED
@@ -5,9 +5,9 @@ Description: Protect your website by changing the login URL and preventing acces
5
  Donate link: https://www.paypal.me/donateWPServeur
6
  Author: WPServeur, NicolasKulka, tabrisrp
7
  Author URI: https://wpserveur.net
8
- Version: 1.5
9
  Requires at least: 4.1
10
- Tested up to: 4.9
11
  Requires PHP: 7.0
12
  Domain Path: languages
13
  Text Domain: wpserveur-hide-login
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  }
22
 
23
  // Plugin constants
24
- define( 'WPS_HIDE_LOGIN_VERSION', '1.5' );
25
  define( 'WPS_HIDE_LOGIN_FOLDER', 'wps-hide-login' );
26
 
27
  define( 'WPS_HIDE_LOGIN_URL', plugin_dir_url( __FILE__ ) );
5
  Donate link: https://www.paypal.me/donateWPServeur
6
  Author: WPServeur, NicolasKulka, tabrisrp
7
  Author URI: https://wpserveur.net
8
+ Version: 1.5.1
9
  Requires at least: 4.1
10
+ Tested up to: 5.0
11
  Requires PHP: 7.0
12
  Domain Path: languages
13
  Text Domain: wpserveur-hide-login
21
  }
22
 
23
  // Plugin constants
24
+ define( 'WPS_HIDE_LOGIN_VERSION', '1.5.1' );
25
  define( 'WPS_HIDE_LOGIN_FOLDER', 'wps-hide-login' );
26
 
27
  define( 'WPS_HIDE_LOGIN_URL', plugin_dir_url( __FILE__ ) );