diff --git a/src/License.php b/src/License.php index b442c9d..a4320f0 100644 --- a/src/License.php +++ b/src/License.php @@ -185,6 +185,10 @@ protected function send_request( $license_key, $route ) { * License Refresh Endpoint */ public function refresh_license_api() { + if ( ! current_user_can( 'manage_options' ) || ! check_ajax_referer( $this->client->name, '_nonce', false ) ) { + wp_send_json_error( [ 'message' => 'Unauthorized.' ], 403 ); + } + $this->check_license_status(); wp_send_json_success( @@ -367,6 +371,8 @@ public function check_license_status() { } update_option( $this->option_key, $license, false ); + + $this->is_valid_license = null; } }