Fix the response mapping for the license API
authorTim Düsterhus <duesterhus@woltlab.com>
Thu, 21 Sep 2023 10:39:53 +0000 (12:39 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Thu, 21 Sep 2023 10:39:53 +0000 (12:39 +0200)
The authCode is an optional value.

wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php
wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php
wcfsetup/install/files/lib/acp/page/LicensePage.class.php

index dc566a5508c859c749fdf1d205b1c3b3c421d35a..f5427d06f73b533dbdfb9a11b1d9b3dee7fe967c 100644 (file)
@@ -138,7 +138,7 @@ final class FirstTimeSetupLicenseForm extends AbstractFormBuilderForm
                     array {
                         status: 200,
                         license: array {
-                            authCode: string,
+                            authCode?: string,
                             type: string,
                             expiryDates?: array<string, int>,
                         },
@@ -189,7 +189,7 @@ final class FirstTimeSetupLicenseForm extends AbstractFormBuilderForm
             Option::getOptionByName('first_time_setup_state')->optionID => 1,
         ];
 
-        if (isset($this->apiResponse)) {
+        if (isset($this->apiResponse) && isset($this->apiResponse['license']['authCode'])) {
             $optionData[Option::getOptionByName('package_server_auth_code')->optionID] = $this->apiResponse['license']['authCode'];
         }
 
index c2ccd8b28e1b6d263a525582f7cb3cb363de45fb..ae465e4a96d66580c23c4f2520d495666f766485 100644 (file)
@@ -186,7 +186,7 @@ final class LicenseEditForm extends AbstractFormBuilderForm
                     array {
                         status: 200,
                         license: array {
-                            authCode: string,
+                            authCode?: string,
                             type: string,
                             expiryDates?: array<string, int>,
                         },
@@ -238,7 +238,7 @@ final class LicenseEditForm extends AbstractFormBuilderForm
             $objectAction->executeAction();
         }
 
-        if (isset($this->apiResponse)) {
+        if (isset($this->apiResponse) && isset($this->apiResponse['license']['authCode'])) {
             $optionData = [
                 Option::getOptionByName('package_server_auth_code')->optionID => $this->apiResponse['license']['authCode'],
             ];
index b3eb889760c4cb16dd1be032ad5656a96ac42740..ef23f57517fbdfe2bbeee82b443b40133121f76b 100644 (file)
@@ -657,7 +657,7 @@ final class LicensePage extends AbstractPage
                     array {
                         status: 200,
                         license: array {
-                            authCode: string,
+                            authCode?: string,
                             type: string,
                             expiryDates?: array<string, int>,
                         },