Giter VIP home page Giter VIP logo

powermailrecaptcha's Introduction

powermailrecaptcha

Google recaptcha for TYPO3 powermail to prevent spam

Example form with a google recaptcha

Dependencies

Installation

  • Just install this extension via composer composer require in2code/powermailrecaptcha
  • Register your domain to www.google.com/recaptcha/ (registration direct link: https://g.co/recaptcha/v3 - reCAPTCHA, Version 2)
  • Add sitekey and secretkey to TypoScript Constants (see example below)
  • Ensure that spamshield is enabled (see below)
  • Add a field of Type Google Recaptcha to your powermail form
  • Have fun

Example for TypoScript Constants:

plugin.tx_powermailrecaptcha.sitekey = 6LdsBBUTAAAAAKMhI67inzeAvzBh5JdRRxlCwbTz
plugin.tx_powermailrecaptcha.secretkey = 6LdsBBUTAAAAAKMhaaaainzeAvzBh5JdRRxlCwbyy

Common pitfalls and best practice

spamshield must be enabled in powermail (TypoScript setup):

plugin.tx_powermail.settings.setup.spamshield._enable = 1

Keep up to date if powermail recognize spam (TypoScript setup):

# Get an email if spam was recognized
plugin.tx_powermail.settings.setup.spamshield.email = [email protected]

# Write to a logfile when spam was recognized
plugin.tx_powermail.settings.setup.spamshield.logfileLocation = typo3temp/logs/powermailSpam.log

Changelog

Version Date Description
5.2.1 2024-03-30 Support for Powermail 12
5.2.0 2023-12-31 Support for TYPO3 12
5.1.0 2023-05-13 Support for TYPO3 11 / Fix typo in ter-release.yml file
5.0.3 2021-09-25 Fix typo in ter-release.yml file
5.0.2 2021-09-09 Add extension key to composer.json
5.0.1 2020-12-03 Add TYPO3 dependency to ext_emconf.php to make TER upload happy
5.0.0 2020-12-03 Update dependencies for powermail 8.x
4.0.0 2018-11-21 Update dependencies for powermail 7.x
3.0.0 2018-07-13 Update dependencies for powermail 6.x
2.0.0 2018-02-14 Update dependencies for powermail 5.x
1.1.0 2017-11-04 Update dependencies for powermail 4.x
1.0.1 2016-08-06 Activate check only if form has a recaptcha field and not every time, some more stuff in the manual
1.0.0 2016-08-06 Initial upload - have fun

Development

Environment is included. Set it up via:

  • DDEV start
  • Composer install
  • ddev import-db .project/db.sql.gz

Made for TYPO3 12 / powermail 12

powermailrecaptcha's People

Contributors

einpraegsam avatar lucalane avatar sbusemann avatar schuberttobias avatar ursbraem avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

powermailrecaptcha's Issues

powermail with recaptcha

Hi,

We are using cool powermail extension with recaptcha. To make it work, we enabled spamshield. Now, when I enter all required fields, except the recaptcha one, I get this message in FE >

grafik

As user, I would be confused that I have to set checkbox at recaptcha to be able to send form. Maybe this could be improved?

thx
Florian

Is it possible to set captcha language?

The language of message displayed on the captcha box seems to be determined by browser language. Is it possible to force this setup based on the webpage language?

Using in ex. something like
plugin.tx_powermailrecaptcha.lang = fr

Thank you in advance for your help.
Regards,

error messages and parsley

How would one display parsley error messages on this captcha integration? By default I get no error message. If I check the "mandatory field" box in the backend then at least I get an error after the page submit, but no matter if the capcha is valid or not it always tell me that there is no value sent.

This is my current custom implementation:

<div class="field {vh:Validation.ErrorClass(field:field, class:'error')} powermail_fieldwrap powermail_fieldwrap_type_recaptcha powermail_fieldwrap_{field.marker} {field.css} {settings.styles.framework.fieldAndLabelWrappingClasses}">
	<label class="{settings.styles.framework.labelClasses}" title="{field.description}">
		<vh:string.RawAndRemoveXss>{field.title}</vh:string.RawAndRemoveXss><span class="mandatory">*</span>
	</label>
	<div class="row bottom-xs">
		<div class="col-xs-12 col-sm-6">
			<f:if condition="{settings.recaptcha.sitekey} != 'abcdef'">
				<f:then>
					<script src="//www.google.com/recaptcha/api.js" async defer></script>
					<div class="g-recaptcha" data-sitekey="{settings.recaptcha.sitekey}" data-parsley-errors-container=".powermail_field_error_container_{field.marker}"></div>
				</f:then>
				<f:else>
					<p>
						Please register your domain to
						<a href="https://www.google.com/recaptcha/">https://www.google.com/recaptcha/</a>
						and enter your sitekey in TypoScript Constants like<br />
						plugin.tx_powermailrecaptcha.sitekey = abcdef
					</p>
				</f:else>
			</f:if>
		</div>
		<div class="col-xs-12 col-sm-6">
			<div class="powermail_field_error_container_{field.marker}"></div>
			<f:form.validationResults>
				<f:if condition="{validationResults.flattenedErrors}">
					<f:for each="{validationResults.flattenedErrors}" as="errors">
						<f:for each="{errors}" as="singleError">
							<f:if condition="{field.marker} == {singleError.code}">
								<p class="error">
									<f:translate key="validationerror_{singleError.message}">{singleError.message}</f:translate>
								</p>
							</f:if>
						</f:for>
					</f:for>
				</f:if>
			</f:form.validationResults>
		</div>
	</div>
</div>

I've tried to target the div that should display the error messages with data-parsley-errors-container=".powermail_field_error_container{field.marker}"_. This works great for any other input (text, select, integrated captcha, etc) but not for powermailrecaptcha. The line <f:form.validationResults> is there just to show validation errors for this field it js is disabled or parsley is not used.

No drop-down entry "Google Captcha" to find

We have installed and configured the extension as described. Unfortunately, there is no "Google Captcha" in Powermail form fields.

We are currently using Typo3 7.6.15 and Powermail 3.11.1

Powermail v10 / TYPO3 v11 support

On upgrading a project, I just saw that I can't really install this extension because of the dependencies to powermail v8. Is there any plan on an update in the near future?

Multiple recaptcha on same page

Hello, great work btw.
Can you help me how to add multiple recaptcha on same page.
i have tab(4) content element and first 2 tabs are powermail forms, but when i set recaptcha on both forms i get error multiple loading source on same page for recaptcha.
Is there a way to add dynamically id in template of recaptcha, then we can remove line from template for calling api and assign it to page.includeJS as external source. So we can have multiple recaptcha but one call to api.

Thanks!

sitekey not visible

Hi there,
first of all, great work, it's really easy to install for noobs like me :D
but I have a problem, somehow the sitekey doesn't get delivered. I pasted the key in the ext_typoscript_setup.txt file, but the frontend gives "Please register you domain.. bla bla.. plugin.tx_powermailrecaptcha.sitekey = abcdef"
I hardcoded a {settings.recaptcha.sitekey} in the < p > tag in the .html file and it outputs "abcdef", so the link to it is broken. I'm a complete beginner in typo3, and the coding world too, but I like challenges. I'm trying to understand how your code works, how typoscript works and where exactly is the value saved. If i get to the bottom of it, I will write my fix here. A bit of help understanding how it works or what I should do would be great.
Thanks!

Environment variables

Hi

While implementing this extension into a project, we found that the current way of handling the configurations could be improved.

Right now, the defaults are in ext_typoscript_constants.txt and ext_typoscript_setup.txt (for which I could not find any documentation btw, are these following any core convention?). The problem with the current loading of configuration is that the loading order can't be affected in any way as the extension configuration itself is always loaded "at the end"; One can't override the settings in a custom project-specific extension's configuration that is being loaded through \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptSetup(). It only works so far if we put the configuration directly into a db-based sys_template record.

Additionally, as credentials should not be in a VCS anyway, we thought that we might be able to load the configuration via .env, as the API keys might be environment-specific. This would allow changing them without touching the database.

Maybe a nice improvement step would be to actually use ext_emconf_template.txt / get the configuration from the EXTENSIONS array from e. g. LocalConfiguration.php / AdditionalConfiguration.php which then would allow to set the API keys via .env, and it would also allow to override configuration in a project extension as described above, without it ignoring the desired loading order.

What do you think?

Spam flood despite captcha

I activated and integrated the captcha. It is also displayed. Unfortunately I had a flood of spam today.

Problem could be that you can send the form (at least some) without filling in the captcha.

The captcha is created. sitekey / secret set. It is marked as a mandatory field.

If it doesn't work you can send the form without captcha.

What could be the reason?

I run typo3 8.7.24 latest powermail and latest captcha

Thanks in advance.

reCaptcha with confirmation page

Hi,
When i submit a basic form, after the confirmation page, it gives me this error

selection_025

Without confirmation page, everything is fine tho
Note: I have the same error with the jh_captcha extension, any idea?
Thanks

Configurable error message

After I migrated from "rh_recaptcha" I encountered the problem of a missing custom message like "Please solve the Captcha!" instead of the default spam faktor message.

I don't see a possibility to determine the spamcheck failed because of the recaptcha...

This may leads to a conceptional issue up to powermail itself, would be a great feature to alternatively define custom validation messages yourself for fields in general.

Greetings
Daniel

Error when form is called after optinAction?

https://github.com/einpraegsam/powermailrecaptcha/blob/6220109c81bc5d113517ef9e15769364fe53fba2/Classes/Domain/Validator/SpamShield/RecaptchaMethod.php#L110

I think you should consider the case that a recaptcha validation is unnecessary or even worse may lead to errors when called from the optinAction. I would like to suggest to add that case to the condition like so:

return ($this->getActionName() === 'create' && $confirmationActive) || $this->getActionName() === 'optinConfirm';

Composer.json not up to date

Hello there,

It seems that the composer json still has version 1.0.1 and therefore is not deployed correctly to packagist. Could you update this?

Best Regards
Luca

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.