Skip to content

Commit

Permalink
Merge branch 'eap'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
#	Resources/Private/Templates/Form/Form.html
#	composer.json
#	ext_emconf.php
  • Loading branch information
mschwemer committed Jan 23, 2024
2 parents 99f5e10 + db1a376 commit 2d4fafa
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 31 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ter-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
ter-release:
if: github.repository == 'einpraegsam/invisiblerecaptcha'
name: TER release
runs-on: ubuntu-latest
env:
Expand Down
14 changes: 5 additions & 9 deletions Classes/Domain/Validator/SpamShield/RecaptchaMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@
declare(strict_types=1);
namespace In2code\Invisiblerecaptcha\Domain\Validator\SpamShield;

use Exception;
use In2code\Powermail\Domain\Model\Field;
use In2code\Powermail\Domain\Validator\SpamShield\AbstractMethod;
use LogicException;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationExtensionNotConfiguredException;
use TYPO3\CMS\Core\Configuration\Exception\ExtensionConfigurationPathDoesNotExistException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\Exception;

/**
* Class RecaptchaMethod
*/
class RecaptchaMethod extends AbstractMethod
{
/**
* @var string
*/
protected $secretKey = '';
protected string $secretKey = '';

/**
* Check if secret key is given and set it
*
* @return void
* @throws \Exception
* @throws Exception
*/
public function initialize(): void
{
if ($this->isFormWithRecaptchaField()) {
if (empty($this->configuration['secretkey']) || $this->configuration['secretkey'] === 'abcdef') {
throw new \LogicException(
throw new LogicException(
'No secretkey given. Please add a secret key to TypoScript Constants',
1607014176
);
Expand All @@ -40,7 +38,6 @@ public function initialize(): void

/**
* @return bool true if spam recognized
* @throws Exception
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
*/
Expand All @@ -63,7 +60,6 @@ public function spamCheck(): bool
* @return bool
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
* @throws Exception
*/
protected function isFormWithRecaptchaField(): bool
{
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

## Google invisible recaptcha for TYPO3 powermail to prevent spam

This extensions implements reCAPTCHA, Version 2 (https://developers.google.com/recaptcha/docs/display?hl=de)

![Example form with a google invisble recaptcha](Documentation/Images/frontend.png "Example form with a google invisble recaptcha")


Expand Down Expand Up @@ -46,7 +44,9 @@ plugin.tx_powermail.settings.setup.spamshield.logfileLocation = typo3temp/logs/p

| Version | Date | Description |
|---------|------------|-----------------------------------------------------------------------|
| 6.0.0 | 2023-07-06 | Update for powermail 8.x (the nearly forgotten release for TYPO3 11) |
| 7.0.1 | 2024-01-23 | Update for powermail 11.x - 12.x / TYPO3 12 |
| 7.0.0 | 2023-07-10 | Update for powermail 11.x / TYPO3 12 |
| 6.0.0 | 2023-07-10 | Update for powermail 10.x / TYPO3 11 |
| 5.1.1 | 2021-09-25 | Fix a typo in ter-release.yml file |
| 5.1.0 | 2021-09-09 | Added auto deployment to TER, add extension key to composer.json file |
| 5.0.0 | 2020-12-03 | Update for powermail 8.x |
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<script>
function onSubmit(token) {
document.getElementById("powermailform{field.pages.forms.uid}").submit();
document.getElementById("powermailform{field.page.form.uid}").submit();
}
</script>

<div class="powermail_fieldwrap powermail_fieldwrap_type_submit powermail_fieldwrap_{field.marker} {field.css} {settings.styles.framework.fieldAndLabelWrappingClasses}">
<div class="{settings.styles.framework.fieldWrappingClasses} {settings.styles.framework.offsetClasses}">
<f:if condition="{settings.invisiblerecaptcha.sitekey} != 'abcdef'">
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "typo3-cms-extension",
"license": "GPL-2.0-or-later",
"require": {
"in2code/powermail": "^10.0",
"in2code/powermail": "^11.0 | dev-develop",
"ext-json": "*"
},
"replace": {
Expand Down
6 changes: 3 additions & 3 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
'title' => 'invisiblerecaptcha',
'description' => 'Google invisible recaptcha TYPO3 extension for powermail',
'category' => 'plugin',
'version' => '6.0.0',
'version' => '7.0.1',
'state' => 'stable',
'author' => 'Powermail Development Team',
'author_email' => 'alexander.kellner@in2code.de',
'author_company' => 'in2code.de',
'constraints' => [
'depends' => [
'powermail' => '10.0.0-10.99.99',
'typo3' => '11.0.0-11.5.99'
'powermail' => '11.0.0-12.99.99',
'typo3' => '12.4.0-12.4.99'
],
'conflicts' => [],
'suggests' => [],
Expand Down
17 changes: 17 additions & 0 deletions ext_localconf.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

declare(strict_types=1);

use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;

defined('TYPO3') or die();

$versionInformation = GeneralUtility::makeInstance(Typo3Version::class);
// Only include page.tsconfig if TYPO3 version is below 12 so that it is not imported twice.
if ($versionInformation->getMajorVersion() < 12) {
ExtensionManagementUtility::addPageTSConfig('
@import "EXT:invisiblerecaptcha/Configuration/page.tsconfig"
');
}
13 changes: 0 additions & 13 deletions ext_tables.php

This file was deleted.

File renamed without changes.
File renamed without changes.

0 comments on commit 2d4fafa

Please sign in to comment.