Skip to content

Commit

Permalink
Merge branch 'release/2.0.4' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
waldhacker1 committed Dec 1, 2022
2 parents 81fcba3 + b52609f commit 7998c4d
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 55 deletions.
5 changes: 1 addition & 4 deletions .gitattributes
Expand Up @@ -21,9 +21,6 @@
.env.dist text eol=lf
bin/* text eol=lf

.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.gitlab-ci.yml export-ignore
.* export-ignore
/build/ export-ignore
/Tests/ export-ignore
33 changes: 28 additions & 5 deletions .github/workflows/ci.yml
Expand Up @@ -6,12 +6,24 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
php: [ 7.4, 8.0 ]
typo3: [ '^10.4', '^11.5', '^12.0' ]
php: [ '7.4', '8.0', '8.1' ]
exclude:
- typo3: '^10.4'
php: '8.0'
- typo3: '^10.4'
php: '8.1'
- typo3: '^11.5'
php: '8.1'
- typo3: '^12.0'
php: '7.4'
- typo3: '^12.0'
php: '8.0'
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup PHP
- name: Setup PHP version ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
Expand All @@ -28,23 +40,34 @@ jobs:
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-php-${{ matrix.php }}-composer-

- name: Install dependencies
run: composer install --prefer-dist --no-progress --optimize-autoloader
- name: Install dependencies with typo3/cms-core:${{ matrix.typo3 }}
run: |
composer require typo3/cms-core:${{ matrix.typo3 }} --prefer-dist --no-progress --no-suggest --optimize-autoloader
- name: Info
run: composer info

- name: Lint
run: |
composer run ci:lint:php
composer run ci:lint:yaml
composer run ci:lint:typoscript
- name: CGL
run: composer run ci:cgl:check
if: matrix.typo3 == '^11.5'

- name: Psalm
run: composer run ci:psalm
if: matrix.typo3 == '^11.5'

- name: PHPStan
run: composer run ci:stan
if: matrix.typo3 == '^11.5'

- name: Unit tests
run: composer run ci:tests:unit:cover
if: matrix.typo3 == '^11.5'

- name: Functional tests
run: composer run ci:tests:functional
if: matrix.typo3 == '^11.5'
27 changes: 27 additions & 0 deletions CHANGELOG.md
@@ -1,14 +1,41 @@
# Changelog


## 2.0.4 (2022-12-01)

### Tasks

* Add info about hcaptcha wordings to the docs #10. [waldhacker1]

* V12 compatibility. [waldhacker1]

* Fix license. [Ralf Zimmermann]

### Other

* Exclude all files/folders starting with a dot (#13) [Simon Schaufelberger]

* English wording (#11) [126016]

[TASK] english wording

* Merge tag '2.0.3' into develop. [waldhacker1]

2.0.3


## 2.0.3 (2022-01-21)

### Tasks

* Generate changelog. [waldhacker1]

* Revert ext_emconf version constraints. [waldhacker1]

### Other

* Merge branch 'release/2.0.3' into main. [waldhacker1]

* Merge tag '2.0.2' into develop. [waldhacker1]

2.0.2
Expand Down
8 changes: 7 additions & 1 deletion Classes/Validation/HcaptchaValidator.php
Expand Up @@ -84,14 +84,20 @@ private function validateHcaptcha(): array
return ['success' => false, 'error-codes' => ['invalid-post-form']];
}

$ip = '';
$normalizedParams = $request->getAttribute('normalizedParams');
if ($normalizedParams) {
$ip = $normalizedParams->getRemoteAddress();
}

$url = HttpUtility::buildUrl(
[
'host' => $this->getConfigurationService()->getVerificationServer(),
'query' => \http_build_query(
[
'secret' => $this->getConfigurationService()->getPrivateKey(),
'response' => $hcaptchaFormFieldValue,
'remoteip' => $request->getAttribute('normalizedParams')->getRemoteAddress(),
'remoteip' => $ip,
]
),
]
Expand Down
23 changes: 23 additions & 0 deletions Documentation/Changelog.rst
Expand Up @@ -2,15 +2,38 @@ Changelog
=========


2.0.4 (2022-12-01)
------------------

Tasks
~~~~~
- Add info about hcaptcha wordings to the docs #10. [waldhacker1]
- V12 compatibility. [waldhacker1]
- Fix license. [Ralf Zimmermann]

Other
~~~~~
- Exclude all files/folders starting with a dot (#13) [Simon
Schaufelberger]
- English wording (#11) [126016]

[TASK] english wording
- Merge tag '2.0.3' into develop. [waldhacker1]

2.0.3


2.0.3 (2022-01-21)
------------------

Tasks
~~~~~
- Generate changelog. [waldhacker1]
- Revert ext_emconf version constraints. [waldhacker1]

Other
~~~~~
- Merge branch 'release/2.0.3' into main. [waldhacker1]
- Merge tag '2.0.2' into develop. [waldhacker1]

2.0.2
Expand Down
10 changes: 5 additions & 5 deletions Documentation/Configuration/Index.rst
Expand Up @@ -23,14 +23,14 @@ No further configuration is necessary, however, it is recommended to create your
`hCaptcha` account, which allows you to adjust settings like difficulty or the types of
puzzles to use.

When using your own account, adjust the private and public key *constants*:
When using your own account, adjust the private key (hcaptcha wording: "Secret key") and public key (hcaptcha wording: "Site Key") *constants*:

.. code-block:: typoscript
plugin.tx_hcaptcha {
settings {
publicKey = <your-public-key>
privateKey = <your-private-key>
publicKey = <your-hcaptcha-site-key>
privateKey = <your-hcaptcha-secret-key>
}
}
Expand All @@ -42,8 +42,8 @@ variables (if you want installation wide configuration).

.. code-block:: bash
HCAPTCHA_PUBLIC_KEY=<your-public-key>
HCAPTCHA_PRIVATE_KEY=<your-private-key>
HCAPTCHA_PUBLIC_KEY=<your-hcaptcha-site-key>
HCAPTCHA_PRIVATE_KEY=<your-hcaptcha-secret-key>
.. note::

Expand Down
2 changes: 1 addition & 1 deletion Documentation/Introduction/Index.rst
Expand Up @@ -6,7 +6,7 @@
Introduction
============

The `hCaptcha` extensions adds a captcha to TYPO3 system extension `form` to stop spam/bots reliably.
The `hCaptcha` extension adds a captcha to TYPO3 system extension `form` to stop spam/bots reliably.
`hCaptcha` is a free-to-use service for sites of any size - you can even earn a bit of money with
it. Find more information on their website: https://www.hcaptcha.com/.

Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Expand Up @@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

hcaptcha
Copyright (C) 2020 Susi
hcaptcha extension for TYPO3
Copyright (C) 2021 waldhacker UG (haftungsbeschränkt)

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

hcaptcha Copyright (C) 2020 Susi
hcaptcha extension for TYPO3 Copyright (C) 2021 waldhacker UG (haftungsbeschränkt)
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
Expand Down
4 changes: 2 additions & 2 deletions Tests/Functional/FunctionalTestCase.php
Expand Up @@ -97,10 +97,10 @@ protected function setUp(): void
'acme-com',
$this->buildSiteConfiguration($this->rootPageUid, self::ROOT_PAGE_BASE_URI . '/'),
[
$this->buildDefaultLanguageConfiguration('DE', '/')
$this->buildDefaultLanguageConfiguration('DE', '/'),
],
[
$this->buildErrorHandlingConfiguration('Fluid', [404])
$this->buildErrorHandlingConfiguration('Fluid', [404]),
]
);

Expand Down
16 changes: 8 additions & 8 deletions Tests/Functional/HcaptchaValidationTest.php
Expand Up @@ -123,9 +123,9 @@ public function validationFailsOnMultiStepFormIfHcaptchaParametersAreInvalidData
'message' => 'some message',
],
'formDataNoPrefix' => [
'h-captcha-response' => ''
'h-captcha-response' => '',
],
'expectedErrorMessage' => 'Missing input.'
'expectedErrorMessage' => 'Missing input.',
];

yield 'h-captcha-response parameter is invalid' => [
Expand All @@ -136,9 +136,9 @@ public function validationFailsOnMultiStepFormIfHcaptchaParametersAreInvalidData
'message' => 'some message',
],
'formDataNoPrefix' => [
'h-captcha-response' => '123456'
'h-captcha-response' => '123456',
],
'expectedErrorMessage' => 'Invalid input response.'
'expectedErrorMessage' => 'Invalid input response.',
];
}

Expand Down Expand Up @@ -311,9 +311,9 @@ public function validationFailsOnSingleStepFormIfHcaptchaParametersAreInvalidDat
'message' => 'some message',
],
'formDataNoPrefix' => [
'h-captcha-response' => ''
'h-captcha-response' => '',
],
'expectedErrorMessage' => 'Missing input.'
'expectedErrorMessage' => 'Missing input.',
];

yield 'h-captcha-response parameter is invalid' => [
Expand All @@ -324,9 +324,9 @@ public function validationFailsOnSingleStepFormIfHcaptchaParametersAreInvalidDat
'message' => 'some message',
],
'formDataNoPrefix' => [
'h-captcha-response' => '123456'
'h-captcha-response' => '123456',
],
'expectedErrorMessage' => 'Invalid input response.'
'expectedErrorMessage' => 'Invalid input response.',
];
}

Expand Down
2 changes: 2 additions & 0 deletions Tests/Unit/Service/ConfigurationServiceTest.php
Expand Up @@ -52,6 +52,8 @@ protected function setUp(): void
*/
public function getPublicKeyThrowsExceptionIfKeyNotSet(): void
{
putenv('HCAPTCHA_PUBLIC_KEY');

$this->expectException(MissingKeyException::class);
$subject = new ConfigurationService($this->configurationManager->reveal());
$subject->getPublicKey();
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Validation/HcaptchaValidatorTest.php
Expand Up @@ -132,7 +132,7 @@ public function validateReturnsErrorIfVerificationRequestReturnsError(

$normalizedParams->getRemoteAddress()->willReturn('127.0.0.1');
$this->typo3request->getParsedBody()->willReturn([
'h-captcha-response' => 'verification-key-response'
'h-captcha-response' => 'verification-key-response',
]);

$configurationService->getVerificationServer()->willReturn('https://example.com/siteverify');
Expand Down
30 changes: 13 additions & 17 deletions composer.json
Expand Up @@ -18,29 +18,26 @@
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
"php": "^7.2 | ^8.0 | ^8.1",
"ext-json": "*",
"php": "^7.2 | ^8.0",
"typo3/cms-core": "^10.4 | ^11.0@dev | ^12.0.x-dev",
"typo3/cms-extbase": "^10.4 | ^11.0@dev | ^12.0.x-dev",
"typo3/cms-fluid": "^10.4 | ^11.0@dev | ^12.0.x-dev",
"typo3/cms-form": "^10.4 | ^11.0@dev | ^12.0.x-dev"
"typo3/cms-core": "^11.5",
"typo3/cms-extbase": "^10.4 | ^11.0@dev | ^12.0@dev",
"typo3/cms-fluid": "^10.4 | ^11.0@dev | ^12.0@dev",
"typo3/cms-form": "^10.4 | ^11.0@dev | ^12.0@dev"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"helmich/typo3-typoscript-lint": "^2.3",
"overtrue/phplint": "^2.0",
"friendsofphp/php-cs-fixer": "^2.16 | ^3.13",
"helmich/typo3-typoscript-lint": "^2.3 | ^3.0",
"overtrue/phplint": "^2.0 | ^5.3",
"phpspec/prophecy-phpunit": "^2.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan": "^0.12.50",
"phpunit/phpunit": "^9.4",
"roave/security-advisories": "dev-latest",
"saschaegerer/phpstan-typo3": "@dev",
"symfony/console": "^5.1",
"symfony/yaml": "^5.1",
"typo3/cms-fluid-styled-content": "^10.4 | ^11.0@dev | dev-main",
"typo3/coding-standards": "^0.3.0",
"typo3/testing-framework": "^6.14",
"vimeo/psalm": "^3.0 | ^4.0",
"saschaegerer/phpstan-typo3": "^1.8",
"typo3/cms-fluid-styled-content": "^10.4 | ^11.0@dev | ^12.0@dev",
"typo3/coding-standards": "^0.3 | ^0.5",
"typo3/testing-framework": "^6.14 | ^7.x-dev",
"vimeo/psalm": "^3.0 | ^4.0 | ^5.0",
"zbateson/mail-mime-parser": "^2.0"
},
"suggest": {
Expand All @@ -57,7 +54,6 @@
"sort-packages": true,
"vendor-dir": ".build/vendor",
"allow-plugins": {
"composer/package-versions-deprecated": true,
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true,
"phpstan/extension-installer": true
Expand Down
14 changes: 7 additions & 7 deletions ext_emconf.php
Expand Up @@ -10,13 +10,13 @@
'state' => 'stable',
'uploadfolder' => '0',
'clearCacheOnLoad' => 1,
'version' => '2.0.3',
'version' => '2.0.4',
'constraints' => [
'depends' => [
'extbase' => '10.4.0-11.5.99',
'fluid' => '10.4.0-11.5.99',
'form' => '10.4.0-11.5.99',
'typo3' => '10.4.0-11.5.99',
]
]
'extbase' => '10.4.0-12.0.99',
'fluid' => '10.4.0-12.0.99',
'form' => '10.4.0-12.0.99',
'typo3' => '10.4.0-12.0.99',
],
],
];
2 changes: 1 addition & 1 deletion ext_localconf.php
Expand Up @@ -8,7 +8,7 @@
'hcaptcha',
\TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class,
[
'source' => 'EXT:hcaptcha/Resources/Public/Icons/hcaptcha.svg'
'source' => 'EXT:hcaptcha/Resources/Public/Icons/hcaptcha.svg',
]
);
});

0 comments on commit 7998c4d

Please sign in to comment.