Skip to content

Commit d0a8ed0

Browse files
committed
refactor: action redirect controller
1 parent c5f31b3 commit d0a8ed0

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

includes/Actions/ActionController.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ public function handleRedirect(WP_REST_Request $request)
3838
{
3939
$state = $request->get_param('state');
4040

41-
$state_host = static::getHostWithPort(wp_parse_url($state));
42-
$site_host = static::getHostWithPort(wp_parse_url(get_site_url()));
43-
44-
if ($state_host !== $site_host) {
41+
if (static::getHostWithPort($state) !== static::getHostWithPort(get_site_url())) {
4542
return new WP_Error('404');
4643
}
4744

@@ -53,8 +50,10 @@ public function handleRedirect(WP_REST_Request $request)
5350
}
5451
}
5552

56-
public static function getHostWithPort($parsed_url)
53+
public static function getHostWithPort($url)
5754
{
55+
$parsed_url = wp_parse_url($url);
56+
5857
return $parsed_url['host'] . (empty($parsed_url['port']) ? null : (':' . $parsed_url['port']));
5958
}
6059
}

0 commit comments

Comments
 (0)