Skip to content

Commit

Permalink
UPDATED: New license meta key compatibility with server manager.
Browse files Browse the repository at this point in the history
-  Product slug is now strictly required.
  • Loading branch information
hsehszroc committed Jan 5, 2022
1 parent a635b08 commit 49e3625
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Includes/API/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ private function get_validation_args( string $flag ): array {
return array(
'form_state' => 'validate',
'flag' => $flag,
'slug' => $this->product_slug,
);
}

Expand Down Expand Up @@ -1176,7 +1177,7 @@ public function validate_license( array $parameters ) {

$headers = array(
// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
'Authorization' => 'TWS ' . base64_encode( "{$license->key}/{$license->purchased_on}:{$this->hash}" ),
'Authorization' => 'TWS ' . base64_encode( "{$this->key}/{$license->purchased_on}:{$this->hash}" ),
'Referer' => get_bloginfo( 'url' ),
);

Expand Down Expand Up @@ -1220,7 +1221,9 @@ private function prepare_request() {
return;
}

if ( $this->key === $this->get_license( 'key' ) ) {
$meta_key = $this->parse_url( get_bloginfo( 'url' ) ) . '-' . $this->product_slug;

if ( $meta_key === $this->get_license( 'key' ) ) {
// No further processing if license is already active for this site.
if ( 'deactivate' !== $this->step && 'active' === $this->get_license( 'status' ) ) {
$this->client->add_error(
Expand Down

0 comments on commit 49e3625

Please sign in to comment.