v1.6.4
This commit is contained in:
parent
511d2fefae
commit
e568b54336
1 changed files with 62 additions and 15 deletions
|
|
@ -236,6 +236,33 @@ class Login_Form_Manager {
|
|||
add_action( 'init', array( $this, 'maybe_remove_altcha_interceptor' ), 0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the canonical wp-login.php URL used for 2FA stage navigation.
|
||||
*
|
||||
* Builds the URL from the real wp-login.php path instead of wp_login_url().
|
||||
* The `login_url` filter applied by wp_login_url() can be hijacked by
|
||||
* third-party plugins (for example Restrict Content Pro's "Hijack Login
|
||||
* URL" option) to return a membership page, which would send the user to a
|
||||
* page where the verification form cannot render: core only fires the
|
||||
* login_init hook when wp-login.php itself loads. This mirrors the URL
|
||||
* construction wp_login_url() performs before its filter runs.
|
||||
*
|
||||
* @since 1.6.4
|
||||
*
|
||||
* @param string $redirect_to Optional redirect_to value to carry over.
|
||||
*
|
||||
* @return string Absolute wp-login.php URL with optional redirect_to parameter.
|
||||
*/
|
||||
public static function get_canonical_login_url( string $redirect_to = '' ): string {
|
||||
$url = site_url( 'wp-login.php', 'login' );
|
||||
|
||||
if ( '' !== $redirect_to ) {
|
||||
$url = add_query_arg( 'redirect_to', urlencode( $redirect_to ), $url );
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable the ALTCHA Spam Protection login interceptor during the 2FA stage.
|
||||
*
|
||||
|
|
@ -863,7 +890,7 @@ class Login_Form_Manager {
|
|||
self::QUERY_STAGE_TOKEN => $stage_token,
|
||||
);
|
||||
|
||||
$login_url = wp_login_url( $redirect_to );
|
||||
$login_url = self::get_canonical_login_url( $redirect_to );
|
||||
$login_url = add_query_arg( $query_args, $login_url );
|
||||
|
||||
wp_safe_redirect( $login_url );
|
||||
|
|
@ -1433,7 +1460,7 @@ class Login_Form_Manager {
|
|||
*/
|
||||
private function get_stage_url( array $extra_args = array() ): string {
|
||||
$redirect_to = $this->get_requested_redirect();
|
||||
$login_url = wp_login_url( $redirect_to );
|
||||
$login_url = self::get_canonical_login_url( $redirect_to );
|
||||
|
||||
$args = array(
|
||||
self::QUERY_STAGE => self::STAGE_VERIFY,
|
||||
|
|
|
|||
Loading…
Reference in a new issue