-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Whitelist Auth0 IPs by default and show in wp-admin #596
Conversation
@@ -81,17 +81,6 @@ public function install_db( $version_to_install = null, $app_token = '' ) { | |||
} | |||
} | |||
|
|||
if ( $this->current_db_version < 13 ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration is handled in v20
added below.
public function get_ips_by_domain( $domain ) { | ||
return $this->get_ip_by_region( WP_Auth0::get_tenant_region( $domain ) ); | ||
public function get_ips_by_domain( $domain = null, $glue = self::IP_STRING_GLUE ) { | ||
if ( empty( $domain ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default to current domain if none passed in.
* | ||
* @return string | ||
*/ | ||
public function get_ip_by_region( $region ) { | ||
return implode( ',', $this->valid_webtask_ips[ $region ] ); | ||
public function get_ip_by_region( $region, $glue = self::IP_STRING_GLUE ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow the glue to be customized.
} | ||
|
||
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unreachable return line.
protected function process_ip_list( $ip_list ) { | ||
$raw = explode( ',', $ip_list ); | ||
$raw = is_array( $ip_list ) ? $ip_list : explode( self::IP_STRING_GLUE, $ip_list ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Allow array and string
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
/** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only moved and docblocks added, no functionality change.
@@ -182,14 +252,11 @@ private function validate_ip() { | |||
return false; | |||
} | |||
|
|||
private function in_range( $ip, $range ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved ☝️
@@ -105,7 +105,7 @@ public function init() { | |||
'function' => 'render_migration_ws_ips_filter', | |||
), | |||
array( | |||
'name' => __( 'IP Addresses', 'wp-auth0' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unnecessary label for this field (see screenshot)
@@ -231,7 +231,8 @@ protected function render_radio_buttons( array $buttons, $id, $input_name, $curr | |||
* @param string $text - description text to display | |||
*/ | |||
protected function render_field_description( $text ) { | |||
printf( '<div class="subelement"><span class="description">%s.</span></div>', $text ); | |||
$period = ! in_array( $text[ strlen( $text ) - 1 ], array( '.', ':', '>' ) ) ? '.' : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not add a period if the final char is a period, colon, or open angle bracket
} | ||
} | ||
|
||
/** | ||
* Test a DB upgrade from v19 to v20. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful 🌅
b6e5e5d
to
cd29681
Compare
Codecov Report
@@ Coverage Diff @@
## master #596 +/- ##
===========================================
+ Coverage 28.56% 29.87% +1.3%
+ Complexity 1309 1305 -4
===========================================
Files 52 52
Lines 4201 4178 -23
===========================================
+ Hits 1200 1248 +48
+ Misses 3001 2930 -71
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Changes
References
Setting shows default IPs
Testing
Checklist