Skip to content

Commit

Permalink
Merge pull request #210 from itk-dev/feature/SUPP0RT-1165-honeypot-ajax
Browse files Browse the repository at this point in the history
SUPP0RT-1165: Added patch fixing honeypot and ajax clash
  • Loading branch information
jekuaitk authored Aug 14, 2023
2 parents 95b64b3 + 74c3cca commit bb827c0
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Nedenfor ses dato for release og beskrivelse af opgaver som er implementeret.

* Opdaterede til [Beskedfordeler drupal
1.1.1](https://github.com/itk-dev/beskedfordeler-drupal/releases/tag/1.1.1)
* Tilføjede patch for at undgå honeypot og ajax issues.

## [2.4.4]

Expand Down
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
"force-reset": true
},
"patches": {
"drupal/honeypot": {
"Fixes issue with clash between ajax and honeypot (https://www.drupal.org/project/honeypot/issues/2396193)": "patches/drupal/honeypot/honeypot-ajax.patch"
},
"drupal/webform_migrate": {
"Set to support. Checkbox condition fixes": "https://raw.githubusercontent.com/OS2Forms/os2forms8/master/patches/setto-and-checkboxes-condition-fix-onlyD7.patch"
},
Expand Down
12 changes: 10 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions patches/drupal/honeypot/honeypot-ajax.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
diff --git a/src/HoneypotService.php b/src/HoneypotService.php
index 1eeb6df..9a6f3a3 100644
--- a/src/HoneypotService.php
+++ b/src/HoneypotService.php
@@ -329,6 +329,12 @@ class HoneypotService implements HoneypotServiceInterface {
return;
}

+ // If the triggering element is using ajax behaviour
+ // then skip time restriction validation.
+ if (isset($triggering_element['#ajax'])) {
+ return;
+ }
+
// Get the time value.
$identifier = $form_state->getValue('honeypot_time', FALSE);
$honeypot_time = $this->keyValue->get($identifier, 0);

0 comments on commit bb827c0

Please sign in to comment.