From 539d69905af8b19778e91b8491de65c5ef26164f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 21 Sep 2023 12:39:53 +0200 Subject: [PATCH] Fix the response mapping for the license API The authCode is an optional value. --- .../files/lib/acp/form/FirstTimeSetupLicenseForm.class.php | 4 ++-- wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php | 4 ++-- wcfsetup/install/files/lib/acp/page/LicensePage.class.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php b/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php index dc566a5508..f5427d06f7 100644 --- a/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/FirstTimeSetupLicenseForm.class.php @@ -138,7 +138,7 @@ final class FirstTimeSetupLicenseForm extends AbstractFormBuilderForm array { status: 200, license: array { - authCode: string, + authCode?: string, type: string, expiryDates?: array, }, @@ -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']; } diff --git a/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php b/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php index c2ccd8b28e..ae465e4a96 100644 --- a/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php @@ -186,7 +186,7 @@ final class LicenseEditForm extends AbstractFormBuilderForm array { status: 200, license: array { - authCode: string, + authCode?: string, type: string, expiryDates?: array, }, @@ -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'], ]; diff --git a/wcfsetup/install/files/lib/acp/page/LicensePage.class.php b/wcfsetup/install/files/lib/acp/page/LicensePage.class.php index b3eb889760..ef23f57517 100644 --- a/wcfsetup/install/files/lib/acp/page/LicensePage.class.php +++ b/wcfsetup/install/files/lib/acp/page/LicensePage.class.php @@ -657,7 +657,7 @@ final class LicensePage extends AbstractPage array { status: 200, license: array { - authCode: string, + authCode?: string, type: string, expiryDates?: array, }, -- 2.20.1