From 41304d5eb855c64167a8f1124a62ed14e4ce46b1 Mon Sep 17 00:00:00 2001
From: Brian Canini <canini.16@osu.edu>
Date: Fri, 3 Apr 2020 10:23:30 -0400
Subject: [PATCH] honeypot module patch

- Better results if honeypot-field is placed as first field
---
 composer.json                                       |  3 +++
 vendor/composer/installed.json                      |  3 +++
 .../simplesamlphp/simplesamlphp/config/config.php   | 13 ++-----------
 web/modules/honeypot/PATCHES.txt                    |  7 +++++++
 web/modules/honeypot/honeypot.module                |  3 ++-
 5 files changed, 17 insertions(+), 12 deletions(-)
 create mode 100644 web/modules/honeypot/PATCHES.txt

diff --git a/composer.json b/composer.json
index 615b3d344c..060f7a9919 100644
--- a/composer.json
+++ b/composer.json
@@ -292,6 +292,9 @@
             "drupal/focal_point": {
                 "3106445": "https://www.drupal.org/files/issues/2020-01-23/Focal_point-Referential_Integrity-3106445-4.patch"
             },
+            "drupal/honeypot": {
+                "2811189": "https://www.drupal.org/files/issues/2019-08-08/honeypot_field_weight_2811189-18.patch"
+            },
             "drupal/linkit": {
                 "2712951": "https://www.drupal.org/files/issues/2019-11-27/linkit_for_link_field-2712951-140.patch"
             },
diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json
index 78c6f10c83..22958b8a22 100644
--- a/vendor/composer/installed.json
+++ b/vendor/composer/installed.json
@@ -5385,6 +5385,9 @@
                     "status": "covered",
                     "message": "Covered by Drupal's security advisory policy"
                 }
+            },
+            "patches_applied": {
+                "2811189": "https://www.drupal.org/files/issues/2019-08-08/honeypot_field_weight_2811189-18.patch"
             }
         },
         "installation-source": "dist",
diff --git a/vendor/simplesamlphp/simplesamlphp/config/config.php b/vendor/simplesamlphp/simplesamlphp/config/config.php
index 578d36b001..c4b5de123a 100644
--- a/vendor/simplesamlphp/simplesamlphp/config/config.php
+++ b/vendor/simplesamlphp/simplesamlphp/config/config.php
@@ -6,7 +6,7 @@
 if (empty($_SERVER['PATH_INFO']) && !empty($_SERVER['DOCUMENT_URI'])) {
     $index = strpos($_SERVER['DOCUMENT_URI'], '.php');
     if($index) {
-      $_SERVER['PATH_INFO'] = substr($_SERVER['DOCUMENT_URI'], $index+4);
+            $_SERVER['PATH_INFO'] = substr($_SERVER['DOCUMENT_URI'], $index+4);
     }
 }
 
@@ -22,15 +22,6 @@
 $drop_id = $ps['conf']['pantheon_binding'];
 $db = $ps['databases']['default']['default'];
 
-
-if($_SERVER['HOME'] == '/') {
-  $temp_path = '/tmp';
-}
-else {
-  $temp_path = $_SERVER['HOME'] . '/tmp/simplesaml';
-}
-// error_log("temp_path: " . $temp_path);
-
 //  Set metadata path
 $metadata_folder = __DIR__ . '/../../../../web/sites/default/files/private/simplesamlphp/metadata';
 // error_log("config.php - metadata_folder: $metadata_folder");
@@ -135,7 +126,7 @@
     'certdir' => $cert_folder,
     'loggingdir' => 'log/',
     'datadir' => 'data/',
-    'tempdir'               =>  $temp_path,
+    'tempdir'               =>  '/srv/bindings/' . $drop_id . '/tmp/simplesaml',
     'supressportnumber'     => TRUE,
     'cronkey'				=> '5nvD3MgHLDDStnEKgK0au3vhqEjNNnvkHLmbVWvObIl2lpx0guXx5h',
 
diff --git a/web/modules/honeypot/PATCHES.txt b/web/modules/honeypot/PATCHES.txt
new file mode 100644
index 0000000000..dfab2f9819
--- /dev/null
+++ b/web/modules/honeypot/PATCHES.txt
@@ -0,0 +1,7 @@
+This file was automatically generated by Composer Patches (https://github.com/cweagans/composer-patches)
+Patches applied to this directory:
+
+2811189
+Source: https://www.drupal.org/files/issues/2019-08-08/honeypot_field_weight_2811189-18.patch
+
+
diff --git a/web/modules/honeypot/honeypot.module b/web/modules/honeypot/honeypot.module
index 1da86a6609..1f2d7e94b3 100644
--- a/web/modules/honeypot/honeypot.module
+++ b/web/modules/honeypot/honeypot.module
@@ -156,7 +156,7 @@ function honeypot_add_form_protection(&$form, FormStateInterface $form_state, ar
       '#type' => 'textfield',
       '#title' => t('Leave this field blank'),
       '#size' => 20,
-      '#weight' => 100,
+      '#weight' => -1,
       '#attributes' => ['autocomplete' => 'off'],
       '#element_validate' => ['_honeypot_honeypot_validate'],
     ];
@@ -177,6 +177,7 @@ function honeypot_add_form_protection(&$form, FormStateInterface $form_state, ar
     $form['honeypot_time'] = [
       '#type' => 'hidden',
       '#title' => t('Timestamp'),
+      '#weight' => -1,
       '#default_value' => $identifier,
       '#element_validate' => ['_honeypot_time_restriction_validate'],
       '#cache' => [
-- 
GitLab