diff --git a/src/Auth_Command.php b/src/Auth_Command.php index 1e36e9f..07a991e 100644 --- a/src/Auth_Command.php +++ b/src/Auth_Command.php @@ -585,6 +585,31 @@ public function delete( $args, $assoc_args ) { if ( ! $ip ) { $user = EE\Utils\get_flag_value( $assoc_args, 'user' ); + + //When command is of the form `ee auth delete `. + if ( null === $user ) { + EE::line( 'Auto deleting Whitelisted IPs if any...' ); + + $whitelists = Whitelist::where( + array( + 'site_url' => $site_url, + ) + ); + + foreach ( $whitelists as $whitelist ) { + $whitelist->delete(); + } + + if ( 'default' === $site_url ) { + $this->generate_global_whitelist(); + } else { + $this->generate_site_whitelist( $site_url ); + } + + reload_global_nginx_proxy(); + + } + $auths = $this->get_auths( $site_url, $user ); foreach ( $auths as $auth ) {