Skip to content

Commit

Permalink
Added a env variable to enable/disable recaptcha (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
aletail committed Aug 10, 2021
1 parent e9ac9cc commit 2f68d22
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@
# Account setup under developer@werkbot.com
# MAILCHIMP_API_KEY = 'd01dbb5471380f61adb94dc5db42c536-us1'
# MAILCHIMP_SERVER_PREFIX = 'us1'

# Newsletter Recaptcha - true/false
# NEWSLETTER_RECAPTCHA = true
8 changes: 7 additions & 1 deletion src/NewsletterPageControllerExtender.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,13 @@ public function NewsletterForm(){

//CREATE THE FORM
$Form = new Form($this->owner, "NewsletterForm", $fields, $actions, $validator);
$data = array();

// Enable Recaptcha if enabled
if(Environment::getEnv('NEWSLETTER_RECAPTCHA')){
$Form->enableSpamProtection();
}

$data = array();
$Form->customise($data)->setTemplate(['Forms\\NewsletterForm', 'NewsletterForm']);

return $Form;
Expand Down

0 comments on commit 2f68d22

Please sign in to comment.