Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions lib/CleantalkSP/SpbctWP/RenameLoginPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ public function wpLoaded()

global $pagenow;

if ( !Post::getString('post_password') || Get::getString('action') !== 'postpass' ) {
$is_postpass = Post::getString('post_password') && Get::getString('action') === 'postpass';

if ( !$is_postpass ) {
// Prevent redirecting from /wp-admin/ to login_url
if (
!defined('DOING_AJAX') &&
Expand All @@ -126,15 +128,15 @@ public function wpLoaded()
);
die();
}
}

if ( $this->on_wp_login ) {
// Fix "Undefined variable" warnings in php >= 8
$user_login = '';
$error = '';
if ( $this->on_wp_login ) {
// Fix "Undefined variable" warnings in php >= 8
$user_login = '';
$error = '';

require_once ABSPATH . 'wp-login.php';
die();
}
require_once ABSPATH . 'wp-login.php';
die();
}
}

Expand Down Expand Up @@ -244,11 +246,11 @@ public function wpRedirect($location, $status)
*/
public function filterWpLoginPhp($url, $scheme = null)
{

if ( strpos($url, 'wp-login.php') !== false // Ignoring if doesn't contains 'wp-login.php'
if (
strpos($url, 'wp-login.php') !== false // Ignoring if doesn't contains 'wp-login.php'
// Not a single thought about it
// strpos( $url, 'wp-login.php?action=postpass' ) === false && // Also ignoring
// strpos( wp_get_referer(), 'wp-login.php' ) !== false // Referer must be 'wp-login.php'
// strpos( $url, 'wp-login.php?action=postpass' ) === false && // Also ignoring
// strpos( wp_get_referer(), 'wp-login.php' ) !== false // Referer must be 'wp-login.php'
) {
$parsed_url = parse_url($url);

Expand Down
4 changes: 0 additions & 4 deletions security-malware-firewall.php
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,6 @@ function spbc_change_author_name($link, $_author_id, $_author_nicename)

//Password-protected pages also uses wp-login page, we should not break it
if ( $spbc->settings['login_page_rename__enabled'] ) {
if ( Get::getString('action') === 'postpass' ) {
require ABSPATH . 'wp-includes/pluggable.php';
}

new RenameLoginPage(
$spbc->settings['login_page_rename__name'],
$spbc->settings['login_page_rename__redirect']
Expand Down
Loading