From fa446a496a5d1fc9e1abee4238e4770adc85f2d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Angutivik=20Casper=20R=C3=BAnur=20Tausen?= Date: Thu, 9 Nov 2023 15:33:00 +0100 Subject: [PATCH 1/7] Undo all of my previous changes --- CHANGELOG.md | 4 +-- composer.json | 5 ++-- .../src/Form/SettingsForm.php | 25 +++---------------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8de636e2..87a9d735 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ before starting to add changes. Use example [placed in the end of the page](#exa - [#73](https://github.com/OS2Forms/os2forms/pull/73a) Fix issue with nested elements in webform inherit - [#72](https://github.com/OS2Forms/os2forms/pull/72) - Fix certificate testing, also testing for RSA/PEM certs as well as PKCS12 + Closed this pull request, and undid changes in develop ## [3.13.2] 2023-10-19 @@ -187,4 +187,4 @@ before starting to add changes. Use example [placed in the end of the page](#exa [Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.5.0...HEAD [3.5.0]: https://github.com/OS2Forms/os2forms/compare/3.2.5...3.5.0 [3.2.6]: https://github.com/OS2Forms/os2forms/compare/3.2.5...3.2.6 -[3.2.5]: https://github.com/OS2Forms/os2forms/compare/3.2.4...3.2.5 +[3.2.5]: https://github.com/OS2Forms/os2forms/compare/3.2.4...3.2.5 \ No newline at end of file diff --git a/composer.json b/composer.json index ed85472b..bec2be9d 100644 --- a/composer.json +++ b/composer.json @@ -82,9 +82,8 @@ "tecnickcom/tcpdf": "~6", "webmozart/path-util": "^2.3", "wsdltophp/packagebase": "^5.0", - "zaporylie/composer-drupal-optimizations": "^1.2", - "ext-openssl": "*" - }, + "zaporylie/composer-drupal-optimizations": "^1.2" + }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "drupal/coder": "^8.3", diff --git a/modules/os2forms_digital_post/src/Form/SettingsForm.php b/modules/os2forms_digital_post/src/Form/SettingsForm.php index fc869112..1789cd00 100644 --- a/modules/os2forms_digital_post/src/Form/SettingsForm.php +++ b/modules/os2forms_digital_post/src/Form/SettingsForm.php @@ -258,27 +258,8 @@ public function submitForm(array &$form, FormStateInterface $formState): void { private function testCertificate(): void { try { $certificateLocator = $this->certificateLocatorHelper->getCertificateLocator(); - $certificatePath = $this->settings->getCertificate()[CertificateLocatorHelper::LOCATOR_TYPE_FILE_SYSTEM]['path']; - - // Check if the certificate has the pkcs12 extension or not. - if (pathinfo($certificatePath, PATHINFO_EXTENSION) == 'pkcs12') { - // Check the certificate if it is a valid pkcs12 certificate. - $certificateLocator->getCertificates(); - } - else { - // Get contents of certificate. - $certificateKeyFile = $certificateLocator->getCertificate(); - // Create an array for checking the key with the certificate. - $keyCheckData = [$certificateKeyFile, $certificateLocator->getPassphrase()]; - // Check the private key against the certificate. - $result = openssl_x509_check_private_key($certificateKeyFile, $keyCheckData); - // If the result is not "1", throw an exception. - if ($result != 1) { - throw new \ErrorException('PEM certificate is not valid.'); - } - } - - $this->messenger()->addStatus($this->t('Certificate successfully tested')); + $certificateLocator->getCertificates(); + $this->messenger()->addStatus($this->t('Certificate succesfully tested')); } catch (\Throwable $throwable) { $message = $this->t('Error testing certificate: %message', ['%message' => $throwable->getMessage()]); @@ -286,4 +267,4 @@ private function testCertificate(): void { } } -} +} \ No newline at end of file From 48526ac2cd445d55a25e9d71b88cd5a517683153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Angutivik=20Casper=20R=C3=BAnur=20Tausen?= Date: Thu, 9 Nov 2023 15:38:37 +0100 Subject: [PATCH 2/7] Add an empty line as required by coding standards. --- src/Form/SettingsForm.php | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index efb88219..912d85d3 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -88,3 +88,4 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } } + From a335a74b9f18d23db7f067827ae96e28f3e4eb8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Angutivik=20Casper=20R=C3=BAnur=20Tausen?= Date: Thu, 9 Nov 2023 15:40:27 +0100 Subject: [PATCH 3/7] Add an empty line as required by coding standards. --- src/Form/SettingsForm.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index 912d85d3..efb88219 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -88,4 +88,3 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } } - From e5437ac5e70d0af0d621a483f805bd02e979fa84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Angutivik=20Casper=20R=C3=BAnur=20Tausen?= Date: Thu, 9 Nov 2023 15:57:56 +0100 Subject: [PATCH 4/7] Fix newlines in the end of files --- modules/os2forms_digital_post/src/Form/SettingsForm.php | 2 +- src/Form/SettingsForm.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/os2forms_digital_post/src/Form/SettingsForm.php b/modules/os2forms_digital_post/src/Form/SettingsForm.php index 1789cd00..0d968590 100644 --- a/modules/os2forms_digital_post/src/Form/SettingsForm.php +++ b/modules/os2forms_digital_post/src/Form/SettingsForm.php @@ -267,4 +267,4 @@ private function testCertificate(): void { } } -} \ No newline at end of file +} diff --git a/src/Form/SettingsForm.php b/src/Form/SettingsForm.php index efb88219..41b2645a 100644 --- a/src/Form/SettingsForm.php +++ b/src/Form/SettingsForm.php @@ -85,6 +85,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { } $this->messenger()->addStatus($this->t('The configuration options have been saved.')); + } } From b24cc4d70ec0c969e5e5d268b864fff515f9dab5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Angutivik=20Casper=20R=C3=BAnur=20Tausen?= Date: Thu, 9 Nov 2023 16:17:44 +0100 Subject: [PATCH 5/7] Fix newline on CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87a9d735..a0a4d1d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -187,4 +187,4 @@ before starting to add changes. Use example [placed in the end of the page](#exa [Unreleased]: https://github.com/OS2Forms/os2forms/compare/3.5.0...HEAD [3.5.0]: https://github.com/OS2Forms/os2forms/compare/3.2.5...3.5.0 [3.2.6]: https://github.com/OS2Forms/os2forms/compare/3.2.5...3.2.6 -[3.2.5]: https://github.com/OS2Forms/os2forms/compare/3.2.4...3.2.5 \ No newline at end of file +[3.2.5]: https://github.com/OS2Forms/os2forms/compare/3.2.4...3.2.5 From a6676576769cbeae48fe789885bda543aa10f334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Angutivik=20Casper=20R=C3=BAnur=20Tausen?= Date: Thu, 9 Nov 2023 16:25:26 +0100 Subject: [PATCH 6/7] Fix tab formatting --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index bec2be9d..50d3d8f6 100644 --- a/composer.json +++ b/composer.json @@ -83,7 +83,7 @@ "webmozart/path-util": "^2.3", "wsdltophp/packagebase": "^5.0", "zaporylie/composer-drupal-optimizations": "^1.2" - }, + }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.1", "drupal/coder": "^8.3", @@ -146,4 +146,4 @@ "zaporylie/composer-drupal-optimizations": true } } -} \ No newline at end of file +} From 0b4f9ad0455fa53b3aad101e1db12de2dad41b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Angutivik=20Casper=20R=C3=BAnur=20Tausen?= Date: Fri, 10 Nov 2023 13:10:12 +0100 Subject: [PATCH 7/7] Remove mention of #72 in CHANGELOG.md --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0a4d1d6..88e04657 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,8 +13,6 @@ before starting to add changes. Use example [placed in the end of the page](#exa - [#73](https://github.com/OS2Forms/os2forms/pull/73a) Fix issue with nested elements in webform inherit -- [#72](https://github.com/OS2Forms/os2forms/pull/72) - Closed this pull request, and undid changes in develop ## [3.13.2] 2023-10-19